Botan  2.1.0
Crypto and TLS for C++11
crl_ent.h
Go to the documentation of this file.
1 /*
2 * CRL Entry
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7 
8 #ifndef BOTAN_CRL_ENTRY_H__
9 #define BOTAN_CRL_ENTRY_H__
10 
11 #include <botan/asn1_time.h>
12 
13 namespace Botan {
14 
15 class X509_Certificate;
16 
17 /**
18 * X.509v2 CRL Reason Code.
19 */
20 enum CRL_Code {
31 
32  DELETE_CRL_ENTRY = 0xFF00,
33  OCSP_GOOD = 0xFF01,
34  OCSP_UNKNOWN = 0xFF02
35 };
36 
37 /**
38 * This class represents CRL entries
39 */
40 class BOTAN_DLL CRL_Entry final : public ASN1_Object
41  {
42  public:
43  void encode_into(class DER_Encoder&) const override;
44  void decode_from(class BER_Decoder&) override;
45 
46  /**
47  * Get the serial number of the certificate associated with this entry.
48  * @return certificate's serial number
49  */
50  std::vector<uint8_t> serial_number() const { return m_serial; }
51 
52  /**
53  * Get the revocation date of the certificate associated with this entry
54  * @return certificate's revocation date
55  */
56  X509_Time expire_time() const { return m_time; }
57 
58  /**
59  * Get the entries reason code
60  * @return reason code
61  */
62  CRL_Code reason_code() const { return m_reason; }
63 
64  /**
65  * Construct an empty CRL entry.
66  * @param throw_on_unknown_critical_extension should we throw an exception
67  * if an unknown CRL extension marked as critical is encountered
68  */
69  explicit CRL_Entry(bool throw_on_unknown_critical_extension = false);
70 
71  /**
72  * Construct an CRL entry.
73  * @param cert the certificate to revoke
74  * @param reason the reason code to set in the entry
75  */
76  CRL_Entry(const X509_Certificate& cert,
77  CRL_Code reason = UNSPECIFIED);
78 
79  private:
80  bool m_throw_on_unknown_critical;
81  std::vector<uint8_t> m_serial;
82  X509_Time m_time;
83  CRL_Code m_reason;
84  };
85 
86 /**
87 * Test two CRL entries for equality in all fields.
88 */
89 BOTAN_DLL bool operator==(const CRL_Entry&, const CRL_Entry&);
90 
91 /**
92 * Test two CRL entries for inequality in at least one field.
93 */
94 BOTAN_DLL bool operator!=(const CRL_Entry&, const CRL_Entry&);
95 
96 }
97 
98 #endif
bool operator!=(const AlgorithmIdentifier &a1, const AlgorithmIdentifier &a2)
Definition: alg_id.cpp:82
bool operator==(const AlgorithmIdentifier &a1, const AlgorithmIdentifier &a2)
Definition: alg_id.cpp:67
std::vector< uint8_t > serial_number() const
Definition: crl_ent.h:50
Definition: alg_id.cpp:13
Definition: crl_ent.h:40
X509_Time expire_time() const
Definition: crl_ent.h:56
CRL_Code
Definition: crl_ent.h:20
CRL_Code reason_code() const
Definition: crl_ent.h:62