Botan 1.10.17
Botan::CRL_Entry Class Reference

#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 &)
void encode_into (class DER_Encoder &) const
X509_Time expire_time () const
CRL_Code reason_code () const
MemoryVector< byteserial_number () const

Detailed Description

This class represents CRL entries

Definition at line 18 of file crl_ent.h.

Constructor & Destructor Documentation

◆ CRL_Entry() [1/2]

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

Construct an empty CRL entry.

Definition at line 21 of file crl_ent.cpp.

21 :
22 throw_on_unknown_critical(t_on_unknown_crit)
23 {
24 reason = UNSPECIFIED;
25 }
@ UNSPECIFIED

References Botan::UNSPECIFIED.

◆ CRL_Entry() [2/2]

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.

30 :
31 throw_on_unknown_critical(false)
32 {
33 serial = cert.serial_number();
34 time = X509_Time(system_time());
35 reason = why;
36 }
X509_Time(u64bit)
Definition asn1_tm.cpp:28
u64bit system_time()
Definition time.cpp:73

References Botan::X509_Certificate::serial_number(), Botan::system_time(), and Botan::X509_Time::X509_Time().

Member Function Documentation

◆ decode_from()

void Botan::CRL_Entry::decode_from ( class BER_Decoder & from)
virtual

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.

82 {
83 BigInt serial_number_bn;
84 reason = UNSPECIFIED;
85
86 BER_Decoder entry = source.start_cons(SEQUENCE);
87
88 entry.decode(serial_number_bn).decode(time);
89
90 if(entry.more_items())
91 {
92 Extensions extensions(throw_on_unknown_critical);
93 entry.decode(extensions);
94 Data_Store info;
95 extensions.contents_to(info, info);
96 reason = CRL_Code(info.get1_u32bit("X509v3.CRLReasonCode"));
97 }
98
99 entry.end_cons();
100
101 serial = BigInt::encode(serial_number_bn);
102 }
static SecureVector< byte > encode(const BigInt &n, Base base=Binary)
Definition big_code.cpp:64
@ SEQUENCE
Definition asn1_int.h:35

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

◆ encode_into()

void Botan::CRL_Entry::encode_into ( class DER_Encoder & to) const
virtual

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.

64 {
65 Extensions extensions;
66
67 extensions.add(new Cert_Extension::CRL_ReasonCode(reason));
68
69 der.start_cons(SEQUENCE)
70 .encode(BigInt::decode(serial))
71 .encode(time)
72 .start_cons(SEQUENCE)
73 .encode(extensions)
74 .end_cons()
75 .end_cons();
76 }
static BigInt decode(const byte buf[], size_t length, Base base=Binary)
Definition big_code.cpp:102

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

◆ expire_time()

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 34 of file crl_ent.h.

34{ return time; }

Referenced by Botan::operator==().

◆ reason_code()

CRL_Code Botan::CRL_Entry::reason_code ( ) const
inline

Get the entries reason code

Returns
reason code

Definition at line 40 of file crl_ent.h.

40{ return reason; }

Referenced by Botan::operator==().

◆ serial_number()

MemoryVector< byte > 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 28 of file crl_ent.h.

28{ return serial; }

Referenced by Botan::operator==().


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