Botan: src/asn1/asn1_obj.h Source File

Botan 1.10.17

asn1_obj.h
Go to the documentation of this file.
1 /*
2 * Common ASN.1 Objects
3 * (C) 1999-2007 Jack Lloyd
4 * 2007 Yves Jerschow
5 *
6 * Distributed under the terms of the Botan license
7 */
8
9 #ifndef BOTAN_ASN1_OBJ_H__
10 #define BOTAN_ASN1_OBJ_H__
11
12 #include <botan/asn1_int.h>
13 #include <botan/asn1_oid.h>
14 #include <botan/asn1_str.h>
15 #include <botan/alg_id.h>
16 #include <vector>
17 #include <map>
18
19 namespace Botan {
20
21 /**
22 * Attribute
23 */
24 class BOTAN_DLL Attribute : public ASN1_Object
25 {
26 public:
27 void encode_into(class DER_Encoder& to) const;
28 void decode_from(class BER_Decoder& from);
29
30 OID oid;
31 MemoryVector<byte> parameters;
32
33 Attribute() {}
34 Attribute(const OID&, const MemoryRegion<byte>&);
35 Attribute(const std::string&, const MemoryRegion<byte>&);
36 };
37
38 /**
39 * X.509 Time
40 */
41 class BOTAN_DLL X509_Time : public ASN1_Object
42 {
43 public:
44 void encode_into(class DER_Encoder&) const;
45 void decode_from(class BER_Decoder&);
46
47 std::string as_string() const;
48 std::string readable_string() const;
49 bool time_is_set() const;
50
51 s32bit cmp(const X509_Time&) const;
52
53 void set_to(const std::string&);
54 void set_to(const std::string&, ASN1_Tag);
55
56 X509_Time(u64bit);
57 X509_Time(const std::string& = "");
58 X509_Time(const std::string&, ASN1_Tag);
59 private:
60 bool passes_sanity_check() const;
61 u32bit year, month, day, hour, minute, second;
62 ASN1_Tag tag;
63 };
64
65 /**
66 * Alternative Name
67 */
68 class BOTAN_DLL AlternativeName : public ASN1_Object
69 {
70 public:
71 void encode_into(class DER_Encoder&) const;
72 void decode_from(class BER_Decoder&);
73
74 std::multimap<std::string, std::string> contents() const;
75
76 void add_attribute(const std::string&, const std::string&);
77 std::multimap<std::string, std::string> get_attributes() const;
78
79 void add_othername(const OID&, const std::string&, ASN1_Tag);
80 std::multimap<OID, ASN1_String> get_othernames() const;
81
82 bool has_items() const;
83
84 AlternativeName(const std::string& = "", const std::string& = "",
85 const std::string& = "", const std::string& = "");
86 private:
87 std::multimap<std::string, std::string> alt_info;
88 std::multimap<OID, ASN1_String> othernames;
89 };
90
91 /*
92 * Comparison Operations
93 */
94 bool BOTAN_DLL operator==(const X509_Time&, const X509_Time&);
95 bool BOTAN_DLL operator!=(const X509_Time&, const X509_Time&);
96 bool BOTAN_DLL operator<=(const X509_Time&, const X509_Time&);
97 bool BOTAN_DLL operator>=(const X509_Time&, const X509_Time&);
98 bool BOTAN_DLL operator<(const X509_Time&, const X509_Time&);
99 bool BOTAN_DLL operator>(const X509_Time&, const X509_Time&);
100
101 }
102
103 #endif
Botan::Attribute::parameters
MemoryVector< byte > parameters
Definition: asn1_obj.h:31
Botan::operator!=
bool operator!=(const OctetString &s1, const OctetString &s2)
Definition: symkey.cpp:106
Botan::ASN1_Object
Definition: asn1_int.h:56
Botan::operator>=
bool BOTAN_DLL operator>=(const X509_Time &, const X509_Time &)
Definition: asn1_tm.cpp:283
Botan::operator==
bool operator==(const OctetString &s1, const OctetString &s2)
Definition: symkey.cpp:98
Botan::s32bit
signed int s32bit
Definition: types.h:37
Botan::u64bit
unsigned long long u64bit
Definition: types.h:49
Botan::DER_Encoder
Definition: der_enc.h:22
Botan::Attribute::oid
OID oid
Definition: asn1_obj.h:30
Botan::operator>
bool BOTAN_DLL operator>(const X509_Time &, const X509_Time &)
Definition: asn1_tm.cpp:288
Botan::ASN1_Tag
ASN1_Tag
Definition: asn1_int.h:19
Botan::MemoryRegion< byte >
Botan
Definition: algo_base.h:14
Botan::MemoryVector< byte >
Botan::operator<
bool BOTAN_DLL operator<(const X509_Time &, const X509_Time &)
Definition: asn1_tm.cpp:286
Botan::OID
Definition: asn1_oid.h:20
Botan::BER_Decoder
Definition: ber_dec.h:19
Botan::operator<=
bool BOTAN_DLL operator<=(const X509_Time &, const X509_Time &)
Definition: asn1_tm.cpp:281
Botan::X509_Time
Definition: asn1_obj.h:41
Botan::Attribute
Definition: asn1_obj.h:24
Botan::u32bit
unsigned int u32bit
Definition: types.h:32
Botan::AlternativeName
Definition: asn1_obj.h:68
Botan::Attribute::Attribute
Attribute()
Definition: asn1_obj.h:33