9 #include <botan/asn1_alt_name.h>
10 #include <botan/der_enc.h>
11 #include <botan/ber_dec.h>
12 #include <botan/oids.h>
13 #include <botan/internal/stl_util.h>
14 #include <botan/charset.h>
15 #include <botan/parsing.h>
16 #include <botan/loadstor.h>
42 const std::string& uri,
43 const std::string& dns,
44 const std::string& ip)
56 const std::string& str)
58 if(type.empty() || str.empty())
61 auto range = m_alt_info.equal_range(type);
62 for(
auto j = range.first; j != range.second; ++j)
101 std::multimap<std::string, std::string> names;
103 for(
auto i = m_alt_info.begin(); i != m_alt_info.end(); ++i)
106 for(
auto i = m_othernames.begin(); i != m_othernames.end(); ++i)
117 return (m_alt_info.size() > 0 || m_othernames.size() > 0);
126 const std::multimap<std::string, std::string>& attr,
129 auto range = attr.equal_range(type);
131 for(
auto i = range.first; i != range.second; ++i)
133 if(type ==
"RFC822" || type ==
"DNS" || type ==
"URI")
138 else if(type ==
"IP")
141 uint8_t ip_buf[4] = { 0 };
157 encode_entries(der, m_alt_info,
"RFC822",
ASN1_Tag(1));
158 encode_entries(der, m_alt_info,
"DNS",
ASN1_Tag(2));
159 encode_entries(der, m_alt_info,
"URI",
ASN1_Tag(6));
160 encode_entries(der, m_alt_info,
"IP",
ASN1_Tag(7));
162 for(
auto i = m_othernames.begin(); i != m_othernames.end(); ++i)
219 else if(tag == 1 || tag == 2 || tag == 6)
231 if(obj.
value.size() == 4)
void encode_into(class DER_Encoder &) const override
DER_Encoder & add_object(ASN1_Tag type_tag, ASN1_Tag class_tag, const uint8_t rep[], size_t length)
void add_attribute(const std::string &, const std::string &)
void store_be(uint16_t in, uint8_t out[2])
uint32_t load_be< uint32_t >(const uint8_t in[], size_t off)
BER_Decoder & decode(bool &v)
DER_Encoder & end_explicit()
std::string to_string(const BER_Object &obj)
std::multimap< std::string, std::string > contents() const
std::string ipv4_to_string(uint32_t ip)
std::multimap< OID, ASN1_String > get_othernames() const
DER_Encoder & encode(bool b)
secure_vector< uint8_t > value
std::string transcode(const std::string &str, Character_Set to, Character_Set from)
std::string lookup(const OID &oid)
BER_Decoder start_cons(ASN1_Tag type_tag, ASN1_Tag class_tag=UNIVERSAL)
std::multimap< std::string, std::string > get_attributes() const
void add_othername(const OID &, const std::string &, ASN1_Tag)
BER_Object get_next_object()
AlternativeName(const std::string &="", const std::string &="", const std::string &="", const std::string &="")
BER_Decoder & verify_end()
DER_Encoder & start_cons(ASN1_Tag type_tag, ASN1_Tag class_tag=UNIVERSAL)
void multimap_insert(std::multimap< K, V > &multimap, const K &key, const V &value)
uint32_t string_to_ipv4(const std::string &str)
void decode_from(class BER_Decoder &) override
DER_Encoder & start_explicit(uint16_t type_tag)