Botan  2.4.0
Crypto and TLS for C++11
asn1_alt_name.h
Go to the documentation of this file.
1 /*
2 * (C) 1999-2007 Jack Lloyd
3 * 2007 Yves Jerschow
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7 
8 #ifndef BOTAN_X509_ALT_NAME_H_
9 #define BOTAN_X509_ALT_NAME_H_
10 
11 #include <botan/asn1_obj.h>
12 #include <botan/asn1_str.h>
13 #include <botan/asn1_oid.h>
14 #include <map>
15 
16 namespace Botan {
17 
18 /**
19 * Alternative Name
20 */
21 class BOTAN_PUBLIC_API(2,0) AlternativeName final : public ASN1_Object
22  {
23  public:
24  void encode_into(class DER_Encoder&) const override;
25  void decode_from(class BER_Decoder&) override;
26 
27  std::multimap<std::string, std::string> contents() const;
28 
29  bool has_field(const std::string& attr) const;
30  std::vector<std::string> get_attribute(const std::string& attr) const;
31 
32  std::string get_first_attribute(const std::string& attr) const;
33 
34  void add_attribute(const std::string& type, const std::string& value);
35  void add_othername(const OID& oid, const std::string& value, ASN1_Tag type);
36 
37  const std::multimap<std::string, std::string>& get_attributes() const
38  {
39  return m_alt_info;
40  }
41 
42  const std::multimap<OID, ASN1_String>& get_othernames() const
43  {
44  return m_othernames;
45  }
46 
47  bool has_items() const;
48 
49  AlternativeName(const std::string& email_addr = "",
50  const std::string& uri = "",
51  const std::string& dns = "",
52  const std::string& ip_address = "");
53  private:
54  std::multimap<std::string, std::string> m_alt_info;
55  std::multimap<OID, ASN1_String> m_othernames;
56  };
57 
58 }
59 
60 #endif
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:27
ASN1_Tag
Definition: asn1_obj.h:22
MechanismType type
const std::multimap< std::string, std::string > & get_attributes() const
Definition: asn1_alt_name.h:37
const std::multimap< OID, ASN1_String > & get_othernames() const
Definition: asn1_alt_name.h:42
Definition: alg_id.cpp:13