Botan
1.10.9
|
Functions | |
MemoryVector< byte > | BER_encode (const Public_Key &key) |
Public_Key * | copy_key (const Public_Key &key) |
PKCS10_Request | create_cert_req (const X509_Cert_Options &opts, const Private_Key &key, const std::string &hash_fn, RandomNumberGenerator &rng) |
X509_Certificate | create_self_signed_cert (const X509_Cert_Options &opts, const Private_Key &key, const std::string &hash_fn, RandomNumberGenerator &rng) |
void | encode (const Public_Key &key, Pipe &pipe, X509_Encoding encoding=PEM) |
Key_Constraints | find_constraints (const Public_Key &pub_key, Key_Constraints limits) |
Public_Key * | load_key (DataSource &source) |
Public_Key * | load_key (const std::string &fsname) |
Public_Key * | load_key (const MemoryRegion< byte > &mem) |
std::string | PEM_encode (const Public_Key &key) |
This namespace contains functions for handling X.509 public keys
BOTAN_DLL MemoryVector< byte > Botan::X509::BER_encode | ( | const Public_Key & | key | ) |
BER encode a key
key | the public key to encode |
Definition at line 21 of file x509_key.cpp.
References Botan::Public_Key::algorithm_identifier(), Botan::BIT_STRING, Botan::DER_Encoder::encode(), encode(), Botan::SEQUENCE, Botan::DER_Encoder::start_cons(), and Botan::Public_Key::x509_subject_public_key().
Referenced by create_cert_req(), create_self_signed_cert(), encode(), and PEM_encode().
BOTAN_DLL Public_Key * Botan::X509::copy_key | ( | const Public_Key & | key | ) |
Copy a key.
key | the public key to copy |
Definition at line 104 of file x509_key.cpp.
References load_key(), and PEM_encode().
BOTAN_DLL PKCS10_Request Botan::X509::create_cert_req | ( | const X509_Cert_Options & | opts, |
const Private_Key & | key, | ||
const std::string & | hash_fn, | ||
RandomNumberGenerator & | rng | ||
) |
Create a PKCS#10 certificate request.
opts | the options defining the request to create |
key | the key used to sign this request |
rng | the rng to use |
hash_fn | the hash function to use |
Definition at line 91 of file x509self.cpp.
References Botan::Extensions::add(), BER_encode(), Botan::X509_Cert_Options::challenge, Botan::choose_sig_format(), Botan::X509_Cert_Options::constraints, Botan::CRL_SIGN, Botan::DIRECTORY_STRING, Botan::DER_Encoder::encode(), encode(), Botan::DER_Encoder::end_cons(), Botan::DER_Encoder::end_explicit(), Botan::X509_Cert_Options::ex_constraints, find_constraints(), Botan::DER_Encoder::get_contents(), Botan::X509_Cert_Options::is_CA, Botan::KEY_CERT_SIGN, Botan::X509_Object::make_signed(), Botan::X509_Cert_Options::path_limit, Botan::DER_Encoder::raw_bytes(), rng, Botan::X509_Cert_Options::sanity_check(), Botan::SEQUENCE, Botan::DER_Encoder::start_cons(), and Botan::DER_Encoder::start_explicit().
BOTAN_DLL X509_Certificate Botan::X509::create_self_signed_cert | ( | const X509_Cert_Options & | opts, |
const Private_Key & | key, | ||
const std::string & | hash_fn, | ||
RandomNumberGenerator & | rng | ||
) |
Create a self-signed X.509 certificate.
opts | the options defining the certificate to create |
key | the private key used for signing, i.e. the key associated with this self-signed certificate |
hash_fn | the hash function to use |
rng | the rng to use |
Definition at line 45 of file x509self.cpp.
References Botan::Extensions::add(), BER_encode(), Botan::choose_sig_format(), Botan::X509_Cert_Options::constraints, Botan::CRL_SIGN, Botan::X509_Cert_Options::end, Botan::X509_Cert_Options::ex_constraints, find_constraints(), Botan::X509_Cert_Options::is_CA, Botan::KEY_CERT_SIGN, Botan::X509_CA::make_cert(), Botan::X509_Cert_Options::path_limit, rng, Botan::X509_Cert_Options::sanity_check(), and Botan::X509_Cert_Options::start.
|
inline |
Encode a key into a pipe.
key | the public key to encode |
pipe | the pipe to feed the encoded key into |
encoding | the encoding type to use |
Definition at line 87 of file x509_key.h.
References BER_encode(), and PEM_encode().
Referenced by BER_encode(), and create_cert_req().
BOTAN_DLL Key_Constraints Botan::X509::find_constraints | ( | const Public_Key & | pub_key, |
Key_Constraints | limits | ||
) |
Create the key constraints for a specific public key.
pub_key | the public key from which the basic set of constraints to be placed in the return value is derived |
limits | additional limits that will be incorporated into the return value |
Definition at line 113 of file x509_key.cpp.
References Botan::Public_Key::algo_name(), Botan::DATA_ENCIPHERMENT, Botan::DIGITAL_SIGNATURE, Botan::KEY_AGREEMENT, Botan::KEY_ENCIPHERMENT, and Botan::NON_REPUDIATION.
Referenced by create_cert_req(), create_self_signed_cert(), and Botan::X509_CA::sign_request().
BOTAN_DLL Public_Key * Botan::X509::load_key | ( | DataSource & | source | ) |
Create a public key from a data source.
source | the source providing the DER or PEM encoded key |
Definition at line 43 of file x509_key.cpp.
References Botan::BIT_STRING, Botan::BER_Decoder::decode(), Botan::PEM_Code::decode_check_label(), Botan::MemoryRegion< T >::empty(), Botan::BER_Decoder::end_cons(), Botan::make_public_key(), Botan::PEM_Code::matches(), Botan::ASN1::maybe_BER(), Botan::SEQUENCE, Botan::BER_Decoder::start_cons(), and Botan::BER_Decoder::verify_end().
Referenced by copy_key(), load_key(), Botan::PKCS10_Request::subject_public_key(), and Botan::X509_Certificate::subject_public_key().
BOTAN_DLL Public_Key * Botan::X509::load_key | ( | const std::string & | filename | ) |
Create a public key from a file
filename | pathname to the file to load |
Definition at line 86 of file x509_key.cpp.
References load_key().
BOTAN_DLL Public_Key * Botan::X509::load_key | ( | const MemoryRegion< byte > & | enc | ) |
Create a public key from a memory region.
enc | the memory region containing the DER or PEM encoded key |
Definition at line 95 of file x509_key.cpp.
References load_key().
BOTAN_DLL std::string Botan::X509::PEM_encode | ( | const Public_Key & | key | ) |
PEM encode a public key into a string.
key | the key to encode |
Definition at line 34 of file x509_key.cpp.
References BER_encode(), and Botan::PEM_Code::encode().
Referenced by copy_key(), encode(), and Botan::X509_Certificate::to_string().