Botan  1.11.15
src/lib/asn1/x509_dn.h
Go to the documentation of this file.
00001 /*
00002 * X.509 Distinguished Name
00003 * (C) 1999-2010 Jack Lloyd
00004 *
00005 * Botan is released under the Simplified BSD License (see license.txt)
00006 */
00007 
00008 #ifndef BOTAN_X509_DN_H__
00009 #define BOTAN_X509_DN_H__
00010 
00011 #include <botan/asn1_obj.h>
00012 #include <botan/asn1_oid.h>
00013 #include <botan/asn1_str.h>
00014 #include <map>
00015 #include <iosfwd>
00016 
00017 namespace Botan {
00018 
00019 /**
00020 * Distinguished Name
00021 */
00022 class BOTAN_DLL X509_DN : public ASN1_Object
00023    {
00024    public:
00025       void encode_into(class DER_Encoder&) const;
00026       void decode_from(class BER_Decoder&);
00027 
00028       std::multimap<OID, std::string> get_attributes() const;
00029       std::vector<std::string> get_attribute(const std::string&) const;
00030 
00031       std::multimap<std::string, std::string> contents() const;
00032 
00033       void add_attribute(const std::string&, const std::string&);
00034       void add_attribute(const OID&, const std::string&);
00035 
00036       static std::string deref_info_field(const std::string&);
00037 
00038       std::vector<byte> get_bits() const;
00039 
00040       X509_DN();
00041       X509_DN(const std::multimap<OID, std::string>&);
00042       X509_DN(const std::multimap<std::string, std::string>&);
00043    private:
00044       std::multimap<OID, ASN1_String> dn_info;
00045       std::vector<byte> dn_bits;
00046    };
00047 
00048 bool BOTAN_DLL operator==(const X509_DN&, const X509_DN&);
00049 bool BOTAN_DLL operator!=(const X509_DN&, const X509_DN&);
00050 bool BOTAN_DLL operator<(const X509_DN&, const X509_DN&);
00051 
00052 BOTAN_DLL std::ostream& operator<<(std::ostream& out, const X509_DN& dn);
00053 
00054 }
00055 
00056 #endif