Botan  2.4.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 Extensions;
16 class X509_Certificate;
17 struct CRL_Entry_Data;
18 
19 /**
20 * X.509v2 CRL Reason Code.
21 */
22 enum CRL_Code : uint32_t {
33 
34  DELETE_CRL_ENTRY = 0xFF00,
35  OCSP_GOOD = 0xFF01,
36  OCSP_UNKNOWN = 0xFF02
37 };
38 
39 /**
40 * This class represents CRL entries
41 */
42 class BOTAN_PUBLIC_API(2,0) CRL_Entry final : public ASN1_Object
43  {
44  public:
45  void encode_into(class DER_Encoder&) const override;
46  void decode_from(class BER_Decoder&) override;
47 
48  /**
49  * Get the serial number of the certificate associated with this entry.
50  * @return certificate's serial number
51  */
52  const std::vector<uint8_t>& serial_number() const;
53 
54  /**
55  * Get the revocation date of the certificate associated with this entry
56  * @return certificate's revocation date
57  */
58  const X509_Time& expire_time() const;
59 
60  /**
61  * Get the entries reason code
62  * @return reason code
63  */
64  CRL_Code reason_code() const;
65 
66  /**
67  * Get the extensions on this CRL entry
68  */
69  const Extensions& extensions() const;
70 
71  /**
72  * Create uninitialized CRL_Entry object
73  */
74  CRL_Entry() = default;
75 
76  /**
77  * Construct an CRL entry.
78  * @param cert the certificate to revoke
79  * @param reason the reason code to set in the entry
80  */
81  CRL_Entry(const X509_Certificate& cert,
82  CRL_Code reason = UNSPECIFIED);
83 
84  private:
85  friend class X509_CRL;
86 
87  const CRL_Entry_Data& data() const;
88 
89  std::shared_ptr<CRL_Entry_Data> m_data;
90  };
91 
92 /**
93 * Test two CRL entries for equality in all fields.
94 */
95 BOTAN_PUBLIC_API(2,0) bool operator==(const CRL_Entry&, const CRL_Entry&);
96 
97 /**
98 * Test two CRL entries for inequality in at least one field.
99 */
100 BOTAN_PUBLIC_API(2,0) bool operator!=(const CRL_Entry&, const CRL_Entry&);
101 
102 }
103 
104 #endif
CRL_Code
Definition: crl_ent.h:22
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:27
Definition: alg_id.cpp:13
Definition: crl_ent.h:42