Botan
1.10.9
|
Functions | |
SecureVector< byte > | BER_encode (const Private_Key &key) |
SecureVector< byte > | BER_encode (const Private_Key &key, RandomNumberGenerator &rng, const std::string &pass, const std::string &pbe_algo) |
Private_Key * | copy_key (const Private_Key &key, RandomNumberGenerator &rng) |
void | encode (const Private_Key &key, Pipe &pipe, X509_Encoding encoding=PEM) |
void | encrypt_key (const Private_Key &key, Pipe &pipe, RandomNumberGenerator &rng, const std::string &pass, const std::string &pbe_algo="", X509_Encoding encoding=PEM) |
Private_Key * | load_key (DataSource &source, RandomNumberGenerator &rng, const User_Interface &ui) |
Private_Key * | load_key (const std::string &fsname, RandomNumberGenerator &rng, const User_Interface &ui) |
Private_Key * | load_key (DataSource &source, RandomNumberGenerator &rng, const std::string &pass) |
Private_Key * | load_key (const std::string &fsname, RandomNumberGenerator &rng, const std::string &pass) |
std::string | PEM_encode (const Private_Key &key) |
std::string | PEM_encode (const Private_Key &key, RandomNumberGenerator &rng, const std::string &pass, const std::string &pbe_algo) |
This namespace contains functions for handling PKCS #8 private keys
BOTAN_DLL SecureVector< byte > Botan::PKCS8::BER_encode | ( | const Private_Key & | key | ) |
BER encode a private key
key | the private key to encode |
Definition at line 134 of file pkcs8.cpp.
References Botan::DER_Encoder::encode(), encode(), Botan::OCTET_STRING, Botan::Private_Key::pkcs8_algorithm_identifier(), Botan::Private_Key::pkcs8_private_key(), Botan::SEQUENCE, and Botan::DER_Encoder::start_cons().
Referenced by BER_encode(), encode(), encrypt_key(), and PEM_encode().
BOTAN_DLL SecureVector< byte > Botan::PKCS8::BER_encode | ( | const Private_Key & | key, |
RandomNumberGenerator & | rng, | ||
const std::string & | pass, | ||
const std::string & | pbe_algo = "" |
||
) |
Encrypt a key using PKCS #8 encryption
key | the key to encode |
rng | the rng to use |
pass | the password to use for encryption |
pbe_algo | the name of the desired password-based encryption algorithm; if empty ("") a reasonable (portable/secure) default will be chosen. |
Definition at line 158 of file pkcs8.cpp.
References BER_encode(), Botan::DER_Encoder::encode(), Botan::DER_Encoder::get_contents(), Botan::get_pbe(), Botan::OCTET_STRING, Botan::Pipe::process_msg(), Botan::SEQUENCE, and Botan::DER_Encoder::start_cons().
BOTAN_DLL Private_Key * Botan::PKCS8::copy_key | ( | const Private_Key & | key, |
RandomNumberGenerator & | rng | ||
) |
Copy an existing encoded key object.
key | the key to copy |
rng | the rng to use |
Definition at line 250 of file pkcs8.cpp.
References load_key(), and PEM_encode().
Referenced by Botan::TLS_Server::TLS_Server().
|
inline |
Encode a private key into a pipe.
key | the private key to encode |
pipe | the pipe to feed the encoded key into |
encoding | the encoding type to use |
Definition at line 85 of file pkcs8.h.
References BER_encode(), and PEM_encode().
Referenced by BER_encode().
|
inline |
Encode and encrypt a private key into a pipe.
key | the private key to encode |
pipe | the pipe to feed the encoded key into |
pass | the password to use for encryption |
rng | the rng to use |
pbe_algo | the name of the desired password-based encryption algorithm; if empty ("") a reasonable (portable/secure) default will be chosen. |
encoding | the encoding type to use |
Definition at line 109 of file pkcs8.h.
References BER_encode(), and PEM_encode().
BOTAN_DLL Private_Key * Botan::PKCS8::load_key | ( | DataSource & | source, |
RandomNumberGenerator & | rng, | ||
const User_Interface & | ui | ||
) |
Load a key from a data source.
source | the data source providing the encoded key |
rng | the rng to use |
ui | the user interface to be used for passphrase dialog |
Definition at line 201 of file pkcs8.cpp.
References Botan::OID::as_string(), Botan::OIDS::lookup(), Botan::make_private_key(), and Botan::AlgorithmIdentifier::oid.
Referenced by copy_key(), and load_key().
BOTAN_DLL Private_Key * Botan::PKCS8::load_key | ( | const std::string & | filename, |
RandomNumberGenerator & | rng, | ||
const User_Interface & | ui | ||
) |
Load a key from a file.
filename | the path to the file containing the encoded key |
rng | the rng to use |
ui | the user interface to be used for passphrase dialog |
Definition at line 219 of file pkcs8.cpp.
References load_key().
BOTAN_DLL Private_Key * Botan::PKCS8::load_key | ( | DataSource & | source, |
RandomNumberGenerator & | rng, | ||
const std::string & | pass = "" |
||
) |
Load a key from a data source.
source | the data source providing the encoded key |
rng | the rng to use |
pass | the passphrase to decrypt the key. Provide an empty string if the key is not encoded. |
Definition at line 230 of file pkcs8.cpp.
References load_key().
BOTAN_DLL Private_Key * Botan::PKCS8::load_key | ( | const std::string & | filename, |
RandomNumberGenerator & | rng, | ||
const std::string & | pass = "" |
||
) |
Load a key from a file.
filename | the path to the file containing the encoded key |
rng | the rng to use |
pass | the passphrase to decrypt the key. Provide an empty string if the key is not encoded. |
Definition at line 240 of file pkcs8.cpp.
References load_key().
BOTAN_DLL std::string Botan::PKCS8::PEM_encode | ( | const Private_Key & | key | ) |
Get a string containing a PEM encoded private key.
key | the key to encode |
Definition at line 150 of file pkcs8.cpp.
References BER_encode(), and Botan::PEM_Code::encode().
Referenced by copy_key(), encode(), encrypt_key(), and PEM_encode().
BOTAN_DLL std::string Botan::PKCS8::PEM_encode | ( | const Private_Key & | key, |
RandomNumberGenerator & | rng, | ||
const std::string & | pass, | ||
const std::string & | pbe_algo = "" |
||
) |
Get a string containing a PEM encoded private key, encrypting it with a password.
key | the key to encode |
rng | the rng to use |
pass | the password to use for encryption |
pbe_algo | the name of the desired password-based encryption algorithm; if empty ("") a reasonable (portable/secure) default will be chosen. |
Definition at line 186 of file pkcs8.cpp.
References BER_encode(), Botan::PEM_Code::encode(), and PEM_encode().