Botan  1.10.9
x509_crl.h
Go to the documentation of this file.
1 /*
2 * X.509 CRL
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7 
8 #ifndef BOTAN_X509_CRL_H__
9 #define BOTAN_X509_CRL_H__
10 
11 #include <botan/x509_obj.h>
12 #include <botan/crl_ent.h>
13 #include <vector>
14 
15 namespace Botan {
16 
17 /**
18 * This class represents X.509 Certificate Revocation Lists (CRLs).
19 */
20 class BOTAN_DLL X509_CRL : public X509_Object
21  {
22  public:
23  /**
24  * This class represents CRL related errors.
25  */
26  struct BOTAN_DLL X509_CRL_Error : public Exception
27  {
28  X509_CRL_Error(const std::string& error) :
29  Exception("X509_CRL: " + error) {}
30  };
31 
32  /**
33  * Get the entries of this CRL in the form of a vector.
34  * @return vector containing the entries of this CRL.
35  */
36  std::vector<CRL_Entry> get_revoked() const;
37 
38  /**
39  * Get the issuer DN of this CRL.
40  * @return CRLs issuer DN
41  */
42  X509_DN issuer_dn() const;
43 
44  /**
45  * Get the AuthorityKeyIdentifier of this CRL.
46  * @return this CRLs AuthorityKeyIdentifier
47  */
48  MemoryVector<byte> authority_key_id() const;
49 
50  /**
51  * Get the serial number of this CRL.
52  * @return CRLs serial number
53  */
54  u32bit crl_number() const;
55 
56  /**
57  * Get the CRL's thisUpdate value.
58  * @return CRLs thisUpdate
59  */
60  X509_Time this_update() const;
61 
62  /**
63  * Get the CRL's nextUpdate value.
64  * @return CRLs nextdUpdate
65  */
66  X509_Time next_update() const;
67 
68  /**
69  * Construct a CRL from a data source.
70  * @param source the data source providing the DER or PEM encoded CRL.
71  * @param throw_on_unknown_critical should we throw an exception
72  * if an unknown CRL extension marked as critical is encountered.
73  */
74  X509_CRL(DataSource& source, bool throw_on_unknown_critical = false);
75 
76  /**
77  * Construct a CRL from a file containing the DER or PEM encoded CRL.
78  * @param filename the name of the CRL file
79  * @param throw_on_unknown_critical should we throw an exception
80  * if an unknown CRL extension marked as critical is encountered.
81  */
82  X509_CRL(const std::string& filename,
83  bool throw_on_unknown_critical = false);
84  private:
85  void force_decode();
86 
87  bool throw_on_unknown_critical;
88  std::vector<CRL_Entry> revoked;
89  Data_Store info;
90  };
91 
92 }
93 
94 #endif
X509_CRL_Error(const std::string &error)
Definition: x509_crl.h:28
std::runtime_error Exception
Definition: exceptn.h:19
unsigned int u32bit
Definition: types.h:32