Botan  1.10.9
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 
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 
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
MemoryVector< byte > parameters
Definition: asn1_obj.h:31
bool operator!=(const OctetString &s1, const OctetString &s2)
Definition: symkey.cpp:106
bool BOTAN_DLL operator>=(const X509_Time &, const X509_Time &)
Definition: asn1_tm.cpp:283
bool operator==(const OctetString &s1, const OctetString &s2)
Definition: symkey.cpp:98
signed int s32bit
Definition: types.h:37
unsigned long long u64bit
Definition: types.h:49
bool BOTAN_DLL operator>(const X509_Time &, const X509_Time &)
Definition: asn1_tm.cpp:288
ASN1_Tag
Definition: asn1_int.h:19
bool BOTAN_DLL operator<(const X509_Time &, const X509_Time &)
Definition: asn1_tm.cpp:286
bool BOTAN_DLL operator<=(const X509_Time &, const X509_Time &)
Definition: asn1_tm.cpp:281
unsigned int u32bit
Definition: types.h:32