Library: Crypto
Package: RSA
Header: Poco/Crypto/RSAKeyImpl.h
class RSAKeyImpl
Direct Base Classes: Poco::RefCountedObject
All Base Classes: Poco::RefCountedObject
Member Functions: decryptionExponent, encryptionExponent, getRSA, modulus, save, size
Inherited Functions: duplicate, referenceCount, release
typedef std::vector < unsigned char > ByteVec;
typedef Poco::AutoPtr < RSAKeyImpl > Ptr;
explicit RSAKeyImpl(
const X509Certificate & cert
);
Extracts the RSA public key from the given certificate.
RSAKeyImpl(
int keyLength,
unsigned long exponent
);
Creates the RSAKey. Creates a new public/private keypair using the given parameters. Can be used to sign data and verify signatures.
RSAKeyImpl(
const std::string & publicKeyFile,
const std::string & privateKeyFile,
const std::string & privateKeyPassphrase
);
Creates the RSAKey, by reading public and private key from the given files and using the given passphrase for the private key. Can only by used for signing if a private key is available.
RSAKeyImpl(
std::istream * pPublicKeyStream,
std::istream * pPrivateKeyStream,
const std::string & privateKeyPassphrase
);
Creates the RSAKey. Can only by used for signing if pPrivKey is not null. If a private key file is specified, you don't need to specify a public key file. OpenSSL will auto-create it from the private key.
~RSAKeyImpl();
Destroys the RSAKeyImpl.
ByteVec decryptionExponent() const;
Returns the RSA decryption exponent.
ByteVec encryptionExponent() const;
Returns the RSA encryption exponent.
RSA * getRSA();
Returns the OpenSSL RSA object.
const RSA * getRSA() const;
Returns the OpenSSL RSA object.
ByteVec modulus() const;
Returns the RSA modulus.
void save(
const std::string & publicKeyFile,
const std::string & privateKeyFile = "",
const std::string & privateKeyPassphrase = ""
);
Exports the public and private keys to the given files.
If an empty filename is specified, the corresponding key is not exported.
void save(
std::ostream * pPublicKeyStream,
std::ostream * pPrivateKeyStream = 0,
const std::string & privateKeyPassphrase = ""
);
Exports the public and private key to the given streams.
If a null pointer is passed for a stream, the corresponding key is not exported.
int size() const;
Returns the RSA modulus size.