|
Botan 3.13.0
Crypto and TLS for C&
|
X.509 GeneralName Type. More...
#include <pkix_types.h>
Public Types | |
| enum | MatchResult : uint8_t { All , Some , None , NotFound , UnknownType } |
| enum class | NameType : uint8_t { Unknown = 0 , RFC822 = 1 , DNS = 2 , URI = 3 , DN = 4 , IPv4 = 5 , IPv6 = 6 , Other = 7 } |
Public Member Functions | |
| std::vector< uint8_t > | BER_encode () const |
| std::vector< uint8_t > | binary_name () const |
| void | decode_from (BER_Decoder &from) override |
| void | encode_into (DER_Encoder &to) const override |
| GeneralName ()=default | |
| MatchResult | matches (const X509_Certificate &cert) const |
| bool | matches_dn (const X509_DN &dn) const |
| bool | matches_dns (const DNSName &dns_name) const |
| bool | matches_dns (const std::string &dns_name) const |
| bool | matches_email (const EmailAddress &addr) const |
| bool | matches_email (const SmtpUtf8Mailbox &mailbox) const |
| bool | matches_ipv4 (const IPv4Address &ip) const |
| bool | matches_ipv4 (uint32_t ip) const |
| bool | matches_ipv6 (const IPv6Address &ip) const |
| bool | matches_uri (const URI &uri) const |
| std::string | name () const |
| std::string | type () const |
| NameType | type_code () const |
Static Public Member Functions | |
| static GeneralName | _dns_san_value (std::string_view dns) |
| static GeneralName | _uri_san_value (std::string_view full_uri) |
| static GeneralName | directory_name (Botan::X509_DN dn) |
| static GeneralName | dns (std::string_view dns) |
| static GeneralName | email (std::string_view email) |
| static GeneralName | ipv4_address (const IPv4Subnet &subnet) |
| static GeneralName | ipv4_address (IPv4Address ipv4) |
| static GeneralName | ipv4_address (uint32_t ipv4) |
| static GeneralName | ipv4_address (uint32_t ipv4, uint32_t mask) |
| static GeneralName | ipv6_address (const IPv6Address &ipv6) |
| static GeneralName | ipv6_address (const IPv6Subnet &subnet) |
| static GeneralName | uri (std::string_view uri) |
Friends | |
| class | NameConstraints |
X.509 GeneralName Type.
Handles parsing GeneralName types in their BER and canonical string encoding. Allows matching GeneralNames against each other using the rules laid out in the RFC 5280, sec. 4.2.1.10 (Name Constraints).
This entire class is deprecated and will be removed in a future major release
Definition at line 543 of file pkix_types.h.
| enum Botan::GeneralName::MatchResult : uint8_t |
| Enumerator | |
|---|---|
| All | |
| Some | |
| None | |
| NotFound | |
| UnknownType | |
Definition at line 545 of file pkix_types.h.
|
strong |
| Enumerator | |
|---|---|
| Unknown | |
| RFC822 | |
| DNS | |
| URI | |
| DN | |
| IPv4 | |
| IPv6 | |
| Other | |
Definition at line 553 of file pkix_types.h.
|
default |
References _dns_san_value(), _uri_san_value(), decode_from(), directory_name(), dns(), email(), encode_into(), GeneralName(), ipv4_address(), ipv6_address(), and uri().
Referenced by _dns_san_value(), _uri_san_value(), directory_name(), dns(), email(), GeneralName(), ipv4_address(), ipv4_address(), ipv4_address(), ipv4_address(), ipv6_address(), ipv6_address(), and uri().
|
static |
Wrap a DNS SAN in a GeneralName, this is used for ffi
Definition at line 345 of file name_constraint.cpp.
References DNS, dns(), Botan::fmt(), and GeneralName().
Referenced by GeneralName().
|
static |
Wrap a URI SAN in a GeneralName, this is used for ffi
Definition at line 337 of file name_constraint.cpp.
References Botan::fmt(), GeneralName(), URI, and uri().
Referenced by GeneralName().
|
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::vector< uint8_t > Botan::GeneralName::binary_name | ( | ) | const |
Definition at line 398 of file name_constraint.cpp.
References Botan::ASN1::put_in_sequence().
Referenced by botan_x509_general_name_view_binary_value().
|
overridevirtual |
Decode whatever this object is from from
| from | the BER_Decoder that will be read from |
Implements Botan::ASN1_Object.
Definition at line 468 of file name_constraint.cpp.
References Botan::BER_Object::bits(), Botan::Constructed, Botan::ContextSpecific, Botan::X509_DN::decode_from(), DN, DNS, Botan::ExplicitContextSpecific, Botan::IPv4Subnet::from_address_and_mask(), Botan::IPv6Subnet::from_address_and_mask(), Botan::BER_Decoder::get_next_object(), IPv4, IPv6, Botan::BER_Object::is_a(), Botan::BER_Object::length(), Botan::BER_Decoder::limits(), Other, RFC822, Botan::ASN1::to_string(), Unknown, URI, and Botan::BER_Decoder::verify_end().
Referenced by GeneralName().
|
static |
Definition at line 353 of file name_constraint.cpp.
References DN, and GeneralName().
Referenced by GeneralName().
|
static |
Definition at line 321 of file name_constraint.cpp.
References DNS, dns(), Botan::fmt(), and GeneralName().
Referenced by _dns_san_value(), dns(), GeneralName(), and matches().
|
static |
Definition at line 313 of file name_constraint.cpp.
References email(), Botan::fmt(), GeneralName(), and RFC822.
Referenced by email(), and GeneralName().
|
overridevirtual |
Encode whatever this object is into to
| to | the DER_Encoder that will be written to |
Implements Botan::ASN1_Object.
Definition at line 410 of file name_constraint.cpp.
References Botan::DER_Encoder::add_object(), Botan::concat(), Botan::ContextSpecific, DN, DNS, Botan::ExplicitContextSpecific, Botan::Ia5String, IPv4, IPv6, Botan::IPv4Address::netmask(), Botan::IPv6Address::netmask(), Other, RFC822, Unknown, URI, and Botan::ASN1_String::value().
Referenced by GeneralName().
|
static |
Definition at line 373 of file name_constraint.cpp.
References GeneralName(), and IPv4.
|
static |
Definition at line 369 of file name_constraint.cpp.
References GeneralName(), Botan::IPv4Subnet::host(), and IPv4.
|
static |
Definition at line 357 of file name_constraint.cpp.
References GeneralName(), and ipv4_address().
Referenced by GeneralName(), and ipv4_address().
|
static |
Definition at line 361 of file name_constraint.cpp.
References Botan::IPv4Subnet::from_address_and_mask(), GeneralName(), and IPv4.
|
static |
Definition at line 377 of file name_constraint.cpp.
References GeneralName(), Botan::IPv6Subnet::host(), and IPv6.
Referenced by GeneralName().
|
static |
Definition at line 381 of file name_constraint.cpp.
References GeneralName(), and IPv6.
| GeneralName::MatchResult Botan::GeneralName::matches | ( | const X509_Certificate & | cert | ) | const |
Checks whether a given certificate (partially) matches this name.
| cert | certificate to be matched |
Definition at line 672 of file name_constraint.cpp.
References All, Botan::AlternativeName::directory_names(), DN, DNS, dns(), Botan::AlternativeName::dns_names(), Botan::AlternativeName::email_addresses(), Botan::DNSName::from_san_string(), Botan::IPv4Address::from_string(), Botan::X509_DN::get_attribute(), IPv4, Botan::AlternativeName::ipv4_addresses(), IPv6, Botan::AlternativeName::ipv6_addresses(), Botan::AlternativeName::is_empty(), matches_dn(), matches_email(), matches_ipv6(), matches_uri(), None, NotFound, RFC822, Some, Botan::X509_Certificate::subject_alt_name(), Botan::X509_Certificate::subject_dn(), UnknownType, URI, uri(), and Botan::AlternativeName::uri_names().
| bool Botan::GeneralName::matches_dn | ( | const X509_DN & | dn | ) | const |
Definition at line 571 of file name_constraint.cpp.
References DN, and matches_dn().
Referenced by matches(), and matches_dn().
| bool Botan::GeneralName::matches_dns | ( | const DNSName & | dns_name | ) | const |
Definition at line 550 of file name_constraint.cpp.
References DNS, and Botan::DNSName::to_string().
| bool Botan::GeneralName::matches_dns | ( | const std::string & | dns_name | ) | const |
Definition at line 543 of file name_constraint.cpp.
References DNS.
| bool Botan::GeneralName::matches_email | ( | const EmailAddress & | addr | ) | const |
Definition at line 608 of file name_constraint.cpp.
References RFC822.
Referenced by matches().
| bool Botan::GeneralName::matches_email | ( | const SmtpUtf8Mailbox & | mailbox | ) | const |
Definition at line 615 of file name_constraint.cpp.
References Botan::SmtpUtf8Mailbox::domain(), RFC822, and Botan::DNSName::to_string().
|
inline |
Definition at line 625 of file pkix_types.h.
References matches_ipv4(), and matches_ipv4().
Referenced by matches_ipv4().
| bool Botan::GeneralName::matches_ipv4 | ( | uint32_t | ip | ) | const |
Definition at line 557 of file name_constraint.cpp.
References IPv4.
Referenced by matches_ipv4().
| bool Botan::GeneralName::matches_ipv6 | ( | const IPv6Address & | ip | ) | const |
Definition at line 564 of file name_constraint.cpp.
References IPv6.
Referenced by matches().
| bool Botan::GeneralName::matches_uri | ( | const URI & | uri | ) | const |
Definition at line 578 of file name_constraint.cpp.
Referenced by matches().
| std::string Botan::GeneralName::name | ( | ) | const |
Definition at line 385 of file name_constraint.cpp.
Referenced by botan_x509_general_name_view_string_value(), and Botan::operator<<().
| std::string Botan::GeneralName::type | ( | ) | const |
Definition at line 290 of file name_constraint.cpp.
References BOTAN_ASSERT_UNREACHABLE, DN, DNS, IPv4, IPv6, Other, RFC822, Unknown, and URI.
Referenced by Botan::operator<<().
|
inline |
Definition at line 596 of file pkix_types.h.
References type_code().
Referenced by botan_x509_general_name_get_type(), botan_x509_general_name_view_binary_value(), botan_x509_general_name_view_string_value(), Botan::NameConstraints::is_excluded(), and type_code().
|
static |
Definition at line 329 of file name_constraint.cpp.
References Botan::fmt(), GeneralName(), URI, and uri().
Referenced by _uri_san_value(), GeneralName(), matches(), matches_uri(), and uri().
|
friend |
Definition at line 634 of file pkix_types.h.
References NameConstraints.
Referenced by NameConstraints.