9 #include <botan/asn1_obj.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 ==
"" || str ==
"")
61 typedef std::multimap<std::string, std::string>::iterator iter;
62 std::pair<iter, iter> range = alt_info.equal_range(type);
63 for(iter j = range.first; j != range.second; ++j)
102 std::multimap<std::string, std::string> names;
104 typedef std::multimap<std::string, std::string>::const_iterator rdn_iter;
105 for(rdn_iter j = alt_info.begin(); j != alt_info.end(); ++j)
108 typedef std::multimap<OID, ASN1_String>::const_iterator on_iter;
109 for(on_iter j = othernames.begin(); j != othernames.end(); ++j)
120 return (alt_info.size() > 0 || othernames.size() > 0);
129 const std::multimap<std::string, std::string>& attr,
130 const std::string& type,
ASN1_Tag tagging)
132 typedef std::multimap<std::string, std::string>::const_iterator iter;
134 std::pair<iter, iter> range = attr.equal_range(type);
135 for(iter j = range.first; j != range.second; ++j)
137 if(type ==
"RFC822" || type ==
"DNS" || type ==
"URI")
142 else if(type ==
"IP")
145 byte ip_buf[4] = { 0 };
161 encode_entries(der, alt_info,
"RFC822",
ASN1_Tag(1));
162 encode_entries(der, alt_info,
"DNS",
ASN1_Tag(2));
163 encode_entries(der, alt_info,
"URI",
ASN1_Tag(6));
164 encode_entries(der, alt_info,
"IP",
ASN1_Tag(7));
166 std::multimap<OID, ASN1_String>::const_iterator i;
167 for(i = othernames.begin(); i != othernames.end(); ++i)
224 else if(tag == 1 || tag == 2 || tag == 6)
void add_attribute(const std::string &, const std::string &)
BER_Decoder & decode(bool &)
std::string ipv4_to_string(u32bit ip)
DER_Encoder & end_explicit()
std::string to_string(const BER_Object &obj)
void encode_into(class DER_Encoder &) const
std::multimap< std::string, std::string > contents() const
DER_Encoder & start_explicit(u16bit type_tag)
BER_Decoder start_cons(ASN1_Tag, ASN1_Tag=UNIVERSAL)
std::multimap< OID, ASN1_String > get_othernames() const
DER_Encoder & encode(bool b)
void decode_from(class BER_Decoder &)
std::string transcode(const std::string &str, Character_Set to, Character_Set from)
std::string lookup(const OID &oid)
std::multimap< std::string, std::string > get_attributes() const
SecureVector< byte > value
u32bit load_be< u32bit >(const byte in[], size_t off)
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 &="")
void store_be(u16bit in, byte out[2])
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)
DER_Encoder & add_object(ASN1_Tag type_tag, ASN1_Tag class_tag, const byte rep[], size_t length)
u32bit string_to_ipv4(const std::string &str)