Botan 3.9.0
Crypto and TLS for C&
|
#include <x509cert.h>
Public Member Functions | |
bool | allowed_extended_usage (const OID &usage) const |
bool | allowed_extended_usage (std::string_view usage) const |
bool | allowed_usage (Key_Constraints usage) const |
bool | allowed_usage (Usage_Type usage) const |
const std::vector< uint8_t > & | authority_key_id () const |
std::vector< uint8_t > | BER_encode () const |
std::vector< std::string > | ca_issuers () const |
const std::vector< OID > & | certificate_policy_oids () const |
bool | check_signature (const Public_Key &key) const |
Key_Constraints | constraints () const |
std::string | crl_distribution_point () const |
std::vector< std::string > | crl_distribution_points () const |
void | decode_from (BER_Decoder &from) override |
void | encode_into (DER_Encoder &to) const override |
const std::vector< OID > & | extended_key_usage () const |
std::string | fingerprint (std::string_view hash_name="SHA-1") const |
bool | has_constraints (Key_Constraints constraints) const |
bool | has_ex_constraint (const OID &ex_constraint) const |
bool | has_ex_constraint (std::string_view ex_constraint) const |
bool | is_CA_cert () const |
bool | is_critical (std::string_view ex_name) const |
bool | is_self_signed () const |
bool | is_serial_negative () const |
const AlternativeName & | issuer_alt_name () const |
const X509_DN & | issuer_dn () const |
std::vector< std::string > | issuer_info (std::string_view name) const |
std::unique_ptr< Public_Key > | load_subject_public_key () const |
bool | matches_dns_name (std::string_view name) const |
const NameConstraints & | name_constraints () const |
const X509_Time & | not_after () const |
const X509_Time & | not_before () const |
std::string | ocsp_responder () const |
bool | operator< (const X509_Certificate &other) const |
X509_Certificate & | operator= (const X509_Certificate &other)=default |
X509_Certificate & | operator= (X509_Certificate &&other)=default |
bool | operator== (const X509_Certificate &other) const |
std::optional< size_t > | path_length_constraint () const |
uint32_t | path_limit () const |
std::string | PEM_encode () const |
const std::vector< uint8_t > & | raw_issuer_dn () const |
std::vector< uint8_t > | raw_issuer_dn_sha256 () const |
const std::vector< uint8_t > & | raw_subject_dn () const |
std::vector< uint8_t > | raw_subject_dn_sha256 () const |
const std::vector< uint8_t > & | serial_number () const |
const std::vector< uint8_t > & | signature () const |
const AlgorithmIdentifier & | signature_algorithm () const |
const std::vector< uint8_t > & | signed_body () const |
const AlternativeName & | subject_alt_name () const |
const X509_DN & | subject_dn () const |
std::vector< std::string > | subject_info (std::string_view name) const |
const std::vector< uint8_t > & | subject_key_id () const |
std::unique_ptr< Public_Key > | subject_public_key () const |
const AlgorithmIdentifier & | subject_public_key_algo () const |
const std::vector< uint8_t > & | subject_public_key_bits () const |
const std::vector< uint8_t > & | subject_public_key_bitstring () const |
const std::vector< uint8_t > & | subject_public_key_bitstring_sha1 () const |
const std::vector< uint8_t > & | subject_public_key_info () const |
std::vector< uint8_t > | tbs_data () const |
std::string | to_string () const |
const std::vector< uint8_t > & | v2_issuer_key_id () const |
const std::vector< uint8_t > & | v2_subject_key_id () const |
const Extensions & | v3_extensions () const |
std::pair< Certificate_Status_Code, std::string > | verify_signature (const Public_Key &key) const |
X509_Certificate ()=default | |
X509_Certificate (const std::vector< uint8_t > &in) | |
X509_Certificate (const uint8_t data[], size_t length) | |
X509_Certificate (const X509_Certificate &other)=default | |
X509_Certificate (DataSource &source) | |
X509_Certificate (X509_Certificate &&other)=default | |
uint32_t | x509_version () const |
~X509_Certificate () override |
Static Public Member Functions | |
static std::unique_ptr< PK_Signer > | choose_sig_format (const Private_Key &key, RandomNumberGenerator &rng, std::string_view hash_fn, std::string_view padding_algo) |
static std::vector< uint8_t > | make_signed (PK_Signer &signer, RandomNumberGenerator &rng, const AlgorithmIdentifier &alg_id, const secure_vector< uint8_t > &tbs) |
Protected Member Functions | |
void | load_data (DataSource &src) |
This class represents an X.509 Certificate
Definition at line 36 of file x509cert.h.
|
explicit |
Create a certificate from a data source providing the DER or PEM encoded certificate.
source | the data source |
Definition at line 81 of file x509cert.cpp.
References Botan::X509_Object::load_data().
Referenced by operator<(), operator=(), operator=(), operator==(), X509_Certificate(), and X509_Certificate().
|
explicit |
Create a certificate from a buffer
in | the buffer containing the DER-encoded certificate |
Definition at line 85 of file x509cert.cpp.
References Botan::X509_Object::load_data().
Botan::X509_Certificate::X509_Certificate | ( | const uint8_t | data[], |
size_t | length ) |
Create a certificate from a buffer
data | the buffer containing the DER-encoded certificate |
length | length of data in bytes |
Definition at line 90 of file x509cert.cpp.
References Botan::X509_Object::load_data().
|
default |
Create an uninitialized certificate object. Any attempts to access this object will throw an exception.
|
default |
References X509_Certificate().
|
default |
References X509_Certificate().
|
overridedefault |
bool Botan::X509_Certificate::allowed_extended_usage | ( | const OID & | usage | ) | const |
Returns true if the specified usage is set in the extended key usage extension, or if no extended key usage constraints are set at all. To check if a certain extended key constraint is set in the certificate use
Definition at line 479 of file x509cert.cpp.
References extended_key_usage().
bool Botan::X509_Certificate::allowed_extended_usage | ( | std::string_view | usage | ) | const |
Returns true if the specified
usage | is set in the extended key usage extension or if no extended key usage constraints are set at all. To check if a certain extended key constraint is set in the certificate use |
Definition at line 475 of file x509cert.cpp.
References allowed_extended_usage(), and Botan::OID::from_string().
Referenced by allowed_extended_usage(), and allowed_usage().
bool Botan::X509_Certificate::allowed_usage | ( | Key_Constraints | usage | ) | const |
Returns true if the specified
usage | is set in the key usage extension or if no key usage constraints are set at all. To check if a certain key constraint is set in the certificate use |
Definition at line 468 of file x509cert.cpp.
References constraints(), and Botan::Key_Constraints::includes().
Referenced by allowed_usage(), and Botan::PKIX::check_crl().
bool Botan::X509_Certificate::allowed_usage | ( | Usage_Type | usage | ) | const |
Returns true if the required key and extended key constraints are set in the certificate for the specified
usage | or if no key constraints are set in both the key usage and extended key usage extension. |
Definition at line 492 of file x509cert.cpp.
References allowed_extended_usage(), allowed_usage(), Botan::CERTIFICATE_AUTHORITY, Botan::Key_Constraints::DataEncipherment, Botan::Key_Constraints::DigitalSignature, Botan::ENCRYPTION, has_ex_constraint(), is_CA_cert(), Botan::Key_Constraints::KeyAgreement, Botan::Key_Constraints::KeyEncipherment, Botan::Key_Constraints::NonRepudiation, Botan::OCSP_RESPONDER, Botan::TLS_CLIENT_AUTH, Botan::TLS_SERVER_AUTH, and Botan::UNSPECIFIED.
const std::vector< uint8_t > & Botan::X509_Certificate::authority_key_id | ( | ) | const |
Get the DER encoded AuthorityKeyIdentifier of this certificate.
Definition at line 391 of file x509cert.cpp.
Referenced by Botan::PKIX::build_certificate_path(), Botan::Certificate_Store_In_Memory::find_crl_for(), Botan::X509_CRL::is_revoked(), and to_string().
|
inherited |
Return the encoding of this object. This is a convenience method when just one object needs to be serialized. Use DER_Encoder for complicated encodings.
Definition at line 19 of file asn1_obj.cpp.
References encode_into().
Referenced by decode_from(), Botan::Certificate_Store_In_SQL::find_all_certs(), Botan::Certificate_Store_In_SQL::find_cert(), Botan::X509_Certificate::fingerprint(), Botan::Certificate_Store_In_SQL::insert_cert(), Botan::X509_Object::PEM_encode(), Botan::PSS_Params::PSS_Params(), and Botan::Certificate_Store_In_SQL::revoke_cert().
std::vector< std::string > Botan::X509_Certificate::ca_issuers | ( | ) | const |
Return the listed addresses of ca issuers, or empty if not set
Definition at line 542 of file x509cert.cpp.
Referenced by to_string().
const std::vector< OID > & Botan::X509_Certificate::certificate_policy_oids | ( | ) | const |
Get the policies as defined in the CertificatePolicies extension of this certificate.
Definition at line 451 of file x509cert.cpp.
Referenced by to_string().
|
inherited |
Check the signature on this data
key | the public key purportedly used to sign this data |
Definition at line 97 of file x509_obj.cpp.
References Botan::VERIFIED, and verify_signature().
|
staticinherited |
Choose and return a signature scheme appropriate for X.509 signing using the provided parameters.
key | will be the key to choose a padding scheme for |
rng | the random generator to use |
hash_fn | is the desired hash function |
padding_algo | specifies the padding method |
Definition at line 209 of file x509_obj.cpp.
References Botan::Asymmetric_Key::_default_x509_signature_format(), and Botan::Asymmetric_Key::algo_name().
Referenced by Botan::PKCS10_Request::create(), Botan::X509::create_self_signed_cert(), and Botan::X509_CA::X509_CA().
Key_Constraints Botan::X509_Certificate::constraints | ( | ) | const |
Get the key constraints as defined in the KeyUsage extension of this certificate.
Definition at line 443 of file x509cert.cpp.
Referenced by allowed_usage(), has_constraints(), and to_string().
std::string Botan::X509_Certificate::crl_distribution_point | ( | ) | const |
Return the CRL distribution point, or empty if not set
Definition at line 550 of file x509cert.cpp.
std::vector< std::string > Botan::X509_Certificate::crl_distribution_points | ( | ) | const |
Return the CRL distribution points, or empty if not set
Definition at line 546 of file x509cert.cpp.
Referenced by Botan::PKIX::check_crl(), and to_string().
|
overridevirtualinherited |
Decode a BER encoded X509_Object See ASN1_Object::decode_from()
Implements Botan::ASN1_Object.
Definition at line 68 of file x509_obj.cpp.
References Botan::BitString, Botan::BER_Decoder::decode(), Botan::BER_Decoder::end_cons(), Botan::BER_Decoder::raw_bytes(), and Botan::BER_Decoder::start_sequence().
Referenced by load_data().
|
overridevirtualinherited |
DER encode an X509_Object See ASN1_Object::encode_into()
Implements Botan::ASN1_Object.
Definition at line 55 of file x509_obj.cpp.
References Botan::BitString, Botan::DER_Encoder::encode(), Botan::DER_Encoder::end_cons(), Botan::DER_Encoder::raw_bytes(), signature(), signature_algorithm(), signed_body(), and Botan::DER_Encoder::start_sequence().
const std::vector< OID > & Botan::X509_Certificate::extended_key_usage | ( | ) | const |
Get the key usage as defined in the ExtendedKeyUsage extension of this certificate, or else an empty vector.
Definition at line 447 of file x509cert.cpp.
Referenced by allowed_extended_usage(), has_ex_constraint(), and to_string().
std::string Botan::X509_Certificate::fingerprint | ( | std::string_view | hash_name = "SHA-1" | ) | const |
hash_name | hash function used to calculate the fingerprint |
Definition at line 635 of file x509cert.cpp.
References Botan::ASN1_Object::BER_encode(), and Botan::create_hex_fingerprint().
Referenced by Botan::Certificate_Store_In_SQL::affirm_cert(), Botan::PKIX::build_certificate_path(), Botan::Certificate_Store_In_SQL::find_key(), Botan::Certificate_Store_In_SQL::insert_cert(), Botan::Certificate_Store_In_SQL::insert_key(), Botan::Certificate_Store_In_SQL::remove_cert(), and Botan::Certificate_Store_In_SQL::revoke_cert().
bool Botan::X509_Certificate::has_constraints | ( | Key_Constraints | constraints | ) | const |
Returns true if and only if the specified
constraints | are included in the key usage extension. |
Typically for applications you want allowed_usage instead.
Definition at line 463 of file x509cert.cpp.
References constraints(), and Botan::Key_Constraints::includes().
bool Botan::X509_Certificate::has_ex_constraint | ( | const OID & | ex_constraint | ) | const |
Returns true if and only if OID
ex_constraint | is included in the extended key extension. |
Definition at line 526 of file x509cert.cpp.
References extended_key_usage().
bool Botan::X509_Certificate::has_ex_constraint | ( | std::string_view | ex_constraint | ) | const |
Returns true if and only if OID
ex_constraint | is included in the extended key extension. |
Definition at line 522 of file x509cert.cpp.
References Botan::OID::from_string(), and has_ex_constraint().
Referenced by allowed_usage(), and has_ex_constraint().
bool Botan::X509_Certificate::is_CA_cert | ( | ) | const |
Check whether this certificate is a CA certificate.
Definition at line 423 of file x509cert.cpp.
Referenced by allowed_usage(), Botan::PKIX::check_chain(), Botan::Flatfile_Certificate_Store::Flatfile_Certificate_Store(), and Botan::Cert_Extension::Name_Constraints::validate().
bool Botan::X509_Certificate::is_critical | ( | std::string_view | ex_name | ) | const |
Check whenever a given X509 Extension is marked critical in this certificate.
Definition at line 534 of file x509cert.cpp.
References Botan::Extensions::critical_extension_set(), Botan::OID::from_string(), and v3_extensions().
Referenced by Botan::Cert_Extension::Name_Constraints::validate().
bool Botan::X509_Certificate::is_self_signed | ( | ) | const |
Check whether this certificate is self signed. If the DN issuer and subject agree,
Definition at line 347 of file x509cert.cpp.
Referenced by Botan::PKIX::build_certificate_path(), Botan::PKIX::check_chain(), Botan::Flatfile_Certificate_Store::Flatfile_Certificate_Store(), and to_string().
bool Botan::X509_Certificate::is_serial_negative | ( | ) | const |
Get the serial number's sign
Definition at line 403 of file x509cert.cpp.
Referenced by Botan::PKIX::check_chain().
const AlternativeName & Botan::X509_Certificate::issuer_alt_name | ( | ) | const |
Return the issuer alternative names (DNS, IP, ...)
Definition at line 562 of file x509cert.cpp.
Referenced by issuer_info().
const X509_DN & Botan::X509_Certificate::issuer_dn | ( | ) | const |
Get the certificate's issuer distinguished name (DN).
Definition at line 407 of file x509cert.cpp.
Referenced by Botan::PKIX::build_certificate_path(), Botan::PKIX::check_chain(), Botan::Certificate_Store_In_Memory::find_crl_for(), Botan::Certificate_Store_In_SQL::find_crl_for(), Botan::X509_CRL::is_revoked(), issuer_info(), Botan::OCSP::Request::Request(), and to_string().
std::vector< std::string > Botan::X509_Certificate::issuer_info | ( | std::string_view | name | ) | const |
Get a value for a specific subject_info parameter name.
name | the name of the parameter to look up. Possible names are "X509.Certificate.v2.key_id" or "X509v3.AuthorityKeyIdentifier". |
Definition at line 602 of file x509cert.cpp.
References issuer_alt_name(), and issuer_dn().
|
protectedinherited |
Decodes from src as either DER or PEM data, then calls force_decode()
Definition at line 24 of file x509_obj.cpp.
References alternate_PEM_labels(), Botan::PEM_Code::decode(), decode_from(), Botan::PEM_Code::matches(), Botan::ASN1::maybe_BER(), and PEM_label().
Referenced by Botan::PKCS10_Request::PKCS10_Request(), Botan::PKCS10_Request::PKCS10_Request(), Botan::X509_Certificate::X509_Certificate(), Botan::X509_Certificate::X509_Certificate(), Botan::X509_Certificate::X509_Certificate(), Botan::X509_CRL::X509_CRL(), Botan::X509_CRL::X509_CRL(), and X509_Object().
std::unique_ptr< Public_Key > Botan::X509_Certificate::load_subject_public_key | ( | ) | const |
Create a public key object associated with the public key bits in this certificate. If the public key bits was valid for X.509 encoding purposes but invalid algorithmically (for example, RSA with an even modulus) that will be detected at this point, and an exception will be thrown.
Definition at line 617 of file x509cert.cpp.
References subject_public_key().
|
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 125 of file x509_obj.cpp.
References Botan::BitString, Botan::DER_Encoder::encode(), Botan::DER_Encoder::end_cons(), Botan::DER_Encoder::raw_bytes(), Botan::PK_Signer::sign_message(), signature(), and Botan::DER_Encoder::start_sequence().
Referenced by Botan::PKCS10_Request::create(), and Botan::X509_CA::make_cert().
bool Botan::X509_Certificate::matches_dns_name | ( | std::string_view | name | ) | const |
Check if a certain DNS name matches up with the information in the cert
name | DNS name to match |
Note: this will also accept a dotted quad input, in which case the SAN for IPv4 addresses will be checked.
Definition at line 654 of file x509cert.cpp.
References Botan::host_wildcard_match(), Botan::AlternativeName::ipv4_address(), Botan::string_to_ipv4(), subject_alt_name(), and subject_info().
const NameConstraints & Botan::X509_Certificate::name_constraints | ( | ) | const |
Get the name constraints as defined in the NameConstraints extension of this certificate.
Definition at line 455 of file x509cert.cpp.
Referenced by to_string().
const X509_Time & Botan::X509_Certificate::not_after | ( | ) | const |
Get the notAfter of the certificate as X509_Time
Definition at line 355 of file x509cert.cpp.
Referenced by Botan::PKIX::check_chain(), and to_string().
const X509_Time & Botan::X509_Certificate::not_before | ( | ) | const |
Get the notBefore of the certificate as X509_Time
Definition at line 351 of file x509cert.cpp.
Referenced by Botan::PKIX::check_chain(), and to_string().
std::string Botan::X509_Certificate::ocsp_responder | ( | ) | const |
Return the listed address of an OCSP responder, or empty if not set
Definition at line 538 of file x509cert.cpp.
Referenced by to_string().
bool Botan::X509_Certificate::operator< | ( | const X509_Certificate & | other | ) | const |
Impose an arbitrary (but consistent) ordering, eg to allow sorting a container of certificate objects.
Definition at line 688 of file x509cert.cpp.
References Botan::X509_Object::signature(), Botan::X509_Object::signed_body(), and X509_Certificate().
|
default |
References X509_Certificate().
|
default |
References X509_Certificate().
bool Botan::X509_Certificate::operator== | ( | const X509_Certificate & | other | ) | const |
Check to certificates for equality.
Definition at line 683 of file x509cert.cpp.
References Botan::X509_Object::signature(), Botan::X509_Object::signature_algorithm(), Botan::X509_Object::signed_body(), and X509_Certificate().
std::optional< size_t > Botan::X509_Certificate::path_length_constraint | ( | ) | const |
Get the path length constraint as defined in the BasicConstraints extension.
Returns nullopt if either the extension is not set in the certificate, or if the pathLenConstraint field was absent from the extension.
Definition at line 439 of file x509cert.cpp.
Referenced by Botan::PKIX::check_chain().
uint32_t Botan::X509_Certificate::path_limit | ( | ) | const |
Get the path length constraint as defined in the BasicConstraints extension.
This returns an arbitrary value if the extension is not set (either 32 for v1 self-signed certificates, or else Cert_Extension::NO_CERT_PATH_LIMIT for v3 certificates without the extension)
Prefer path_length_constraint
Definition at line 431 of file x509cert.cpp.
|
inherited |
Definition at line 83 of file x509_obj.cpp.
References Botan::ASN1_Object::BER_encode(), Botan::PEM_Code::encode(), and PEM_label().
const std::vector< uint8_t > & Botan::X509_Certificate::raw_issuer_dn | ( | ) | const |
Raw issuer DN bits
Definition at line 415 of file x509cert.cpp.
Referenced by Botan::OCSP::CertID::is_id_for().
std::vector< uint8_t > Botan::X509_Certificate::raw_issuer_dn_sha256 | ( | ) | const |
SHA-256 of Raw issuer DN
Definition at line 621 of file x509cert.cpp.
const std::vector< uint8_t > & Botan::X509_Certificate::raw_subject_dn | ( | ) | const |
Raw subject DN
Definition at line 419 of file x509cert.cpp.
Referenced by Botan::OCSP::CertID::CertID().
std::vector< uint8_t > Botan::X509_Certificate::raw_subject_dn_sha256 | ( | ) | const |
SHA-256 of Raw subject DN
Definition at line 628 of file x509cert.cpp.
Referenced by Botan::Flatfile_Certificate_Store::Flatfile_Certificate_Store().
const std::vector< uint8_t > & Botan::X509_Certificate::serial_number | ( | ) | const |
Get the serial number of this certificate.
Definition at line 399 of file x509cert.cpp.
Referenced by Botan::CRL_Entry::CRL_Entry(), Botan::OCSP::CertID::is_id_for(), Botan::X509_CRL::is_revoked(), and to_string().
|
inlineinherited |
Definition at line 40 of file x509_obj.h.
Referenced by encode_into(), make_signed(), Botan::X509_Certificate::operator<(), Botan::X509_Certificate::operator==(), and verify_signature().
|
inlineinherited |
Definition at line 50 of file x509_obj.h.
Referenced by Botan::PKIX::check_chain(), encode_into(), Botan::X509_Certificate::operator==(), Botan::X509_Certificate::to_string(), and verify_signature().
|
inlineinherited |
Definition at line 45 of file x509_obj.h.
Referenced by encode_into(), Botan::X509_Certificate::operator<(), and Botan::X509_Certificate::operator==().
const AlternativeName & Botan::X509_Certificate::subject_alt_name | ( | ) | const |
Return the subject alternative names (DNS, IP, ...)
Definition at line 558 of file x509cert.cpp.
Referenced by Botan::NameConstraints::is_excluded(), Botan::NameConstraints::is_permitted(), Botan::GeneralName::matches(), matches_dns_name(), and subject_info().
const X509_DN & Botan::X509_Certificate::subject_dn | ( | ) | const |
Get the certificate's subject distinguished name (DN).
Definition at line 411 of file x509cert.cpp.
Referenced by Botan::Certificate_Store::certificate_known(), Botan::PKIX::check_chain(), Botan::Flatfile_Certificate_Store::Flatfile_Certificate_Store(), Botan::Certificate_Store_In_SQL::insert_cert(), Botan::NameConstraints::is_excluded(), Botan::NameConstraints::is_permitted(), Botan::GeneralName::matches(), Botan::Certificate_Store_In_SQL::remove_cert(), Botan::OCSP::Request::Request(), subject_info(), and to_string().
std::vector< std::string > Botan::X509_Certificate::subject_info | ( | std::string_view | name | ) | const |
Get a value for a specific subject_info parameter name.
name | the name of the parameter to look up. Possible names include "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.NameConstraints", "X509v3.ExtendedKeyUsage", "X509v3.CertificatePolicies", "X509v3.SubjectKeyIdentifier", "X509.Certificate.serial", "X520.CommonName", "X520.Organization", "X520.Country", "RFC822" (Email in SAN) or "PKCS9.EmailAddress" (Email in DN). |
Definition at line 595 of file x509cert.cpp.
References subject_alt_name(), and subject_dn().
Referenced by Botan::NameConstraints::is_excluded(), Botan::NameConstraints::is_permitted(), and matches_dns_name().
const std::vector< uint8_t > & Botan::X509_Certificate::subject_key_id | ( | ) | const |
Get the DER encoded SubjectKeyIdentifier of this certificate.
Definition at line 395 of file x509cert.cpp.
Referenced by Botan::Certificate_Store::certificate_known(), Botan::Certificate_Store_In_SQL::insert_cert(), Botan::Certificate_Store_In_SQL::remove_cert(), and to_string().
std::unique_ptr< Public_Key > Botan::X509_Certificate::subject_public_key | ( | ) | const |
Create a public key object associated with the public key bits in this certificate. If the public key bits was valid for X.509 encoding purposes but invalid algorithmically (for example, RSA with an even modulus) that will be detected at this point, and an exception will be thrown.
Definition at line 609 of file x509cert.cpp.
References Botan::X509::load_key(), and subject_public_key_info().
Referenced by Botan::PKIX::check_chain(), Botan::PKIX::check_crl(), load_subject_public_key(), to_string(), Botan::TLS::Certificate_Verify_12::verify(), and Botan::OCSP::Response::verify_signature().
const AlgorithmIdentifier & Botan::X509_Certificate::subject_public_key_algo | ( | ) | const |
Return the algorithm identifier of the public key
Definition at line 359 of file x509cert.cpp.
Referenced by to_string().
const std::vector< uint8_t > & Botan::X509_Certificate::subject_public_key_bits | ( | ) | const |
Get the public key associated with this certificate. This includes the outer AlgorithmIdentifier
Definition at line 371 of file x509cert.cpp.
const std::vector< uint8_t > & Botan::X509_Certificate::subject_public_key_bitstring | ( | ) | const |
Get the bit string of the public key associated with this certificate
Definition at line 379 of file x509cert.cpp.
Referenced by Botan::OCSP::CertID::CertID(), Botan::OCSP::CertID::is_id_for(), and to_string().
const std::vector< uint8_t > & Botan::X509_Certificate::subject_public_key_bitstring_sha1 | ( | ) | const |
Get the SHA-1 bit string of the public key associated with this certificate. This is used for OCSP among other protocols. This function will throw if SHA-1 is not available.
Definition at line 383 of file x509cert.cpp.
Referenced by Botan::Flatfile_Certificate_Store::Flatfile_Certificate_Store().
const std::vector< uint8_t > & Botan::X509_Certificate::subject_public_key_info | ( | ) | const |
Get the SubjectPublicKeyInfo associated with this certificate.
Definition at line 375 of file x509cert.cpp.
Referenced by subject_public_key().
|
inherited |
The underlying data that is to be or was signed
Definition at line 90 of file x509_obj.cpp.
References Botan::ASN1::put_in_sequence().
Referenced by verify_signature().
std::string Botan::X509_Certificate::to_string | ( | ) | const |
Definition at line 705 of file x509cert.cpp.
References authority_key_id(), ca_issuers(), certificate_policy_oids(), constraints(), crl_distribution_points(), Botan::Key_Constraints::CrlSign, Botan::Key_Constraints::DataEncipherment, Botan::Key_Constraints::DecipherOnly, Botan::Key_Constraints::DigitalSignature, Botan::Key_Constraints::empty(), Botan::Key_Constraints::EncipherOnly, extended_key_usage(), Botan::hex_encode(), is_self_signed(), issuer_dn(), Botan::Key_Constraints::KeyAgreement, Botan::Key_Constraints::KeyCertSign, Botan::Key_Constraints::KeyEncipherment, name_constraints(), Botan::Key_Constraints::NonRepudiation, not_after(), not_before(), ocsp_responder(), Botan::AlgorithmIdentifier::oid(), Botan::X509::PEM_encode(), Botan::NameConstraints::permitted(), Botan::ASN1_Time::readable_string(), serial_number(), Botan::X509_Object::signature_algorithm(), subject_dn(), subject_key_id(), subject_public_key(), subject_public_key_algo(), subject_public_key_bitstring(), Botan::OID::to_formatted_string(), Botan::Exception::what(), and x509_version().
const std::vector< uint8_t > & Botan::X509_Certificate::v2_issuer_key_id | ( | ) | const |
Return the v2 issuer key ID. v2 key IDs are almost never used, instead see v3_subject_key_id.
Definition at line 363 of file x509cert.cpp.
Referenced by Botan::PKIX::check_chain().
const std::vector< uint8_t > & Botan::X509_Certificate::v2_subject_key_id | ( | ) | const |
Return the v2 subject key ID. v2 key IDs are almost never used, instead see v3_subject_key_id.
Definition at line 367 of file x509cert.cpp.
Referenced by Botan::PKIX::check_chain().
const Extensions & Botan::X509_Certificate::v3_extensions | ( | ) | const |
Get all extensions of this certificate.
Definition at line 459 of file x509cert.cpp.
Referenced by Botan::PKIX::check_chain(), and is_critical().
|
inherited |
Check the signature on this data
key | the public key purportedly used to sign this data |
Definition at line 102 of file x509_obj.cpp.
References Botan::PK_Verifier::hash_function(), signature(), Botan::SIGNATURE_ALGO_BAD_PARAMS, Botan::SIGNATURE_ALGO_UNKNOWN, signature_algorithm(), Botan::SIGNATURE_ERROR, tbs_data(), Botan::VERIFIED, and Botan::PK_Verifier::verify_message().
Referenced by Botan::PKIX::check_chain(), and check_signature().
uint32_t Botan::X509_Certificate::x509_version | ( | ) | const |
Get the X509 version of this certificate object.
Definition at line 343 of file x509cert.cpp.
Referenced by Botan::PKIX::check_chain(), and to_string().