|
Botan 3.13.0
Crypto and TLS for C&
|
#include <pkix_types.h>
Classes | |
| class | OtherNameValue |
| An "OtherName" GeneralName entry: type-id OID and the inner ANY value as raw BER. More... | |
Public Member Functions | |
| void | add_attribute (std::string_view type, std::string_view value) |
| void | add_dn (const X509_DN &dn) |
| Add a directory name to this AlternativeName. | |
| void | add_dns (DNSName dns) |
| Add a previously parsed DNS name to this AlternativeName. | |
| void | add_dns (std::string_view dns) |
| Add a DNS name to this AlternativeName, parsing and validating the input. | |
| void | add_email (EmailAddress addr) |
| Add a previously parsed email address to this AlternativeName. | |
| void | add_email (std::string_view addr) |
| Add an email address to this AlternativeName, parsing and validating the input. | |
| void | add_ipv4_address (const IPv4Address &ipv4) |
| Add an IP address to this alternative name. | |
| void | add_ipv4_address (uint32_t ipv4) |
| Add an IP address to this alternative name. | |
| void | add_ipv6_address (const IPv6Address &ipv6) |
| Add an IPv6 address to this alternative name. | |
| void | add_other_name (const OID &oid, const ASN1_String &value) |
| Add an "OtherName" identified by object identifier to this AlternativeName. | |
| void | add_other_name_value (const OID &oid, std::span< const uint8_t > value) |
| void | add_othername (const OID &oid, std::string_view value, ASN1_Type type) |
| void | add_registered_id (const OID &oid) |
| Add a registeredID (RFC 5280 [8]). | |
| void | add_uri (std::string_view uri) |
| Add a URI to this AlternativeName, parsing and validating the input. | |
| void | add_uri (URI uri) |
| Add a previously parsed URI to this AlternativeName. | |
| AlternativeName ()=default | |
| Create an empty name. | |
| BOTAN_FUTURE_EXPLICIT | AlternativeName (std::string_view email_addr, std::string_view uri="", std::string_view dns="", std::string_view ip_address="") |
| std::vector< uint8_t > | BER_encode () const |
| std::multimap< std::string, std::string > | contents () const |
| size_t | count () const |
| void | decode_from (BER_Decoder &from) override |
| const std::set< X509_DN > & | directory_names () const |
| Return the set of directory names included in this alternative name. | |
| X509_DN | dn () const |
| std::set< std::string > | dns () const |
| const std::set< DNSName > & | dns_names () const |
| Return the set of DNS names included in this alternative name. | |
| std::set< std::string > | email () const |
| const std::set< EmailAddress > & | email_addresses () const |
| Return the set of email addresses included in this alternative name. | |
| void | encode_into (DER_Encoder &to) const override |
| std::vector< std::string > | get_attribute (std::string_view attr) const |
| std::multimap< std::string, std::string, std::less<> > | get_attributes () const |
| std::string | get_first_attribute (std::string_view attr) const |
| std::multimap< OID, ASN1_String > | get_othernames () const |
| bool | has_field (std::string_view attr) const |
| bool | has_items () const |
| Return true if this has any names set. | |
| std::set< uint32_t > | ipv4_address () const |
| Return the set of IPv4 addresses included in this alternative name. | |
| const std::set< IPv4Address > & | ipv4_addresses () const |
| Return the set of IPv4 addresses included in this alternative name. | |
| const std::set< IPv6Address > & | ipv6_address () const |
| Return the set of IPv6 addresses included in this alternative name. | |
| const std::set< IPv6Address > & | ipv6_addresses () const |
| Return the set of IPv6 addresses included in this alternative name. | |
| bool | is_empty () const |
| Return true if this alternative name is empty (zero names). | |
| const std::set< OtherNameValue > & | other_name_values () const |
| Return all "OtherName" entries with their inner ANY value as raw BER. | |
| const std::set< std::pair< OID, ASN1_String > > & | other_names () const |
| Return the set of "other names" whose value was a recognized ASN1_String type. | |
| const std::set< OID > & | registered_ids () const |
| Return the set of registeredID OIDs. | |
| const std::set< SmtpUtf8Mailbox > & | smtp_utf8_mailboxes () const |
| const std::set< URI > & | uri_names () const |
| Return the set of URIs included in this alternative name. | |
| std::set< std::string > | uris () const |
Alternative Name
Definition at line 306 of file pkix_types.h.
|
default |
Create an empty name.
References add_dn(), add_dns(), add_email(), add_other_name(), add_other_name_value(), add_registered_id(), add_uri(), dn(), and dns().
Referenced by get_othernames().
| Botan::AlternativeName::AlternativeName | ( | std::string_view | email_addr, |
| std::string_view | uri = "", | ||
| std::string_view | dns = "", | ||
| std::string_view | ip_address = "" ) |
Definition at line 21 of file asn1_alt_name.cpp.
References add_dns(), add_email(), add_ipv4_address(), add_uri(), dns(), Botan::fmt(), and Botan::IPv4Address::from_string().
| void Botan::AlternativeName::add_attribute | ( | std::string_view | type, |
| std::string_view | value ) |
Definition at line 46 of file asn1_alt_name.cpp.
References add_dn(), add_dns(), add_email(), add_ipv4_address(), add_uri(), dn(), Botan::fmt(), Botan::IPv4Address::from_string(), and Botan::X509_DN::parse().
| void Botan::AlternativeName::add_dn | ( | const X509_DN & | dn | ) |
Add a directory name to this AlternativeName.
Definition at line 101 of file alt_name.cpp.
References dn().
Referenced by add_attribute(), AlternativeName(), and decode_from().
| void Botan::AlternativeName::add_dns | ( | DNSName | dns | ) |
Add a previously parsed DNS name to this AlternativeName.
Definition at line 74 of file alt_name.cpp.
References dns().
| void Botan::AlternativeName::add_dns | ( | std::string_view | dns | ) |
Add a DNS name to this AlternativeName, parsing and validating the input.
Definition at line 63 of file alt_name.cpp.
References add_dns(), dns(), and Botan::DNSName::from_san_string().
Referenced by add_attribute(), add_dns(), AlternativeName(), AlternativeName(), and decode_from().
| void Botan::AlternativeName::add_email | ( | EmailAddress | addr | ) |
Add a previously parsed email address to this AlternativeName.
Definition at line 51 of file alt_name.cpp.
| void Botan::AlternativeName::add_email | ( | std::string_view | addr | ) |
Add an email address to this AlternativeName, parsing and validating the input.
Definition at line 40 of file alt_name.cpp.
References add_email(), and Botan::EmailAddress::from_string().
Referenced by add_attribute(), add_email(), AlternativeName(), AlternativeName(), and decode_from().
| void Botan::AlternativeName::add_ipv4_address | ( | const IPv4Address & | ipv4 | ) |
Add an IP address to this alternative name.
Definition at line 105 of file alt_name.cpp.
|
inline |
Add an IP address to this alternative name.
Definition at line 374 of file pkix_types.h.
References add_ipv4_address().
Referenced by add_attribute(), add_ipv4_address(), AlternativeName(), and decode_from().
| void Botan::AlternativeName::add_ipv6_address | ( | const IPv6Address & | ipv6 | ) |
Add an IPv6 address to this alternative name.
Definition at line 109 of file alt_name.cpp.
Referenced by decode_from().
| void Botan::AlternativeName::add_other_name | ( | const OID & | oid, |
| const ASN1_String & | value ) |
Add an "OtherName" identified by object identifier to this AlternativeName.
Definition at line 86 of file alt_name.cpp.
References Botan::DER_Encoder::encode().
Referenced by add_othername(), and AlternativeName().
| void Botan::AlternativeName::add_other_name_value | ( | const OID & | oid, |
| std::span< const uint8_t > | value ) |
Add an "OtherName" with arbitrary inner value, given as raw BER bytes
value must be a complete BER-encoded object (tag + length + content) representing the inner ANY value of the OtherName.
Definition at line 93 of file alt_name.cpp.
Referenced by AlternativeName().
| void Botan::AlternativeName::add_othername | ( | const OID & | oid, |
| std::string_view | value, | ||
| ASN1_Type | type ) |
Definition at line 77 of file asn1_alt_name.cpp.
References add_other_name().
| void Botan::AlternativeName::add_registered_id | ( | const OID & | oid | ) |
Add a registeredID (RFC 5280 [8]).
Definition at line 97 of file alt_name.cpp.
Referenced by AlternativeName(), and decode_from().
| void Botan::AlternativeName::add_uri | ( | std::string_view | uri | ) |
Add a URI to this AlternativeName, parsing and validating the input.
Definition at line 17 of file alt_name.cpp.
References add_uri(), and Botan::URI::from_string().
Referenced by add_attribute(), add_uri(), AlternativeName(), AlternativeName(), and decode_from().
| void Botan::AlternativeName::add_uri | ( | URI | uri | ) |
Add a previously parsed URI to this AlternativeName.
Definition at line 28 of file alt_name.cpp.
|
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().
| std::multimap< std::string, std::string > Botan::AlternativeName::contents | ( | ) | const |
Definition at line 87 of file asn1_alt_name.cpp.
References directory_names(), dns(), email(), ipv4_addresses(), ipv6_addresses(), other_names(), and uris().
Referenced by get_attributes().
| size_t Botan::AlternativeName::count | ( | ) | const |
Return the total number of names in this AlternativeName
This only counts names which were parsed, ignoring names which were of some unknown type
Definition at line 113 of file alt_name.cpp.
References BOTAN_ASSERT_NOMSG, and Botan::checked_add().
Referenced by has_items(), and is_empty().
|
overridevirtual |
Decode whatever this object is from from
| from | the BER_Decoder that will be read from |
Implements Botan::ASN1_Object.
Definition at line 198 of file alt_name.cpp.
References add_dn(), add_dns(), add_email(), add_ipv4_address(), add_ipv6_address(), Botan::DER_Encoder::add_object(), add_registered_id(), add_uri(), Botan::BER_Object::bits(), Botan::BER_Object::class_tag(), Botan::Constructed, Botan::ContextSpecific, Botan::BER_Object::data(), Botan::BER_Decoder::decode(), Botan::BER_Decoder::decode_implicit(), dn(), Botan::ExplicitContextSpecific, Botan::fmt(), Botan::OID::from_string(), Botan::SmtpUtf8Mailbox::from_string(), Botan::BER_Object::get_class(), Botan::BER_Decoder::get_next_object(), Botan::BER_Object::is_a(), Botan::ASN1_String::is_string_type(), Botan::BER_Object::length(), Botan::BER_Decoder::limits(), Botan::load_be(), Botan::BER_Decoder::more_items(), Botan::ObjectId, Botan::BER_Decoder::start_sequence(), Botan::ASN1::to_string(), Botan::BER_Object::type(), Botan::BER_Object::type_tag(), Botan::Universal, Botan::Utf8String, and Botan::BER_Decoder::verify_end().
|
inline |
Return the set of directory names included in this alternative name.
Definition at line 443 of file pkix_types.h.
Referenced by contents(), dn(), get_attribute(), and Botan::GeneralName::matches().
| X509_DN Botan::AlternativeName::dn | ( | ) | const |
This returns all of the alternative name DNs combined into a single DN
This result is not a valid DN. The logic is retained for compatibility, but this function should not be used. It will be removed in Botan4.
Definition at line 173 of file asn1_alt_name.cpp.
References Botan::X509_DN::add_rdn(), directory_names(), and dn().
Referenced by add_attribute(), add_dn(), AlternativeName(), decode_from(), dn(), and get_othernames().
| std::set< std::string > Botan::AlternativeName::dns | ( | ) | const |
Return the set of DNS names included in this alternative name
Deprecated: use dns_names() instead, which exposes the parsed DNSName values. This accessor constructs a copy.
Definition at line 78 of file alt_name.cpp.
Referenced by add_dns(), add_dns(), AlternativeName(), AlternativeName(), contents(), get_attribute(), and get_othernames().
|
inline |
Return the set of DNS names included in this alternative name.
Definition at line 409 of file pkix_types.h.
References dns_names().
Referenced by dns_names(), Botan::GeneralName::matches(), and Botan::X509_Certificate::matches_dns_name().
| std::set< std::string > Botan::AlternativeName::email | ( | ) | const |
Return the set of email addresses included in this alternative name
Deprecated: use email_addresses() instead, which exposes the parsed EmailAddress values. This accessor constructs a copy.
Definition at line 55 of file alt_name.cpp.
Referenced by contents(), and get_attribute().
|
inline |
Return the set of email addresses included in this alternative name.
Definition at line 400 of file pkix_types.h.
References email_addresses().
Referenced by email_addresses(), Botan::GeneralName::matches(), and Botan::X509_Certificate::subject_email_addresses().
|
overridevirtual |
Encode whatever this object is into to
| to | the DER_Encoder that will be written to |
Implements Botan::ASN1_Object.
Definition at line 135 of file alt_name.cpp.
References Botan::DER_Encoder::add_object(), Botan::ContextSpecific, Botan::DER_Encoder::encode(), Botan::DER_Encoder::encode_implicit(), Botan::DER_Encoder::end_cons(), Botan::DER_Encoder::end_explicit(), Botan::ExplicitContextSpecific, Botan::Ia5String, Botan::DER_Encoder::raw_bytes(), Botan::DER_Encoder::start_explicit(), Botan::DER_Encoder::start_sequence(), and Botan::ASN1_String::value().
| std::vector< std::string > Botan::AlternativeName::get_attribute | ( | std::string_view | attr | ) | const |
Definition at line 145 of file asn1_alt_name.cpp.
References directory_names(), dns(), email(), ipv4_addresses(), and uris().
Referenced by get_first_attribute(), and has_field().
| std::multimap< std::string, std::string, std::less<> > Botan::AlternativeName::get_attributes | ( | ) | const |
Definition at line 121 of file asn1_alt_name.cpp.
References contents().
| std::string Botan::AlternativeName::get_first_attribute | ( | std::string_view | attr | ) | const |
Definition at line 135 of file asn1_alt_name.cpp.
References get_attribute().
| std::multimap< OID, ASN1_String > Botan::AlternativeName::get_othernames | ( | ) | const |
References AlternativeName(), BOTAN_DEPRECATED, BOTAN_FUTURE_EXPLICIT, dn(), dns(), and get_othernames().
Referenced by get_othernames().
| bool Botan::AlternativeName::has_field | ( | std::string_view | attr | ) | const |
Definition at line 131 of file asn1_alt_name.cpp.
References get_attribute().
| bool Botan::AlternativeName::has_items | ( | ) | const |
Return true if this has any names set.
Definition at line 127 of file alt_name.cpp.
References count().
| std::set< uint32_t > Botan::AlternativeName::ipv4_address | ( | ) | const |
Return the set of IPv4 addresses included in this alternative name.
Definition at line 188 of file asn1_alt_name.cpp.
|
inline |
Return the set of IPv4 addresses included in this alternative name.
Definition at line 420 of file pkix_types.h.
Referenced by contents(), get_attribute(), Botan::GeneralName::matches(), and Botan::X509_Certificate::matches_ip().
|
inline |
Return the set of IPv6 addresses included in this alternative name.
Definition at line 415 of file pkix_types.h.
References BOTAN_DEPRECATED, ipv6_address(), and ipv6_addresses().
Referenced by ipv6_address().
|
inline |
Return the set of IPv6 addresses included in this alternative name.
Definition at line 423 of file pkix_types.h.
Referenced by contents(), ipv6_address(), Botan::GeneralName::matches(), and Botan::X509_Certificate::matches_ip().
| bool Botan::AlternativeName::is_empty | ( | ) | const |
Return true if this alternative name is empty (zero names).
Definition at line 131 of file alt_name.cpp.
References count().
Referenced by Botan::GeneralName::matches().
|
inline |
Return all "OtherName" entries with their inner ANY value as raw BER.
Definition at line 432 of file pkix_types.h.
|
inline |
Return the set of "other names" whose value was a recognized ASN1_String type.
Definition at line 427 of file pkix_types.h.
References other_names().
Referenced by contents(), and other_names().
|
inline |
Return the set of registeredID OIDs.
Definition at line 440 of file pkix_types.h.
|
inline |
Return the set of SmtpUTF8Mailbox SAN entries (RFC 9598).
Any such values are also included with their raw encoding in other_name_values
Definition at line 437 of file pkix_types.h.
|
inline |
Return the set of URIs included in this alternative name.
Definition at line 391 of file pkix_types.h.
References uri_names().
Referenced by Botan::GeneralName::matches(), and uri_names().
| std::set< std::string > Botan::AlternativeName::uris | ( | ) | const |
Return the set of URIs included in this alternative name
Deprecated: use uri_names() instead, which exposes the parsed URI values. This accessor constructs a copy.
Definition at line 32 of file alt_name.cpp.
Referenced by contents(), and get_attribute().