Ark Server API (ASE) - Wiki
Loading...
Searching...
No Matches
Poco::Crypto::RSAKey Class Reference

#include <RSAKey.h>

+ Inheritance diagram for Poco::Crypto::RSAKey:
+ Collaboration diagram for Poco::Crypto::RSAKey:

Public Types

enum  KeyLength { KL_512 = 512 , KL_1024 = 1024 , KL_2048 = 2048 , KL_4096 = 4096 }
 
enum  Exponent { EXP_SMALL = 0 , EXP_LARGE }
 
- Public Types inherited from Poco::Crypto::KeyPair
enum  Type { KT_RSA = KeyPairImpl::KT_RSA_IMPL , KT_EC = KeyPairImpl::KT_EC_IMPL }
 

Public Member Functions

 RSAKey (const EVPPKey &key)
 
 RSAKey (const X509Certificate &cert)
 Constructs ECKeyImpl by extracting the EC key.
 
 RSAKey (const PKCS12Container &cert)
 Extracts the RSA public key from the given certificate.
 
 RSAKey (KeyLength keyLength, Exponent exp)
 Extracts the RSA private key from the given certificate.
 
 RSAKey (const std::string &publicKeyFile, const std::string &privateKeyFile="", const std::string &privateKeyPassphrase="")
 
 RSAKey (std::istream *pPublicKeyStream, std::istream *pPrivateKeyStream=0, const std::string &privateKeyPassphrase="")
 
 RSAKey (const RSAKey &other)
 
 RSAKey (RSAKey &&other) noexcept
 Copy constructor.
 
 ~RSAKey ()
 Move constructor.
 
RSAKeyoperator= (const RSAKey &other)
 Destroys the RSAKey.
 
RSAKeyoperator= (RSAKey &&other) noexcept
 Assignment.
 
RSAKeyImpl::ByteVec modulus () const
 Move assignment.
 
RSAKeyImpl::ByteVec encryptionExponent () const
 Returns the RSA modulus.
 
RSAKeyImpl::ByteVec decryptionExponent () const
 Returns the RSA encryption exponent.
 
RSAKeyImpl::Ptr impl () const
 Returns the RSA decryption exponent.
 
- Public Member Functions inherited from Poco::Crypto::KeyPair
 KeyPair (KeyPairImpl::Ptr pKeyPairImpl=0)
 
 KeyPair (const KeyPair &other)
 Extracts the RSA public key from the given certificate.
 
 KeyPair (KeyPair &&other) noexcept
 Copy constructor.
 
KeyPairoperator= (const KeyPair &other)
 Move constructor.
 
KeyPairoperator= (KeyPair &&other) noexcept
 Assignment.
 
virtual ~KeyPair ()
 Move assignment.
 
virtual int size () const
 Destroys the KeyPair.
 
virtual void save (const std::string &publicKeyPairFile, const std::string &privateKeyPairFile="", const std::string &privateKeyPairPassphrase="") const
 Returns the RSA modulus size.
 
virtual void save (std::ostream *pPublicKeyPairStream, std::ostream *pPrivateKeyPairStream=0, const std::string &privateKeyPairPassphrase="") const
 
KeyPairImpl::Ptr impl () const
 
const std::string & name () const
 Returns the impl object.
 
Type type () const
 Returns key pair name.
 

Detailed Description

This class stores an RSA key pair, consisting of private and public key. Storage of the private key is optional.

If a private key is available, the RSAKey can be used for decrypting data (encrypted with the public key) or computing secure digital signatures.

Definition at line 34 of file RSAKey.h.

Member Enumeration Documentation

◆ Exponent

Enumerator
EXP_SMALL 
EXP_LARGE 

Definition at line 52 of file RSAKey.h.

◆ KeyLength

Enumerator
KL_512 
KL_1024 
KL_2048 
KL_4096 

Definition at line 44 of file RSAKey.h.

Constructor & Destructor Documentation

◆ RSAKey() [1/8]

Poco::Crypto::RSAKey::RSAKey ( const EVPPKey & key)

◆ RSAKey() [2/8]

Poco::Crypto::RSAKey::RSAKey ( const X509Certificate & cert)

Constructs ECKeyImpl by extracting the EC key.

◆ RSAKey() [3/8]

Poco::Crypto::RSAKey::RSAKey ( const PKCS12Container & cert)

Extracts the RSA public key from the given certificate.

◆ RSAKey() [4/8]

Poco::Crypto::RSAKey::RSAKey ( KeyLength keyLength,
Exponent exp )

Extracts the RSA private key from the given certificate.

◆ RSAKey() [5/8]

Poco::Crypto::RSAKey::RSAKey ( const std::string & publicKeyFile,
const std::string & privateKeyFile = "",
const std::string & privateKeyPassphrase = "" )

Creates the RSAKey. Creates a new public/private keypair using the given parameters. Can be used to sign data and verify signatures.

◆ RSAKey() [6/8]

Poco::Crypto::RSAKey::RSAKey ( std::istream * pPublicKeyStream,
std::istream * pPrivateKeyStream = 0,
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.

Cannot be used for signing or decryption unless a private key is available.

If a private key is specified, you don't need to specify a public key file. OpenSSL will auto-create the public key from the private key.

◆ RSAKey() [7/8]

Poco::Crypto::RSAKey::RSAKey ( const RSAKey & other)

Creates the RSAKey, by reading public and private key from the given streams and using the given passphrase for the private key.

Cannot be used for signing or decryption unless a private key is available.

If a private key is specified, you don't need to specify a public key file. OpenSSL will auto-create the public key from the private key.

◆ RSAKey() [8/8]

Poco::Crypto::RSAKey::RSAKey ( RSAKey && other)
noexcept

Copy constructor.

◆ ~RSAKey()

Poco::Crypto::RSAKey::~RSAKey ( )

Move constructor.

Member Function Documentation

◆ decryptionExponent()

RSAKeyImpl::ByteVec Poco::Crypto::RSAKey::decryptionExponent ( ) const

Returns the RSA encryption exponent.

◆ encryptionExponent()

RSAKeyImpl::ByteVec Poco::Crypto::RSAKey::encryptionExponent ( ) const

Returns the RSA modulus.

◆ impl()

RSAKeyImpl::Ptr Poco::Crypto::RSAKey::impl ( ) const
inline

Returns the RSA decryption exponent.

Definition at line 125 of file RSAKey.h.

+ Here is the call graph for this function:

◆ modulus()

RSAKeyImpl::ByteVec Poco::Crypto::RSAKey::modulus ( ) const

Move assignment.

◆ operator=() [1/2]

RSAKey & Poco::Crypto::RSAKey::operator= ( const RSAKey & other)

Destroys the RSAKey.

◆ operator=() [2/2]

RSAKey & Poco::Crypto::RSAKey::operator= ( RSAKey && other)
noexcept

Assignment.


The documentation for this class was generated from the following file: