7#include <botan/pkix_types.h>
9#include <botan/ber_dec.h>
10#include <botan/der_enc.h>
11#include <botan/internal/int_utils.h>
12#include <botan/internal/loadstor.h>
13#include <botan/internal/parsing.h>
14#include <botan/internal/stl_util.h>
20 m_uri.insert(std::string(uri));
26 m_email.insert(std::string(addr));
37 m_othernames.insert(std::make_pair(oid, value));
41 m_dn_names.insert(
dn);
45 m_ipv4_addr.insert(ip);
50 m_dns.size(), m_uri.size(), m_email.size(), m_ipv4_addr.size(), m_dn_names.size(), m_othernames.size());
56 return this->
count() > 0;
75 for(
const auto& othername : m_othernames) {
84 for(
const auto&
name : m_email) {
89 for(
const auto&
name : m_dns) {
94 for(
const auto&
name : m_dn_names) {
98 for(
const auto&
name : m_uri) {
103 for(uint32_t ip : m_ipv4_addr) {
131 BER_Decoder othername_value_inner(othername_value_outer);
155 }
else if(obj.
length() != 16) {
156 throw Decoding_Error(
"Invalid IP constraint neither IPv4 or IPv6");
const std::string & value() const
static bool is_string_type(ASN1_Type tag)
void add_dns(std::string_view dns)
Add a DNS name to this AlternativeName.
void add_ipv4_address(uint32_t ipv4)
Add an IP address to this alternative name.
void add_email(std::string_view addr)
Add a URI to this AlternativeName.
void add_uri(std::string_view uri)
Add a URI to this AlternativeName.
void encode_into(DER_Encoder &) const override
bool has_items() const
Return true if this has any names set.
const std::set< std::string > & dns() const
Return the set of DNS names included in 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_othername(const OID &oid, std::string_view value, ASN1_Type type)
void decode_from(BER_Decoder &) override
void add_dn(const X509_DN &dn)
Add a directory name to this AlternativeName.
BER_Object get_next_object()
BER_Decoder & decode(bool &out)
BER_Decoder & verify_end()
BER_Decoder start_sequence()
const uint8_t * bits() const
bool is_a(ASN1_Type type_tag, ASN1_Class class_tag) const
ASN1_Class get_class() const
DER_Encoder & add_object(ASN1_Type type_tag, ASN1_Class class_tag, const uint8_t rep[], size_t length)
DER_Encoder & end_explicit()
DER_Encoder & start_explicit(uint16_t type_tag)
DER_Encoder & start_sequence()
DER_Encoder & encode(bool b)
std::string to_string(const BER_Object &obj)
constexpr std::optional< T > checked_add(T a, T b)
@ ExplicitContextSpecific
std::string tolower_string(std::string_view in)
constexpr auto store_be(ParamTs &&... params)
constexpr auto load_be(ParamTs &&... params)
#define BOTAN_ASSERT_IS_SOME(v)