Botan  2.1.0
Crypto and TLS for C++11
Public Member Functions | List of all members
Botan::CRL_Entry Class Referencefinal

#include <crl_ent.h>

Inheritance diagram for Botan::CRL_Entry:
Botan::ASN1_Object

Public Member Functions

 CRL_Entry (bool throw_on_unknown_critical_extension=false)
 
 CRL_Entry (const X509_Certificate &cert, CRL_Code reason=UNSPECIFIED)
 
void decode_from (class BER_Decoder &) override
 
void encode_into (class DER_Encoder &) const override
 
X509_Time expire_time () const
 
CRL_Code reason_code () const
 
std::vector< uint8_t > serial_number () const
 

Detailed Description

This class represents CRL entries

Definition at line 40 of file crl_ent.h.

Constructor & Destructor Documentation

Botan::CRL_Entry::CRL_Entry ( bool  throw_on_unknown_critical_extension = false)
explicit

Construct an empty CRL entry.

Parameters
throw_on_unknown_critical_extensionshould we throw an exception if an unknown CRL extension marked as critical is encountered

Definition at line 21 of file crl_ent.cpp.

References Botan::UNSPECIFIED.

21  :
22  m_throw_on_unknown_critical(t_on_unknown_crit)
23  {
24  m_reason = UNSPECIFIED;
25  }
Botan::CRL_Entry::CRL_Entry ( const X509_Certificate cert,
CRL_Code  reason = UNSPECIFIED 
)

Construct an CRL entry.

Parameters
certthe certificate to revoke
reasonthe reason code to set in the entry

Definition at line 30 of file crl_ent.cpp.

References Botan::X509_Certificate::serial_number().

30  :
31  m_throw_on_unknown_critical(false)
32  {
33  m_serial = cert.serial_number();
34  m_time = X509_Time(std::chrono::system_clock::now());
35  m_reason = why;
36  }

Member Function Documentation

void Botan::CRL_Entry::decode_from ( class BER_Decoder from)
overridevirtual

Decode whatever this object is from from

Parameters
fromthe BER_Decoder that will be read from

Implements Botan::ASN1_Object.

Definition at line 81 of file crl_ent.cpp.

References Botan::Extensions::contents_to(), Botan::BER_Decoder::decode(), Botan::BigInt::encode(), Botan::BER_Decoder::end_cons(), Botan::Data_Store::get1_uint32(), Botan::BER_Decoder::more_items(), Botan::SEQUENCE, Botan::BER_Decoder::start_cons(), and Botan::UNSPECIFIED.

82  {
83  BigInt serial_number_bn;
84  m_reason = UNSPECIFIED;
85 
86  BER_Decoder entry = source.start_cons(SEQUENCE);
87 
88  entry.decode(serial_number_bn).decode(m_time);
89 
90  if(entry.more_items())
91  {
92  Extensions extensions(m_throw_on_unknown_critical);
93  entry.decode(extensions);
94  Data_Store info;
95  extensions.contents_to(info, info);
96  m_reason = CRL_Code(info.get1_uint32("X509v3.CRLReasonCode"));
97  }
98 
99  entry.end_cons();
100 
101  m_serial = BigInt::encode(serial_number_bn);
102  }
CRL_Code
Definition: crl_ent.h:20
static std::vector< uint8_t > encode(const BigInt &n, Base base=Binary)
Definition: big_code.cpp:54
void Botan::CRL_Entry::encode_into ( class DER_Encoder to) const
overridevirtual

Encode whatever this object is into to

Parameters
tothe DER_Encoder that will be written to

Implements Botan::ASN1_Object.

Definition at line 63 of file crl_ent.cpp.

References Botan::Extensions::add(), Botan::BigInt::decode(), Botan::DER_Encoder::encode(), Botan::DER_Encoder::end_cons(), Botan::SEQUENCE, and Botan::DER_Encoder::start_cons().

64  {
65  Extensions extensions;
66 
67  extensions.add(new Cert_Extension::CRL_ReasonCode(m_reason));
68 
69  der.start_cons(SEQUENCE)
70  .encode(BigInt::decode(m_serial))
71  .encode(m_time)
72  .start_cons(SEQUENCE)
73  .encode(extensions)
74  .end_cons()
75  .end_cons();
76  }
static BigInt decode(const uint8_t buf[], size_t length, Base base=Binary)
Definition: big_code.cpp:114
X509_Time Botan::CRL_Entry::expire_time ( ) const
inline

Get the revocation date of the certificate associated with this entry

Returns
certificate's revocation date

Definition at line 56 of file crl_ent.h.

Referenced by Botan::operator==().

56 { return m_time; }
CRL_Code Botan::CRL_Entry::reason_code ( ) const
inline

Get the entries reason code

Returns
reason code

Definition at line 62 of file crl_ent.h.

Referenced by Botan::operator==().

62 { return m_reason; }
std::vector<uint8_t> Botan::CRL_Entry::serial_number ( ) const
inline

Get the serial number of the certificate associated with this entry.

Returns
certificate's serial number

Definition at line 50 of file crl_ent.h.

Referenced by Botan::operator==().

50 { return m_serial; }

The documentation for this class was generated from the following files: