libcryptosec
|
#include <KeyPair.h>
Public Member Functions | |
KeyPair (AsymmetricKey::Algorithm algorithm, int length) throw (AsymmetricKeyException) | |
KeyPair (Engine *engine, std::string keyId) throw (EngineException) | |
KeyPair (std::string pemEncoded, ByteArray passphrase) throw (EncodeException) | |
KeyPair (std::string pemEncoded) throw (EncodeException) | |
KeyPair (ByteArray derEncoded) throw (EncodeException) | |
KeyPair (const KeyPair &keyPair) | |
virtual | ~KeyPair () |
virtual PublicKey * | getPublicKey () throw (AsymmetricKeyException, EncodeException) |
virtual PrivateKey * | getPrivateKey () throw (AsymmetricKeyException) |
std::string | getPemEncoded (SymmetricKey &passphrase, SymmetricCipher::OperationMode mode) throw (SymmetricCipherException, EncodeException) |
std::string | getPemEncoded () throw (EncodeException) |
ByteArray | getDerEncoded () throw (EncodeException) |
virtual AsymmetricKey::Algorithm | getAlgorithm () throw (AsymmetricKeyException) |
int | getSize () throw (AsymmetricKeyException) |
int | getSizeBits () throw (AsymmetricKeyException) |
EVP_PKEY * | getEvpPkey () const |
ENGINE * | getEngine () const |
std::string | getKeyId () const |
Protected Member Functions | |
KeyPair () | |
std::string | getPublicKeyPemEncoded () throw (EncodeException) |
Static Protected Member Functions | |
static int | passphraseCallBack (char *buf, int size, int rwflag, void *u) |
Protected Attributes | |
EVP_PKEY * | key |
std::string | keyId |
ENGINE * | engine |
Representa um par de chaves assimétricas. Essa classe deve ser usada para a criação de chaves assimétricas bem como a condificação e decodificação do par para os formatos PEM e DER.
KeyPair::KeyPair | ( | AsymmetricKey::Algorithm | algorithm, |
int | length | ||
) | |||
throw | ( | AsymmetricKeyException | |
) |
create a KeyPair object, creating a new key pair
algorithm | key pair algorithm |
length | key lenght |
AsymmetricKeyException | if the key cannot be created |
KeyPair::KeyPair | ( | Engine * | engine, |
std::string | keyId | ||
) | |||
throw | ( | EngineException | |
) |
KeyPair::KeyPair | ( | std::string | pemEncoded, |
ByteArray | passphrase | ||
) | |||
throw | ( | EncodeException | |
) |
create a KeyPair object, loading the key pair from encoded (PEM format), decrypting with key
pemEncoded | key pair encoded em PEM format |
passphrase | passphrase to decrypt the key pair |
KeyPair::KeyPair | ( | std::string | pemEncoded | ) | |
throw | ( | EncodeException | |||
) |
create a KeyPair object, loading the key pair from encoded (PEM format)
pemEncoded | key pair encoded em PEM format |
KeyPair::KeyPair | ( | ByteArray | derEncoded | ) | |
throw | ( | EncodeException | |||
) |
create a KeyPair object, loading the key pair from encoded (DER format)
derEncoded | key pair encoded em DER format |
KeyPair::KeyPair | ( | const KeyPair & | keyPair | ) |
|
virtual |
|
protected |
|
virtual |
gets algorithm id from the key
Reimplemented in ECDSAKeyPair, DSAKeyPair, and RSAKeyPair.
ByteArray KeyPair::getDerEncoded | ( | ) | ||
throw | ( | EncodeException | ||
) |
encode the key pair in DER format
ENGINE * KeyPair::getEngine | ( | ) | const |
EVP_PKEY * KeyPair::getEvpPkey | ( | ) | const |
std::string KeyPair::getKeyId | ( | ) | const |
std::string KeyPair::getPemEncoded | ( | SymmetricKey & | passphrase, |
SymmetricCipher::OperationMode | mode | ||
) | |||
throw | ( | SymmetricCipherException, | |
EncodeException | |||
) |
encode the key pair in PEM format encrypted
passphrase | key for encrypt the key pair |
mode | cipher operation mode |
std::string KeyPair::getPemEncoded | ( | ) | ||
throw | ( | EncodeException | ||
) |
encode the key pair in PEM format
|
virtual |
gets the private from key pair
Reimplemented in ECDSAKeyPair, DSAKeyPair, and RSAKeyPair.
|
virtual |
gets the public key from key pair
Reimplemented in ECDSAKeyPair, DSAKeyPair, and RSAKeyPair.
|
protected |
int KeyPair::getSize | ( | ) | ||
throw | ( | AsymmetricKeyException | ||
) |
gets the key size
int KeyPair::getSizeBits | ( | ) | ||
throw | ( | AsymmetricKeyException | ||
) |
gets the key size in bits
|
staticprotected |
|
protected |
|
protected |
struct from OpenSSL that represents the key pair
|
protected |