Botan  2.1.0
Crypto and TLS for C++11
x509_dn.h
Go to the documentation of this file.
1 /*
2 * X.509 Distinguished Name
3 * (C) 1999-2010 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7 
8 #ifndef BOTAN_X509_DN_H__
9 #define BOTAN_X509_DN_H__
10 
11 #include <botan/asn1_obj.h>
12 #include <botan/asn1_oid.h>
13 #include <botan/asn1_str.h>
14 #include <map>
15 #include <iosfwd>
16 
17 namespace Botan {
18 
19 /**
20 * Distinguished Name
21 */
22 class BOTAN_DLL X509_DN final : public ASN1_Object
23  {
24  public:
25  void encode_into(class DER_Encoder&) const override;
26  void decode_from(class BER_Decoder&) override;
27 
28  std::multimap<OID, std::string> get_attributes() const;
29  std::vector<std::string> get_attribute(const std::string&) const;
30 
31  std::multimap<std::string, std::string> contents() const;
32 
33  void add_attribute(const std::string&, const std::string&);
34  void add_attribute(const OID&, const std::string&);
35 
36  static std::string deref_info_field(const std::string&);
37 
38  std::vector<uint8_t> get_bits() const;
39 
40  bool empty() const { return m_dn_info.empty(); }
41 
42  X509_DN();
43  explicit X509_DN(const std::multimap<OID, std::string>&);
44  explicit X509_DN(const std::multimap<std::string, std::string>&);
45  private:
46  std::multimap<OID, ASN1_String> m_dn_info;
47  std::vector<uint8_t> m_dn_bits;
48  };
49 
50 bool BOTAN_DLL operator==(const X509_DN&, const X509_DN&);
51 bool BOTAN_DLL operator!=(const X509_DN&, const X509_DN&);
52 bool BOTAN_DLL operator<(const X509_DN&, const X509_DN&);
53 
54 BOTAN_DLL std::ostream& operator<<(std::ostream& out, const X509_DN& dn);
55 BOTAN_DLL std::istream& operator>>(std::istream& in, X509_DN& dn);
56 
57 }
58 
59 #endif
std::istream & operator>>(std::istream &in, X509_DN &dn)
Definition: x509_dn.cpp:325
bool operator!=(const AlgorithmIdentifier &a1, const AlgorithmIdentifier &a2)
Definition: alg_id.cpp:82
std::ostream & operator<<(std::ostream &out, const X509_DN &dn)
Definition: x509_dn.cpp:299
bool operator==(const AlgorithmIdentifier &a1, const AlgorithmIdentifier &a2)
Definition: alg_id.cpp:67
bool operator<(const OID &a, const OID &b)
Definition: asn1_oid.cpp:105
bool empty() const
Definition: x509_dn.h:40
Definition: alg_id.cpp:13