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

class RSAKeyImpl More...

#include <RSAKeyImpl.h>

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

Public Types

using Ptr = Poco::AutoPtr<RSAKeyImpl>
 
using ByteVec = std::vector<unsigned char>
 
- Public Types inherited from Poco::Crypto::KeyPairImpl
enum  Type { KT_RSA_IMPL = 0 , KT_EC_IMPL }
 
using Ptr = Poco::AutoPtr<KeyPairImpl>
 
using ByteVec = std::vector<unsigned char>
 

Public Member Functions

 RSAKeyImpl (const EVPPKey &key)
 
 RSAKeyImpl (const X509Certificate &cert)
 Constructs ECKeyImpl by extracting the EC key.
 
 RSAKeyImpl (const PKCS12Container &cert)
 Extracts the RSA public key from the given certificate.
 
 RSAKeyImpl (int keyLength, unsigned long exponent)
 Extracts the EC private key from the given certificate.
 
 RSAKeyImpl (const std::string &publicKeyFile, const std::string &privateKeyFile, const std::string &privateKeyPassphrase)
 
 RSAKeyImpl (std::istream *pPublicKeyStream, std::istream *pPrivateKeyStream, const std::string &privateKeyPassphrase)
 
 ~RSAKeyImpl ()
 
RSAgetRSA ()
 Destroys the RSAKeyImpl.
 
const RSAgetRSA () const
 Returns the OpenSSL RSA object.
 
int size () const
 Returns the OpenSSL RSA object.
 
ByteVec modulus () const
 Returns the RSA modulus size.
 
ByteVec encryptionExponent () const
 Returns the RSA modulus.
 
ByteVec decryptionExponent () const
 Returns the RSA encryption exponent.
 
void save (const std::string &publicKeyFile, const std::string &privateKeyFile="", const std::string &privateKeyPassphrase="") const
 Returns the RSA decryption exponent.
 
void save (std::ostream *pPublicKeyStream, std::ostream *pPrivateKeyStream=0, const std::string &privateKeyPassphrase="") const
 
- Public Member Functions inherited from Poco::Crypto::KeyPairImpl
 KeyPairImpl (const std::string &name, Type type)
 
virtual ~KeyPairImpl ()
 Create KeyPairImpl with specified type and name.
 
const std::string & name () const
 
Type type () const
 Returns key pair name.
 
- Public Member Functions inherited from Poco::RefCountedObject
 RefCountedObject ()
 
void duplicate () const
 
void release () const noexcept
 Increments the object's reference count.
 
int referenceCount () const
 

Private Member Functions

 RSAKeyImpl ()
 
void freeRSA ()
 

Static Private Member Functions

static ByteVec convertToByteVec (const BIGNUM *bn)
 

Private Attributes

RSA_pRSA
 

Additional Inherited Members

- Protected Member Functions inherited from Poco::RefCountedObject
virtual ~RefCountedObject ()
 Returns the reference count.
 

Detailed Description

class RSAKeyImpl

Definition at line 46 of file RSAKeyImpl.h.

Member Typedef Documentation

◆ ByteVec

using Poco::Crypto::RSAKeyImpl::ByteVec = std::vector<unsigned char>

Definition at line 51 of file RSAKeyImpl.h.

◆ Ptr

Constructor & Destructor Documentation

◆ RSAKeyImpl() [1/7]

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

◆ RSAKeyImpl() [2/7]

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

Constructs ECKeyImpl by extracting the EC key.

◆ RSAKeyImpl() [3/7]

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

Extracts the RSA public key from the given certificate.

◆ RSAKeyImpl() [4/7]

Poco::Crypto::RSAKeyImpl::RSAKeyImpl ( int keyLength,
unsigned long exponent )

Extracts the EC private key from the given certificate.

◆ RSAKeyImpl() [5/7]

Poco::Crypto::RSAKeyImpl::RSAKeyImpl ( 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.

◆ RSAKeyImpl() [6/7]

Poco::Crypto::RSAKeyImpl::RSAKeyImpl ( std::istream * pPublicKeyStream,
std::istream * pPrivateKeyStream,
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()

Poco::Crypto::RSAKeyImpl::~RSAKeyImpl ( )

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() [7/7]

Poco::Crypto::RSAKeyImpl::RSAKeyImpl ( )
private

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.

Member Function Documentation

◆ convertToByteVec()

static ByteVec Poco::Crypto::RSAKeyImpl::convertToByteVec ( const BIGNUM * bn)
staticprivate

◆ decryptionExponent()

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

Returns the RSA encryption exponent.

◆ encryptionExponent()

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

Returns the RSA modulus.

◆ freeRSA()

void Poco::Crypto::RSAKeyImpl::freeRSA ( )
private

◆ getRSA() [1/2]

RSA * Poco::Crypto::RSAKeyImpl::getRSA ( )
inline

Destroys the RSAKeyImpl.

Definition at line 126 of file RSAKeyImpl.h.

◆ getRSA() [2/2]

const RSA * Poco::Crypto::RSAKeyImpl::getRSA ( ) const
inline

Returns the OpenSSL RSA object.

Definition at line 132 of file RSAKeyImpl.h.

◆ modulus()

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

Returns the RSA modulus size.

◆ save() [1/2]

void Poco::Crypto::RSAKeyImpl::save ( const std::string & publicKeyFile,
const std::string & privateKeyFile = "",
const std::string & privateKeyPassphrase = "" ) const
virtual

Returns the RSA decryption exponent.

Implements Poco::Crypto::KeyPairImpl.

◆ save() [2/2]

void Poco::Crypto::RSAKeyImpl::save ( std::ostream * pPublicKeyStream,
std::ostream * pPrivateKeyStream = 0,
const std::string & privateKeyPassphrase = "" ) const
virtual

Exports the public and private keys to the given files.

If an empty filename is specified, the corresponding key is not exported.

Implements Poco::Crypto::KeyPairImpl.

◆ size()

int Poco::Crypto::RSAKeyImpl::size ( ) const
virtual

Returns the OpenSSL RSA object.

Implements Poco::Crypto::KeyPairImpl.

Member Data Documentation

◆ _pRSA

RSA* Poco::Crypto::RSAKeyImpl::_pRSA
private

Definition at line 119 of file RSAKeyImpl.h.


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