|
Botan 3.13.0
Crypto and TLS for C&
|
#include <x509cert.h>
Classes | |
| class | Tag |
| class | TagHash |
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 |
| const std::vector< URI > & | ca_issuer_uris () const |
| std::vector< std::string > | ca_issuers () const |
| std::span< const uint8_t, 20 > | certificate_data_sha1 () const |
| std::span< const uint8_t, 32 > | certificate_data_sha256 () 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 |
| const std::vector< URI > & | crl_distribution_point_uris () 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 (const DNSName &name) const |
| bool | matches_dns_name (std::string_view name) const |
| bool | matches_ip (const IPv4Address &address) const |
| bool | matches_ip (const IPv6Address &address) const |
| const NameConstraints & | name_constraints () const |
| const X509_Time & | not_after () const |
| const X509_Time & | not_before () const |
| std::string | ocsp_responder () const |
| const std::vector< URI > & | ocsp_responder_uris () const |
| std::vector< std::string > | ocsp_responders () 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::span< const uint8_t, 20 > | raw_issuer_dn_sha1 () const |
| const std::vector< uint8_t > & | raw_issuer_dn_sha256 () const |
| const std::vector< uint8_t > & | raw_subject_dn () const |
| std::span< const uint8_t, 20 > | raw_subject_dn_sha1 () const |
| const std::vector< uint8_t > & | raw_subject_dn_sha256 () const |
| const X509_Serial_Number & | serial () 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 |
| bool | skip_revocation_check () const |
| const AlternativeName & | subject_alt_name () const |
| const X509_DN & | subject_dn () const |
| std::vector< EmailAddress > | subject_email_addresses () 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 |
| std::span< const uint8_t, 32 > | subject_public_key_bitstring_sha256 () const |
| const std::vector< uint8_t > & | subject_public_key_info () const |
| Tag | tag () 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 uint8_t data[], size_t length) | |
| X509_Certificate (const X509_Certificate &other)=default | |
| X509_Certificate (DataSource &source) | |
| X509_Certificate (std::span< const uint8_t > in) | |
| 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, std::span< const uint8_t > tbs) |
Protected Member Functions | |
| void | load_data (DataSource &src) |
This class represents an X.509 Certificate
TODO(Botan4) mark this final once PKCS11_X509_Certificate is fixed
Definition at line 39 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 96 of file x509cert.cpp.
References Botan::X509_Object::load_data().
Referenced by operator<(), operator=(), operator=(), operator==(), X509_Certificate(), X509_Certificate(), and X509_Certificate().
|
explicit |
Create a certificate from a buffer
| in | the buffer containing the DER-encoded certificate |
Definition at line 100 of file x509cert.cpp.
References Botan::X509_Object::load_data().
|
inline |
Create a certificate from a buffer
| data | the buffer containing the DER-encoded certificate |
| length | length of data in bytes |
Definition at line 551 of file x509cert.h.
References X509_Certificate().
|
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 539 of file x509cert.cpp.
References extended_key_usage(), and has_ex_constraint().
| 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 535 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 528 of file x509cert.cpp.
References constraints(), and Botan::Key_Constraints::includes().
Referenced by allowed_usage(), Botan::PKIX::check_crl(), and Botan::Cert_Extension::OCSP_NoCheck::validate().
| 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 552 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 432 of file x509cert.cpp.
Referenced by botan_x509_cert_view_binary_values(), 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 21 of file asn1_obj.cpp.
References encode_into().
Referenced by decode_from(), Botan::PKCS12::export_to(), 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(), and Botan::PSS_Params::PSS_Params().
| const std::vector< URI > & Botan::X509_Certificate::ca_issuer_uris | ( | ) | const |
Return the listed addresses of ca issuers, or empty if not set
Definition at line 649 of file x509cert.cpp.
Referenced by botan_x509_cert_view_string_values(), and to_string().
| 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 645 of file x509cert.cpp.
Referenced by to_string().
| std::span< const uint8_t, 20 > Botan::X509_Certificate::certificate_data_sha1 | ( | ) | const |
SHA-1 of the entire certificate DER encoding
Definition at line 472 of file x509cert.cpp.
| std::span< const uint8_t, 32 > Botan::X509_Certificate::certificate_data_sha256 | ( | ) | const |
SHA-256 of the entire certificate DER encoding
Definition at line 479 of file x509cert.cpp.
| 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 511 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 125 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 |
| Random Number Generators | the random generator to use |
| hash_fn | is the desired hash function |
| padding_algo | specifies the padding method |
Definition at line 240 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 503 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 661 of file x509cert.cpp.
| const std::vector< URI > & Botan::X509_Certificate::crl_distribution_point_uris | ( | ) | const |
Return the CRL distribution points, or empty if not set
Definition at line 657 of file x509cert.cpp.
Referenced by botan_x509_cert_view_string_values(), and to_string().
| std::vector< std::string > Botan::X509_Certificate::crl_distribution_points | ( | ) | const |
Return the CRL distribution points, or empty if not set
Definition at line 653 of file x509cert.cpp.
|
overridevirtualinherited |
Decode a BER encoded X509_Object See ASN1_Object::decode_from()
Implements Botan::ASN1_Object.
Definition at line 93 of file x509_obj.cpp.
References Botan::BER_Decoder::decode(), Botan::BER_Decoder::decode_octet_aligned_bitstring(), 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 80 of file x509_obj.cpp.
References Botan::DER_Encoder::encode(), Botan::DER_Encoder::encode_octet_aligned_bitstring(), 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 507 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 792 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::Certificate_Store_In_SQL::contains(), 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(), Botan::Certificate_Store_In_SQL::revoke_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 523 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 586 of file x509cert.cpp.
References extended_key_usage(), and Botan::OID::from_name().
| 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 582 of file x509cert.cpp.
References Botan::OID::from_string(), and has_ex_constraint().
Referenced by allowed_extended_usage(), 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 483 of file x509cert.cpp.
Referenced by allowed_usage(), Botan::Flatfile_Certificate_Store::Flatfile_Certificate_Store(), to_string(), 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 613 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 384 of file x509cert.cpp.
Referenced by 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 448 of file x509cert.cpp.
References Botan::X509_Serial_Number::is_negative().
| const AlternativeName & Botan::X509_Certificate::issuer_alt_name | ( | ) | const |
Return the issuer alternative names (DNS, IP, ...)
Definition at line 692 of file x509cert.cpp.
Referenced by botan_x509_cert_issuer_alternative_names(), botan_x509_cert_issuer_alternative_names_count(), issuer_info(), and to_string().
| const X509_DN & Botan::X509_Certificate::issuer_dn | ( | ) | const |
Get the certificate's issuer distinguished name (DN).
Definition at line 456 of file x509cert.cpp.
Referenced by Botan::PKIX::check_chain(), Botan::Certificate_Store_In_Memory::find_crl_for(), Botan::Certificate_Store_In_SQL::find_crl_for(), Botan::Flatfile_Certificate_Store::Flatfile_Certificate_Store(), 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. |
Definition at line 751 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::BER_Decoder::Limits::DER(), 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_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 766 of file x509cert.cpp.
References subject_public_key().
|
staticinherited |
Create a signed X509 object.
| signer | the signer used to sign the object |
| Random Number Generators | 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 156 of file x509_obj.cpp.
References Botan::DER_Encoder::encode(), Botan::DER_Encoder::encode_octet_aligned_bitstring(), 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 | ( | const DNSName & | name | ) | const |
Check whether name matches the subject DNS names in this certificate.
Compares against the dnsName entries in the subjectAltName, with the RFC 6125 wildcard rules. If the certificate has no SAN at all, falls back to a wildcard comparison against the subject CN.
Definition at line 815 of file x509cert.cpp.
References Botan::AlternativeName::dns_names(), Botan::DNSName::from_san_string(), Botan::DNSName::matches_wildcard(), subject_alt_name(), and subject_dn().
| 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
The string variant additionally accepts a dotted-quad IPv4 input, in which case the SAN for IPv4 addresses will be checked. Prefer the typed overloads for IP and DNS matching.
| name | DNS name to match |
Definition at line 852 of file x509cert.cpp.
References Botan::DNSName::from_string(), Botan::IPv4Address::from_string(), Botan::IPv6Address::from_string(), matches_dns_name(), and matches_ip().
Referenced by matches_dns_name().
| bool Botan::X509_Certificate::matches_ip | ( | const IPv4Address & | address | ) | const |
Check whether address appears as an iPAddress entry in the subjectAltName.
Definition at line 844 of file x509cert.cpp.
References Botan::AlternativeName::ipv4_addresses(), and subject_alt_name().
Referenced by matches_dns_name().
| bool Botan::X509_Certificate::matches_ip | ( | const IPv6Address & | address | ) | const |
Check whether address appears as an iPAddress entry in the subjectAltName.
Definition at line 848 of file x509cert.cpp.
References Botan::AlternativeName::ipv6_addresses(), and subject_alt_name().
| const NameConstraints & Botan::X509_Certificate::name_constraints | ( | ) | const |
Get the name constraints as defined in the NameConstraints extension of this certificate.
Definition at line 515 of file x509cert.cpp.
Referenced by botan_x509_cert_excluded_name_constraints(), botan_x509_cert_permitted_name_constraints(), and to_string().
| const X509_Time & Botan::X509_Certificate::not_after | ( | ) | const |
Get the notAfter of the certificate as X509_Time
Definition at line 392 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 388 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 630 of file x509cert.cpp.
Referenced by to_string().
| const std::vector< URI > & Botan::X509_Certificate::ocsp_responder_uris | ( | ) | const |
Return the listed addresses of OCSP responders, or empty if not set
Definition at line 641 of file x509cert.cpp.
Referenced by botan_x509_cert_view_string_values(), and to_string().
| std::vector< std::string > Botan::X509_Certificate::ocsp_responders | ( | ) | const |
Return the listed addresses of OCSP responders, or empty if not set
Definition at line 637 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 880 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 875 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 499 of file x509cert.cpp.
Referenced by Botan::PKIX::check_chain(), and to_string().
| 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 491 of file x509cert.cpp.
|
inherited |
Definition at line 111 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 464 of file x509cert.cpp.
Referenced by botan_x509_cert_view_binary_values().
| std::span< const uint8_t, 20 > Botan::X509_Certificate::raw_issuer_dn_sha1 | ( | ) | const |
SHA-1 of Raw issuer DN
Definition at line 784 of file x509cert.cpp.
Referenced by Botan::OCSP::CertID::is_id_for().
| const std::vector< uint8_t > & Botan::X509_Certificate::raw_issuer_dn_sha256 | ( | ) | const |
SHA-256 of Raw issuer DN
Definition at line 770 of file x509cert.cpp.
Referenced by Botan::OCSP::CertID::is_id_for().
| const std::vector< uint8_t > & Botan::X509_Certificate::raw_subject_dn | ( | ) | const |
Raw subject DN
Definition at line 468 of file x509cert.cpp.
Referenced by botan_x509_cert_view_binary_values(), and Botan::OCSP::CertID::CertID().
| std::span< const uint8_t, 20 > Botan::X509_Certificate::raw_subject_dn_sha1 | ( | ) | const |
SHA-1 of Raw subject DN
Definition at line 788 of file x509cert.cpp.
| const std::vector< uint8_t > & Botan::X509_Certificate::raw_subject_dn_sha256 | ( | ) | const |
SHA-256 of Raw subject DN
Definition at line 777 of file x509cert.cpp.
Referenced by Botan::Flatfile_Certificate_Store::Flatfile_Certificate_Store().
| const X509_Serial_Number & Botan::X509_Certificate::serial | ( | ) | const |
Get the serial number of this certificate
Definition at line 444 of file x509cert.cpp.
Referenced by botan_x509_cert_serial_number(), Botan::PKIX::check_chain(), Botan::OCSP::CertID::is_id_for(), Botan::X509_CRL::is_revoked(), and to_string().
| const std::vector< uint8_t > & Botan::X509_Certificate::serial_number | ( | ) | const |
Get the serial number of this certificate.
Note this is the absolute value; the (rare, non-conforming) negative serial numbers are indistinguishable from their positive counterpart. Prefer serial() which preserves the sign.
Definition at line 440 of file x509cert.cpp.
Referenced by botan_x509_cert_view_binary_values().
|
inherited |
Definition at line 59 of file x509_obj.cpp.
Referenced by encode_into(), make_signed(), Botan::X509_Certificate::operator<(), Botan::X509_Certificate::operator==(), and verify_signature().
|
inherited |
Definition at line 73 of file x509_obj.cpp.
Referenced by Botan::PKIX::check_chain(), encode_into(), Botan::X509_Certificate::operator==(), Botan::X509_Certificate::to_string(), and verify_signature().
|
inherited |
Definition at line 66 of file x509_obj.cpp.
Referenced by encode_into(), Botan::X509_Certificate::operator<(), Botan::X509_Certificate::operator==(), tbs_data(), and verify_signature().
| bool Botan::X509_Certificate::skip_revocation_check | ( | ) | const |
Return true if revocation status checking of this certificate should be skipped, as indicated by the presence of either the noRevAvail extension (RFC 9608) or the ocsp-nocheck extension (RFC 6960).
Definition at line 452 of file x509cert.cpp.
Referenced by Botan::PKIX::check_ocsp(), and to_string().
| const AlternativeName & Botan::X509_Certificate::subject_alt_name | ( | ) | const |
Return the subject alternative names (DNS, IP, ...)
Definition at line 688 of file x509cert.cpp.
Referenced by botan_x509_cert_subject_alternative_names(), botan_x509_cert_subject_alternative_names_count(), Botan::NameConstraints::is_excluded(), Botan::NameConstraints::is_permitted(), Botan::GeneralName::matches(), matches_dns_name(), matches_ip(), matches_ip(), subject_email_addresses(), subject_info(), and to_string().
| const X509_DN & Botan::X509_Certificate::subject_dn | ( | ) | const |
Get the certificate's subject distinguished name (DN).
Definition at line 460 of file x509cert.cpp.
Referenced by Botan::Certificate_Store_In_Memory::add_certificate(), Botan::PKIX::check_chain(), Botan::Certificate_Store::contains(), 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(), matches_dns_name(), Botan::Certificate_Store_In_SQL::remove_cert(), Botan::OCSP::Request::Request(), subject_email_addresses(), subject_info(), and to_string().
| std::vector< EmailAddress > Botan::X509_Certificate::subject_email_addresses | ( | ) | const |
Return all email addresses associated with the subject of this certificate, in parsed form.
This combines RFC 822 names from the subjectAltName extension with email addresses carried in the subject DN's emailAddress attribute (the latter is the legacy location for subject email, see RFC 5280 4.2.1.10). DN attribute values that fail to parse as a mailbox are silently skipped.
Definition at line 669 of file x509cert.cpp.
References Botan::AlternativeName::email_addresses(), Botan::EmailAddress::from_string(), subject_alt_name(), and subject_dn().
| 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. |
Definition at line 744 of file x509cert.cpp.
References subject_alt_name(), and subject_dn().
Referenced by Botan::NameConstraints::is_excluded(), and Botan::NameConstraints::is_permitted().
| const std::vector< uint8_t > & Botan::X509_Certificate::subject_key_id | ( | ) | const |
Get the DER encoded SubjectKeyIdentifier of this certificate.
Definition at line 436 of file x509cert.cpp.
Referenced by botan_x509_cert_view_binary_values(), Botan::X509_CA::choose_extensions(), Botan::Certificate_Store::contains(), 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 758 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 396 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 408 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 416 of file x509cert.cpp.
Referenced by Botan::OCSP::CertID::CertID(), 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 420 of file x509cert.cpp.
Referenced by Botan::Flatfile_Certificate_Store::Flatfile_Certificate_Store(), and Botan::OCSP::CertID::is_id_for().
| std::span< const uint8_t, 32 > Botan::X509_Certificate::subject_public_key_bitstring_sha256 | ( | ) | const |
Get the SHA-256 bit string of the public key associated with this certificate. This is used for OCSP among other protocols.
Definition at line 428 of file x509cert.cpp.
Referenced by Botan::OCSP::CertID::is_id_for().
| const std::vector< uint8_t > & Botan::X509_Certificate::subject_public_key_info | ( | ) | const |
Get the SubjectPublicKeyInfo associated with this certificate.
Definition at line 412 of file x509cert.cpp.
Referenced by botan_x509_cert_view_binary_values(), and subject_public_key().
| X509_Certificate::Tag Botan::X509_Certificate::tag | ( | ) | const |
Return a collision resistant binary "tag" of this certificate
Definition at line 811 of file x509cert.cpp.
Referenced by Botan::Certificate_Store_In_Memory::add_certificate(), Botan::Certificate_Store_In_Memory::contains(), Botan::Flatfile_Certificate_Store::contains(), Botan::Flatfile_Certificate_Store::Flatfile_Certificate_Store(), and Botan::X509_Certificate::TagHash::operator()().
|
inherited |
The underlying data that is to be or was signed
Definition at line 118 of file x509_obj.cpp.
References Botan::ASN1::put_in_sequence(), and signed_body().
| std::string Botan::X509_Certificate::to_string | ( | ) | const |
Definition at line 944 of file x509cert.cpp.
References authority_key_id(), ca_issuer_uris(), ca_issuers(), certificate_policy_oids(), constraints(), crl_distribution_point_uris(), 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_CA_cert(), is_self_signed(), issuer_alt_name(), 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(), ocsp_responder_uris(), ocsp_responders(), Botan::AlgorithmIdentifier::oid(), path_length_constraint(), Botan::X509::PEM_encode(), Botan::NameConstraints::permitted(), Botan::ASN1_Time::readable_string(), serial(), Botan::X509_Object::signature_algorithm(), skip_revocation_check(), subject_alt_name(), subject_dn(), subject_key_id(), subject_public_key(), subject_public_key_algo(), subject_public_key_bitstring(), Botan::OID::to_formatted_string(), Botan::X509_Serial_Number::to_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 400 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 404 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 519 of file x509cert.cpp.
Referenced by botan_x509_cert_issuer_alternative_names(), botan_x509_cert_subject_alternative_names(), Botan::PKIX::check_chain(), Botan::distribution_point_match(), is_critical(), and Botan::Cert_Extension::NoRevocationAvailable::validate().
|
inherited |
Check the signature on this data
| key | the public key purportedly used to sign this data |
Definition at line 130 of file x509_obj.cpp.
References Botan::PK_Verifier::check_signature(), Botan::ASN1::der_sequence_header(), Botan::PK_Verifier::hash_function(), signature(), Botan::SIGNATURE_ALGO_BAD_PARAMS, Botan::SIGNATURE_ALGO_UNKNOWN, signature_algorithm(), Botan::SIGNATURE_ERROR, signed_body(), Botan::PK_Verifier::update(), and Botan::VERIFIED.
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 380 of file x509cert.cpp.
Referenced by Botan::PKIX::check_chain(), and to_string().