Poco::Crypto

class RSAKey

Library: Crypto
Package: CryptoCore
Header: Poco/Crypto/RSAKey.h

Description

Stores an RSAKey

Member Summary

Member Functions: impl, name, save, size

Enumerations

Exponent

EXP_SMALL = 0

EXP_LARGE

KeyLength

KL_512 = 512

KL_1024 = 1024

KL_2048 = 2048

KL_4096 = 4096

Constructors

RSAKey

RSAKey(
    const Poco::Net::X509Certificate & cert
);

Extracts the RSAKey from the certificate

RSAKey

RSAKey(
    KeyLength keyLength,
    Exponent exp
);

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

RSAKey

RSAKey(
    const std::string & publicKeyFile,
    const std::string & privateKeyFile = "",
    const std::string & privateKeyPwd = ""
);

Creates the RSAKey. Can only by used for signing if privateKeyFile is not empty.

RSAKey

RSAKey(
    std::istream * pPubKey,
    std::istream * pPrivKey = 0,
    const std::string & privateKeyPwd = ""
);

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.

Destructor

~RSAKey

~RSAKey();

Destroys the RSAKey.

Member Functions

impl inline

RSAKeyImpl::Ptr impl();

Returns the impl object

name

const std::string & name() const;

Returns "rsa"

save

void save(
    const std::string & pubKeyFile,
    const std::string & privKeyFile = "",
    const std::string & privKeyPwd = ""
);

Exports the keys to the given files. pubKeyFile/privKeyFile can be empty

save

void save(
    std::ostream * pPubKey,
    std::ostream * pPrivKey = 0,
    const std::string & privateKeyPwd = ""
);

Exports the keys to the given streams. pPubKey/pPrivKey can be empty

size

int size() const;

Returns the RSA_size