Botan
1.10.9
|
#include <x509cert.h>
Public Member Functions | |
MemoryVector< byte > | authority_key_id () const |
MemoryVector< byte > | BER_encode () const |
bool | check_signature (class Public_Key &key) const |
bool | check_signature (class Public_Key *key) const |
Key_Constraints | constraints () const |
void | encode (Pipe &out, X509_Encoding encoding=PEM) const |
std::string | end_time () const |
std::vector< std::string > | ex_constraints () const |
std::string | hash_used_for_signature () const |
bool | is_CA_cert () const |
bool | is_self_signed () const |
X509_DN | issuer_dn () const |
std::vector< std::string > | issuer_info (const std::string &name) const |
bool | operator== (const X509_Certificate &other) const |
u32bit | path_limit () const |
std::string | PEM_encode () const |
std::vector< std::string > | policies () const |
MemoryVector< byte > | serial_number () const |
MemoryVector< byte > | signature () const |
AlgorithmIdentifier | signature_algorithm () const |
std::string | start_time () const |
X509_DN | subject_dn () const |
std::vector< std::string > | subject_info (const std::string &name) const |
MemoryVector< byte > | subject_key_id () const |
Public_Key * | subject_public_key () const |
MemoryVector< byte > | tbs_data () const |
std::string | to_string () const |
X509_Certificate (DataSource &source) | |
X509_Certificate (const std::string &filename) | |
u32bit | x509_version () const |
Static Public Member Functions | |
static MemoryVector< byte > | make_signed (class PK_Signer *signer, RandomNumberGenerator &rng, const AlgorithmIdentifier &alg_id, const MemoryRegion< byte > &tbs) |
Protected Member Functions | |
void | do_decode () |
Protected Attributes | |
MemoryVector< byte > | sig |
AlgorithmIdentifier | sig_algo |
MemoryVector< byte > | tbs_bits |
Friends | |
class | X509_CA |
This class represents X.509 Certificate
Definition at line 23 of file x509cert.h.
Botan::X509_Certificate::X509_Certificate | ( | DataSource & | source | ) |
Create a certificate from a data source providing the DER or PEM encoded certificate.
source | the data source |
Definition at line 47 of file x509cert.cpp.
References Botan::X509_Object::do_decode().
Botan::X509_Certificate::X509_Certificate | ( | const std::string & | filename | ) |
Create a certificate from a file containing the DER or PEM encoded certificate.
filename | the name of the certificate file |
Definition at line 57 of file x509cert.cpp.
References Botan::X509_Object::do_decode().
MemoryVector< byte > Botan::X509_Certificate::authority_key_id | ( | ) | const |
Get the DER encoded AuthorityKeyIdentifier of this certificate.
Definition at line 250 of file x509cert.cpp.
References Botan::Data_Store::get1_memvec().
Referenced by to_string().
|
inherited |
Definition at line 100 of file x509_obj.cpp.
References Botan::BIT_STRING, Botan::DER_Encoder::encode(), Botan::DER_Encoder::end_cons(), Botan::DER_Encoder::get_contents(), Botan::DER_Encoder::raw_bytes(), Botan::SEQUENCE, Botan::X509_Object::sig, Botan::X509_Object::sig_algo, Botan::DER_Encoder::start_cons(), and Botan::X509_Object::tbs_bits.
Referenced by Botan::X509_Object::encode(), Botan::X509_Object::PEM_encode(), and Botan::CMS_Encoder::sign().
|
inherited |
Check the signature on this data
key | the public key purportedly used to sign this data |
Definition at line 178 of file x509_obj.cpp.
References Botan::Public_Key::algo_name(), Botan::DER_SEQUENCE, Botan::IEEE_1363, Botan::OIDS::lookup(), Botan::Public_Key::message_parts(), Botan::AlgorithmIdentifier::oid, Botan::X509_Object::sig_algo, Botan::X509_Object::signature(), Botan::split_on(), Botan::X509_Object::tbs_data(), and Botan::PK_Verifier::verify_message().
Referenced by Botan::X509_Object::check_signature().
|
inherited |
Check the signature on this data
key | the public key purportedly used to sign this data the pointer will be deleted after use |
Definition at line 169 of file x509_obj.cpp.
References Botan::X509_Object::check_signature().
Key_Constraints Botan::X509_Certificate::constraints | ( | ) | const |
Get the key constraints as defined in the KeyUsage extension of this certificate.
Definition at line 225 of file x509cert.cpp.
References Botan::Data_Store::get1_u32bit(), and Botan::NO_CONSTRAINTS.
Referenced by Botan::CMS_Encoder::encrypt(), is_CA_cert(), and to_string().
|
protectedinherited |
Definition at line 221 of file x509_obj.cpp.
Referenced by Botan::PKCS10_Request::PKCS10_Request(), X509_Certificate(), and Botan::X509_CRL::X509_CRL().
|
inherited |
Encode this to a pipe
out | the pipe to write to |
encoding | the encoding to use |
Definition at line 89 of file x509_obj.cpp.
References Botan::X509_Object::BER_encode(), Botan::PEM, Botan::X509_Object::PEM_encode(), and Botan::Pipe::write().
std::string Botan::X509_Certificate::end_time | ( | ) | const |
Get the notAfter of the certificate.
Definition at line 170 of file x509cert.cpp.
References Botan::Data_Store::get1().
Referenced by to_string(), and Botan::X509_Store::validate_cert().
std::vector< std::string > Botan::X509_Certificate::ex_constraints | ( | ) | const |
Get the key constraints as defined in the ExtendedKeyUsage extension of this certificate.
Definition at line 234 of file x509cert.cpp.
References Botan::Data_Store::get().
Referenced by to_string().
|
inherited |
Definition at line 148 of file x509_obj.cpp.
References Botan::OID::as_string(), Botan::OIDS::lookup(), Botan::AlgorithmIdentifier::oid, Botan::parse_algorithm_name(), Botan::X509_Object::sig_algo, and Botan::split_on().
bool Botan::X509_Certificate::is_CA_cert | ( | ) | const |
Check whether this certificate is a CA certificate.
Definition at line 205 of file x509cert.cpp.
References constraints(), Botan::Data_Store::get1_u32bit(), Botan::KEY_CERT_SIGN, and Botan::NO_CONSTRAINTS.
Referenced by Botan::X509_CA::X509_CA().
|
inline |
Check whether this certificate is self signed.
Definition at line 106 of file x509cert.h.
Referenced by Botan::X509_Store::add_cert().
X509_DN Botan::X509_Certificate::issuer_dn | ( | ) | const |
Get the issuer certificate DN.
Definition at line 274 of file x509cert.cpp.
References Botan::create_dn().
std::vector< std::string > Botan::X509_Certificate::issuer_info | ( | const std::string & | name | ) | const |
Get a value for a specific subject_info parameter name.
name | the name of the paramter to look up. Possible names are "X509.Certificate.v2.key_id" or "X509v3.AuthorityKeyIdentifier". |
Definition at line 188 of file x509cert.cpp.
References Botan::X509_DN::deref_info_field(), and Botan::Data_Store::get().
Referenced by to_string().
|
staticinherited |
Create a signed X509 object.
signer | the signer used to sign the object |
rng | the random number generator to use |
alg_id | the algorithm identifier of the signature scheme |
tbs | the tbs bits to be signed |
Definition at line 204 of file x509_obj.cpp.
References Botan::BIT_STRING, Botan::DER_Encoder::encode(), Botan::DER_Encoder::get_contents(), Botan::DER_Encoder::raw_bytes(), Botan::SEQUENCE, Botan::PK_Signer::sign_message(), and Botan::DER_Encoder::start_cons().
Referenced by Botan::X509::create_cert_req(), and Botan::X509_CA::make_cert().
bool Botan::X509_Certificate::operator== | ( | const X509_Certificate & | other | ) | const |
Check to certificates for equality.
Definition at line 290 of file x509cert.cpp.
References Botan::X509_Object::sig, and Botan::X509_Object::sig_algo.
u32bit Botan::X509_Certificate::path_limit | ( | ) | const |
Get the path limit as defined in the BasicConstraints extension of this certificate.
Definition at line 217 of file x509cert.cpp.
References Botan::Data_Store::get1_u32bit().
|
inherited |
Definition at line 116 of file x509_obj.cpp.
References Botan::X509_Object::BER_encode(), and Botan::PEM_Code::encode().
Referenced by Botan::X509_Object::encode().
std::vector< std::string > Botan::X509_Certificate::policies | ( | ) | const |
Get the policies as defined in the CertificatePolicies extension of this certificate.
Definition at line 242 of file x509cert.cpp.
References Botan::Data_Store::get().
Referenced by to_string().
MemoryVector< byte > Botan::X509_Certificate::serial_number | ( | ) | const |
Get the serial number of this certificate.
Definition at line 266 of file x509cert.cpp.
References Botan::Data_Store::get1_memvec().
Referenced by Botan::CRL_Entry::CRL_Entry(), and to_string().
|
inherited |
Definition at line 132 of file x509_obj.cpp.
References Botan::X509_Object::sig.
Referenced by Botan::X509_Object::check_signature().
|
inherited |
Definition at line 140 of file x509_obj.cpp.
References Botan::X509_Object::sig_algo.
Referenced by to_string().
std::string Botan::X509_Certificate::start_time | ( | ) | const |
Get the notBefore of the certificate.
Definition at line 162 of file x509cert.cpp.
References Botan::Data_Store::get1().
Referenced by to_string(), and Botan::X509_Store::validate_cert().
X509_DN Botan::X509_Certificate::subject_dn | ( | ) | const |
Get the subject certificate DN.
Definition at line 282 of file x509cert.cpp.
References Botan::create_dn().
Referenced by Botan::X509_Store::add_cert(), Botan::X509_Store::add_crl(), and Botan::X509_CA::sign_request().
std::vector< std::string > Botan::X509_Certificate::subject_info | ( | const std::string & | name | ) | const |
Get a value for a specific subject_info parameter name.
name | the name of the paramter to look up. Possible names are "X509.Certificate.version", "X509.Certificate.serial", "X509.Certificate.start", "X509.Certificate.end", "X509.Certificate.v2.key_id", "X509.Certificate.public_key", "X509v3.BasicConstraints.path_constraint", "X509v3.BasicConstraints.is_ca", "X509v3.ExtendedKeyUsage", "X509v3.CertificatePolicies", "X509v3.SubjectKeyIdentifier" or "X509.Certificate.serial". |
Definition at line 179 of file x509cert.cpp.
References Botan::X509_DN::deref_info_field(), and Botan::Data_Store::get().
Referenced by to_string().
MemoryVector< byte > Botan::X509_Certificate::subject_key_id | ( | ) | const |
Get the DER encoded SubjectKeyIdentifier of this certificate.
Definition at line 258 of file x509cert.cpp.
References Botan::Data_Store::get1_memvec().
Referenced by Botan::X509_Store::add_cert(), Botan::X509_Store::add_crl(), Botan::CMS_Encoder::sign(), Botan::X509_CA::sign_request(), and to_string().
Public_Key * Botan::X509_Certificate::subject_public_key | ( | ) | const |
Get the public key associated with this certificate.
Definition at line 196 of file x509cert.cpp.
References Botan::Data_Store::get1(), and Botan::X509::load_key().
Referenced by Botan::X509_Store::add_crl(), Botan::CMS_Encoder::encrypt(), to_string(), Botan::Certificate_Verify::verify(), and Botan::Server_Key_Exchange::verify().
|
inherited |
The underlying data that is to be or was signed
Definition at line 124 of file x509_obj.cpp.
References Botan::ASN1::put_in_sequence(), and Botan::X509_Object::tbs_bits.
Referenced by Botan::X509_Object::check_signature().
std::string Botan::X509_Certificate::to_string | ( | ) | const |
Definition at line 307 of file x509cert.cpp.
References authority_key_id(), constraints(), Botan::CRL_SIGN, Botan::DATA_ENCIPHERMENT, Botan::DIGITAL_SIGNATURE, end_time(), ex_constraints(), Botan::hex_encode(), issuer_info(), Botan::KEY_AGREEMENT, Botan::KEY_CERT_SIGN, Botan::KEY_ENCIPHERMENT, Botan::OIDS::lookup(), Botan::NO_CONSTRAINTS, Botan::NON_REPUDIATION, oid, Botan::X509::PEM_encode(), policies(), serial_number(), Botan::X509_Object::signature_algorithm(), start_time(), subject_info(), subject_key_id(), subject_public_key(), and x509_version().
u32bit Botan::X509_Certificate::x509_version | ( | ) | const |
Get the X509 version of this certificate object.
Definition at line 154 of file x509cert.cpp.
References Botan::Data_Store::get1_u32bit().
Referenced by to_string().
|
friend |
Definition at line 169 of file x509cert.h.
|
protectedinherited |
Definition at line 102 of file x509_obj.h.
Referenced by Botan::X509_Object::BER_encode(), operator==(), and Botan::X509_Object::signature().
|
protectedinherited |
Definition at line 101 of file x509_obj.h.
Referenced by Botan::X509_Object::BER_encode(), Botan::X509_Object::check_signature(), Botan::X509_Object::hash_used_for_signature(), operator==(), and Botan::X509_Object::signature_algorithm().
|
protectedinherited |
Definition at line 102 of file x509_obj.h.
Referenced by Botan::X509_Object::BER_encode(), and Botan::X509_Object::tbs_data().