Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

x509_crl.h
Go to the documentation of this file.
1 /*
2 * X.509 CRL
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7
8 #ifndef BOTAN_X509_CRL_H__
9 #define BOTAN_X509_CRL_H__
10
11 #include <botan/x509_obj.h>
12 #include <botan/x509_dn.h>
13 #include <botan/crl_ent.h>
14 #include <botan/datastor.h>
15 #include <vector>
16
17 namespace Botan {
18
19 class X509_Certificate;
20
21 /**
22 * This class represents X.509 Certificate Revocation Lists (CRLs).
23 */
24 class BOTAN_DLL X509_CRL final : public X509_Object
25 {
26 public:
27 /**
28 * This class represents CRL related errors.
29 */
30 struct BOTAN_DLL X509_CRL_Error : public Exception
31 {
32 explicit X509_CRL_Error(const std::string& error) :
33 Exception("X509_CRL: " + error) {}
34 };
35
36 /**
37 * Check if this particular certificate is listed in the CRL
38 */
39 bool is_revoked(const X509_Certificate& cert) const;
40
41 /**
42 * Get the entries of this CRL in the form of a vector.
43 * @return vector containing the entries of this CRL.
44 */
45 std::vector<CRL_Entry> get_revoked() const;
46
47 /**
48 * Get the issuer DN of this CRL.
49 * @return CRLs issuer DN
50 */
51 X509_DN issuer_dn() const;
52
53 /**
54 * Get the AuthorityKeyIdentifier of this CRL.
55 * @return this CRLs AuthorityKeyIdentifier
56 */
57 std::vector<uint8_t> authority_key_id() const;
58
59 /**
60 * Get the serial number of this CRL.
61 * @return CRLs serial number
62 */
63 uint32_t crl_number() const;
64
65 /**
66 * Get the CRL's thisUpdate value.
67 * @return CRLs thisUpdate
68 */
69 X509_Time this_update() const;
70
71 /**
72 * Get the CRL's nextUpdate value.
73 * @return CRLs nextdUpdate
74 */
75 X509_Time next_update() const;
76
77 /**
78 * Construct a CRL from a data source.
79 * @param source the data source providing the DER or PEM encoded CRL.
80 * @param throw_on_unknown_critical should we throw an exception
81 * if an unknown CRL extension marked as critical is encountered.
82 */
83 X509_CRL(DataSource& source, bool throw_on_unknown_critical = false);
84
85 #if defined(BOTAN_TARGET_OS_HAS_FILESYSTEM)
86 /**
87 * Construct a CRL from a file containing the DER or PEM encoded CRL.
88 * @param filename the name of the CRL file
89 * @param throw_on_unknown_critical should we throw an exception
90 * if an unknown CRL extension marked as critical is encountered.
91 */
92 X509_CRL(const std::string& filename,
93 bool throw_on_unknown_critical = false);
94 #endif
95
96 /**
97 * Construct a CRL from a binary vector
98 * @param vec the binary (DER) representation of the CRL
99 * @param throw_on_unknown_critical should we throw an exception
100 * if an unknown CRL extension marked as critical is encountered.
101 */
102 X509_CRL(const std::vector<uint8_t>& vec,
103 bool throw_on_unknown_critical = false);
104
105 /**
106 * Construct a CRL
107 * @param issuer issuer of this CRL
108 * @param thisUpdate valid from
109 * @param nextUpdate valid until
110 * @param revoked entries to be included in the CRL
111 */
112 X509_CRL(const X509_DN& issuer, const X509_Time& thisUpdate,
113 const X509_Time& nextUpdate, const std::vector<CRL_Entry>& revoked);
114
115 private:
116 void force_decode() override;
117
118 bool m_throw_on_unknown_critical;
119 std::vector<CRL_Entry> m_revoked;
120 Data_Store m_info;
121 };
122
123 }
124
125 #endif
Botan::Exception
Definition: exceptn.h:21
Botan::X509_CRL::X509_CRL_Error::X509_CRL_Error
X509_CRL_Error(const std::string &error)
Definition: x509_crl.h:32
Botan::DataSource
Definition: data_src.h:21
Botan::X509_Certificate
Definition: x509cert.h:36
Botan::X509_Object
Definition: x509_obj.h:22
Botan::X509_DN
Definition: x509_dn.h:22
Botan
Definition: alg_id.cpp:13
Botan::Data_Store
Definition: datastor.h:27
Botan::X509_CRL::X509_CRL_Error
Definition: x509_crl.h:30
Botan::X509_CRL
Definition: x509_crl.h:24
Botan::X509_Time
Definition: asn1_time.h:19