Botan 3.9.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 , Other = 6 } |
Public Member Functions | |
std::vector< uint8_t > | BER_encode () 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 std::string &dns_name) const |
bool | matches_ipv4 (uint32_t ip) const |
std::string | name () const |
std::string | type () const |
NameType | type_code () const |
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 Contraints).
This entire class is deprecated and will be removed in a future major release
Definition at line 260 of file pkix_types.h.
enum Botan::GeneralName::MatchResult : uint8_t |
Enumerator | |
---|---|
All | |
Some | |
None | |
NotFound | |
UnknownType |
Definition at line 262 of file pkix_types.h.
|
strong |
Enumerator | |
---|---|
Unknown | |
RFC822 | |
DNS | |
URI | |
DN | |
IPv4 | |
Other |
Definition at line 270 of file pkix_types.h.
|
default |
References decode_from(), encode_into(), and GeneralName().
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 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().
|
overridevirtual |
Decode whatever this object is from from
from | the BER_Decoder that will be read from |
Implements Botan::ASN1_Object.
Definition at line 68 of file name_constraint.cpp.
References Botan::BER_Object::bits(), Botan::Constructed, Botan::ContextSpecific, Botan::X509_DN::decode_from(), DN, DNS, Botan::ExplicitContextSpecific, Botan::BER_Decoder::get_next_object(), IPv4, Botan::BER_Object::is_a(), Botan::BER_Object::length(), Botan::load_be(), Other, RFC822, Botan::ASN1::to_string(), Botan::tolower_string(), Unknown, and URI.
Referenced by 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 64 of file name_constraint.cpp.
Referenced by GeneralName().
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 132 of file name_constraint.cpp.
References All, Botan::AlternativeName::count(), Botan::AlternativeName::directory_names(), DN, DNS, Botan::AlternativeName::dns(), Botan::X509_DN::get_attribute(), IPv4, Botan::AlternativeName::ipv4_address(), matches_dn(), matches_dns(), None, NotFound, Some, Botan::string_to_ipv4(), Botan::X509_Certificate::subject_alt_name(), Botan::X509_Certificate::subject_dn(), and UnknownType.
bool Botan::GeneralName::matches_dn | ( | const X509_DN & | dn | ) | const |
Definition at line 124 of file name_constraint.cpp.
References DN, and matches_dn().
Referenced by matches(), and matches_dn().
bool Botan::GeneralName::matches_dns | ( | const std::string & | dns_name | ) | const |
Definition at line 108 of file name_constraint.cpp.
References DNS, and matches_dns().
Referenced by matches(), and matches_dns().
bool Botan::GeneralName::matches_ipv4 | ( | uint32_t | ip | ) | const |
Definition at line 116 of file name_constraint.cpp.
References IPv4.
std::string Botan::GeneralName::name | ( | ) | const |
Definition at line 45 of file name_constraint.cpp.
References BOTAN_ASSERT_UNREACHABLE, Botan::fmt(), and Botan::ipv4_to_string().
Referenced by Botan::operator<<().
std::string Botan::GeneralName::type | ( | ) | const |
Definition at line 24 of file name_constraint.cpp.
References BOTAN_ASSERT_UNREACHABLE, DN, DNS, IPv4, Other, RFC822, Unknown, and URI.
Referenced by Botan::operator<<().
|
inline |
Definition at line 290 of file pkix_types.h.
References type_code().
Referenced by type_code().