diff options
author | lloyd <[email protected]> | 2010-10-13 12:37:12 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-10-13 12:37:12 +0000 |
commit | 85a504e310666f270a3a67edf4cdac06c34c61b9 (patch) | |
tree | 3a5e88794a6ce462602b97610b770019bc78118c /src/asn1 | |
parent | b295e186a4681c6c9a96b469e66656dc1f660be7 (diff) |
Split some of the ASN.1 types into their own headers
Diffstat (limited to 'src/asn1')
-rw-r--r-- | src/asn1/asn1_obj.h | 56 | ||||
-rw-r--r-- | src/asn1/asn1_str.cpp | 2 | ||||
-rw-r--r-- | src/asn1/asn1_str.h | 38 | ||||
-rw-r--r-- | src/asn1/info.txt | 4 | ||||
-rw-r--r-- | src/asn1/x509_dn.cpp (renamed from src/asn1/asn1_dn.cpp) | 2 | ||||
-rw-r--r-- | src/asn1/x509_dn.h | 54 |
6 files changed, 98 insertions, 58 deletions
diff --git a/src/asn1/asn1_obj.h b/src/asn1/asn1_obj.h index 068ed1565..8a7e6cea2 100644 --- a/src/asn1/asn1_obj.h +++ b/src/asn1/asn1_obj.h @@ -11,6 +11,7 @@ #include <botan/asn1_int.h> #include <botan/asn1_oid.h> +#include <botan/asn1_str.h> #include <botan/alg_id.h> #include <vector> #include <map> @@ -62,57 +63,6 @@ class BOTAN_DLL X509_Time : public ASN1_Object }; /** -* Simple String -*/ -class BOTAN_DLL ASN1_String : public ASN1_Object - { - public: - void encode_into(class DER_Encoder&) const; - void decode_from(class BER_Decoder&); - - std::string value() const; - std::string iso_8859() const; - - ASN1_Tag tagging() const; - - ASN1_String(const std::string& = ""); - ASN1_String(const std::string&, ASN1_Tag); - private: - std::string iso_8859_str; - ASN1_Tag tag; - }; - -/** -* Distinguished Name -*/ -class BOTAN_DLL X509_DN : public ASN1_Object - { - public: - void encode_into(class DER_Encoder&) const; - void decode_from(class BER_Decoder&); - - std::multimap<OID, std::string> get_attributes() const; - std::vector<std::string> get_attribute(const std::string&) const; - - std::multimap<std::string, std::string> contents() const; - - void add_attribute(const std::string&, const std::string&); - void add_attribute(const OID&, const std::string&); - - static std::string deref_info_field(const std::string&); - - void do_decode(const MemoryRegion<byte>&); - MemoryVector<byte> get_bits() const; - - X509_DN(); - X509_DN(const std::multimap<OID, std::string>&); - X509_DN(const std::multimap<std::string, std::string>&); - private: - std::multimap<OID, ASN1_String> dn_info; - MemoryVector<byte> dn_bits; - }; - -/** * Alternative Name */ class BOTAN_DLL AlternativeName : public ASN1_Object @@ -148,10 +98,6 @@ bool BOTAN_DLL operator>=(const X509_Time&, const X509_Time&); bool BOTAN_DLL operator<(const X509_Time&, const X509_Time&); bool BOTAN_DLL operator>(const X509_Time&, const X509_Time&); -bool BOTAN_DLL operator==(const X509_DN&, const X509_DN&); -bool BOTAN_DLL operator!=(const X509_DN&, const X509_DN&); -bool BOTAN_DLL operator<(const X509_DN&, const X509_DN&); - /* * Helper Functions */ diff --git a/src/asn1/asn1_str.cpp b/src/asn1/asn1_str.cpp index 3d79674ec..efdf1a9b3 100644 --- a/src/asn1/asn1_str.cpp +++ b/src/asn1/asn1_str.cpp @@ -5,7 +5,7 @@ * Distributed under the terms of the Botan license */ -#include <botan/asn1_obj.h> +#include <botan/asn1_str.h> #include <botan/der_enc.h> #include <botan/ber_dec.h> #include <botan/charset.h> diff --git a/src/asn1/asn1_str.h b/src/asn1/asn1_str.h new file mode 100644 index 000000000..ba43b0e94 --- /dev/null +++ b/src/asn1/asn1_str.h @@ -0,0 +1,38 @@ +/* +* ASN.1 string type +* (C) 1999-2010 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#ifndef BOTAN_ASN1_STRING_H__ +#define BOTAN_ASN1_STRING_H__ + +#include <botan/asn1_int.h> + +namespace Botan { + +/** +* Simple String +*/ +class BOTAN_DLL ASN1_String : public ASN1_Object + { + public: + void encode_into(class DER_Encoder&) const; + void decode_from(class BER_Decoder&); + + std::string value() const; + std::string iso_8859() const; + + ASN1_Tag tagging() const; + + ASN1_String(const std::string& = ""); + ASN1_String(const std::string&, ASN1_Tag); + private: + std::string iso_8859_str; + ASN1_Tag tag; + }; + +} + +#endif diff --git a/src/asn1/info.txt b/src/asn1/info.txt index 7ed025e68..e190ad9ea 100644 --- a/src/asn1/info.txt +++ b/src/asn1/info.txt @@ -6,13 +6,13 @@ load_on auto alg_id.cpp asn1_alt.cpp asn1_att.cpp -asn1_dn.cpp asn1_int.cpp asn1_oid.cpp asn1_str.cpp asn1_tm.cpp ber_dec.cpp der_enc.cpp +x509_dn.cpp </source> <header:public> @@ -20,8 +20,10 @@ alg_id.h asn1_int.h asn1_obj.h asn1_oid.h +asn1_str.h ber_dec.h der_enc.h +x509_dn.h </header:public> <requires> diff --git a/src/asn1/asn1_dn.cpp b/src/asn1/x509_dn.cpp index 1de8b8c7f..0a4760391 100644 --- a/src/asn1/asn1_dn.cpp +++ b/src/asn1/x509_dn.cpp @@ -5,7 +5,7 @@ * Distributed under the terms of the Botan license */ -#include <botan/asn1_obj.h> +#include <botan/x509_dn.h> #include <botan/der_enc.h> #include <botan/ber_dec.h> #include <botan/parsing.h> diff --git a/src/asn1/x509_dn.h b/src/asn1/x509_dn.h new file mode 100644 index 000000000..c4fc2d17b --- /dev/null +++ b/src/asn1/x509_dn.h @@ -0,0 +1,54 @@ +/* +* X.509 Distinguished Name +* (C) 1999-2010 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#ifndef BOTAN_X509_DN_H__ +#define BOTAN_X509_DN_H__ + +#include <botan/asn1_int.h> +#include <botan/asn1_oid.h> +#include <botan/asn1_str.h> +#include <map> + +namespace Botan { + +/** +* Distinguished Name +*/ +class BOTAN_DLL X509_DN : public ASN1_Object + { + public: + void encode_into(class DER_Encoder&) const; + void decode_from(class BER_Decoder&); + + std::multimap<OID, std::string> get_attributes() const; + std::vector<std::string> get_attribute(const std::string&) const; + + std::multimap<std::string, std::string> contents() const; + + void add_attribute(const std::string&, const std::string&); + void add_attribute(const OID&, const std::string&); + + static std::string deref_info_field(const std::string&); + + void do_decode(const MemoryRegion<byte>&); + MemoryVector<byte> get_bits() const; + + X509_DN(); + X509_DN(const std::multimap<OID, std::string>&); + X509_DN(const std::multimap<std::string, std::string>&); + private: + std::multimap<OID, ASN1_String> dn_info; + MemoryVector<byte> dn_bits; + }; + +bool BOTAN_DLL operator==(const X509_DN&, const X509_DN&); +bool BOTAN_DLL operator!=(const X509_DN&, const X509_DN&); +bool BOTAN_DLL operator<(const X509_DN&, const X509_DN&); + +} + +#endif |