Botan  1.10.9
Public Member Functions | List of all members
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

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.

References Botan::UNSPECIFIED.

21  :
22  throw_on_unknown_critical(t_on_unknown_crit)
23  {
24  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(), and Botan::system_time().

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

Member Function Documentation

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.

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.

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
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.

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(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
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.

Referenced by Botan::operator==().

34 { return time; }
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.

Referenced by Botan::operator==().

40 { return reason; }
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.

Referenced by Botan::operator==().

28 { return serial; }

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