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
19namespace Botan {
20
21/**
22* Attribute
23*/
24class 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
34 Attribute(const OID&, const MemoryRegion<byte>&);
35 Attribute(const std::string&, const MemoryRegion<byte>&);
36 };
37
38/**
39* X.509 Time
40*/
41class 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*/
68class 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*/
94bool BOTAN_DLL operator==(const X509_Time&, const X509_Time&);
95bool BOTAN_DLL operator!=(const X509_Time&, const X509_Time&);
96bool BOTAN_DLL operator<=(const X509_Time&, const X509_Time&);
97bool BOTAN_DLL operator>=(const X509_Time&, const X509_Time&);
98bool BOTAN_DLL operator<(const X509_Time&, const X509_Time&);
99bool BOTAN_DLL operator>(const X509_Time&, const X509_Time&);
100
101}
102
103#endif
void encode_into(class DER_Encoder &) const
Definition asn1_alt.cpp:157
std::multimap< std::string, std::string > get_attributes() const
Definition asn1_alt.cpp:84
std::multimap< std::string, std::string > contents() const
Definition asn1_alt.cpp:100
bool has_items() const
Definition asn1_alt.cpp:118
void add_othername(const OID &, const std::string &, ASN1_Tag)
Definition asn1_alt.cpp:73
void add_attribute(const std::string &, const std::string &)
Definition asn1_alt.cpp:55
std::multimap< OID, ASN1_String > get_othernames() const
Definition asn1_alt.cpp:92
void decode_from(class BER_Decoder &)
Definition asn1_alt.cpp:183
AlternativeName(const std::string &="", const std::string &="", const std::string &="", const std::string &="")
Definition asn1_alt.cpp:41
void decode_from(class BER_Decoder &from)
Definition asn1_att.cpp:50
MemoryVector< byte > parameters
Definition asn1_obj.h:31
void encode_into(class DER_Encoder &to) const
Definition asn1_att.cpp:37
bool time_is_set() const
Definition asn1_tm.cpp:208
std::string as_string() const
Definition asn1_tm.cpp:180
void encode_into(class DER_Encoder &) const
Definition asn1_tm.cpp:153
void set_to(const std::string &)
Definition asn1_tm.cpp:53
std::string readable_string() const
Definition asn1_tm.cpp:216
s32bit cmp(const X509_Time &) const
Definition asn1_tm.cpp:250
X509_Time(u64bit)
Definition asn1_tm.cpp:28
void decode_from(class BER_Decoder &)
Definition asn1_tm.cpp:167
bool BOTAN_DLL operator>(const X509_Time &, const X509_Time &)
Definition asn1_tm.cpp:288
bool BOTAN_DLL operator<(const X509_Time &, const X509_Time &)
Definition asn1_tm.cpp:286
signed int s32bit
Definition types.h:37
bool BOTAN_DLL operator>=(const X509_Time &, const X509_Time &)
Definition asn1_tm.cpp:283
unsigned long long u64bit
Definition types.h:49
bool operator!=(const OctetString &s1, const OctetString &s2)
Definition symkey.cpp:106
ASN1_Tag
Definition asn1_int.h:19
unsigned int u32bit
Definition types.h:32
bool BOTAN_DLL operator<=(const X509_Time &, const X509_Time &)
Definition asn1_tm.cpp:281
bool operator==(const OctetString &s1, const OctetString &s2)
Definition symkey.cpp:98