Botan 2.19.5 Crypto and TLS for C&

Public Member Functions | Friends | List of all members
Botan::CRL_Entry Class Referencefinal

`#include <x509_crl.h>`

Inheritance diagram for Botan::CRL_Entry:

## Public Member Functions
std::vector< uint8_t > | BER_encode () const
| CRL_Entry ()=default
| 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
const X509_Time & | expire_time () const
const Extensions & | extensions () const
CRL_Code | reason_code () const
const std::vector< uint8_t > & | serial_number () const

## Friends
class | X509_CRL

## Detailed Description

This class represents CRL entries

Definition at line 28 of file x509_crl.h.

## Constructor & Destructor Documentation

## ◆ CRL_Entry() [1/2]

Botan::CRL_Entry::CRL_Entry | ( |  | ) |
| default

Create uninitialized CRL_Entry object

## ◆ CRL_Entry() [2/2]

Botan::CRL_Entry::CRL_Entry | ( | const X509_Certificate & | cert,
|  | CRL_Code | reason = `UNSPECIFIED`
| ) |  |

Construct an CRL entry.

Parameters

  cert | the certificate to revoke
  reason | the reason code to set in the entry

Definition at line 28 of file crl_ent.cpp.

29 {
30 m_data.reset(new CRL_Entry_Data);
31 m_data->m_serial = cert.serial_number();
32 m_data->m_time = X509_Time(std::chrono::system_clock::now());
33 m_data->m_reason = why;
34
35 if(why != UNSPECIFIED)
36 {
37 m_data->m_extensions.add(new Cert_Extension::CRL_ReasonCode(why));
38 }
39 }
Botan::X509_Time
ASN1_Time X509_Time
Definition: asn1_obj.h:386
Botan::UNSPECIFIED
@ UNSPECIFIED
Definition: pkix_enums.h:124

References Botan::X509_Certificate::serial_number(), and Botan::UNSPECIFIED.

## Member Function Documentation

## ◆ BER_encode()

std::vector< uint8_t > Botan::ASN1_Object::BER_encode | ( |  | ) | const
| inherited

Return the encoding of this object. This is a convenience method when just one object needs to be serialized. Use DER_Encoder for complicated encodings.

Definition at line 16 of file asn1_obj.cpp.

17 {
18 std::vector<uint8_t> output;
19 DER_Encoder der(output);
20 this->encode_into(der);
21 return output;
22 }
Botan::ASN1_Object::encode_into
virtual void encode_into(DER_Encoder &to) const =0

References Botan::ASN1_Object::encode_into().

Referenced by Botan::PSSR::config_for_x509(), Botan::Certificate_Store_In_SQL::find_all_certs(), Botan::Certificate_Store_In_SQL::find_cert(), Botan::X509_Certificate::fingerprint(), Botan::Certificate_Store_In_SQL::insert_cert(), Botan::X509_Object::PEM_encode(), and Botan::Certificate_Store_In_SQL::revoke_cert().

## ◆ decode_from()

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

Decode whatever this object is from from

Parameters

  from | the BER_Decoder that will be read from

Implements Botan::ASN1_Object.

Definition at line 80 of file crl_ent.cpp.

81 {
82 BigInt serial_number_bn;
83
84 std::unique_ptr<CRL_Entry_Data> data(new CRL_Entry_Data);
85
86 BER_Decoder entry = source.start_cons(SEQUENCE);
87
88 entry.decode(serial_number_bn).decode(data->m_time);
89 data->m_serial = BigInt::encode(serial_number_bn);
90
91 if(entry.more_items())
92 {
93 entry.decode(data->m_extensions);
94 if(auto ext = data->m_extensions.get_extension_object_as<Cert_Extension::CRL_ReasonCode>())
95 {
96 data->m_reason = ext->get_reason();
97 }
98 else
99 {
100 data->m_reason = UNSPECIFIED;
101 }
102 }
103
104 entry.end_cons();
105
106 m_data.reset(data.release());
107 }
Botan::BigInt::encode
static std::vector< uint8_t > encode(const BigInt &n)
Definition: bigint.h:782
Botan::SEQUENCE
@ SEQUENCE
Definition: asn1_obj.h:42

References Botan::BER_Decoder::decode(), Botan::BigInt::encode(), Botan::BER_Decoder::end_cons(), 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
| override virtual

Encode whatever this object is into to

Parameters

  to | the DER_Encoder that will be written to

Implements Botan::ASN1_Object.

Definition at line 66 of file crl_ent.cpp.

67 {
68 der.start_cons(SEQUENCE)
69 .encode(BigInt::decode(serial_number()))
70 .encode(expire_time())
71 .start_cons(SEQUENCE)
72 .encode(extensions())
73 .end_cons()
74 .end_cons();
75 }
Botan::BigInt::decode
static BigInt decode(const uint8_t buf[], size_t length)
Definition: bigint.h:817
Botan::CRL_Entry::expire_time
const X509_Time & expire_time() const
Definition: crl_ent.cpp:124
Botan::CRL_Entry::serial_number
const std::vector< uint8_t > & serial_number() const
Definition: crl_ent.cpp:119
Botan::CRL_Entry::extensions
const Extensions & extensions() const
Definition: crl_ent.cpp:134

References Botan::BigInt::decode(), Botan::DER_Encoder::encode(), Botan::DER_Encoder::end_cons(), expire_time(), extensions(), Botan::SEQUENCE, serial_number(), and Botan::DER_Encoder::start_cons().

## ◆ expire_time()

const X509_Time & Botan::CRL_Entry::expire_time | ( |  | ) | const

Get the revocation date of the certificate associated with this entry

Returns
  certificate's revocation date

Definition at line 124 of file crl_ent.cpp.

125 {
126 return data().m_time;
127 }

Referenced by encode_into(), and Botan::operator==().

## ◆ extensions()

const Extensions & Botan::CRL_Entry::extensions | ( |  | ) | const

Get the extensions on this CRL entry

Definition at line 134 of file crl_ent.cpp.

135 {
136 return data().m_extensions;
137 }

Referenced by encode_into().

## ◆ reason_code()

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

Get the entries reason code

Returns
  reason code

Definition at line 129 of file crl_ent.cpp.

130 {
131 return data().m_reason;
132 }

Referenced by Botan::operator==().

## ◆ serial_number()

const std::vector< uint8_t > & Botan::CRL_Entry::serial_number | ( |  | ) | const

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

Returns
  certificate's serial number

Definition at line 119 of file crl_ent.cpp.

120 {
121 return data().m_serial;
122 }

Referenced by encode_into(), and Botan::operator==().

## Friends And Related Function Documentation

## ◆ X509_CRL

friend class X509_CRL
| friend

Definition at line 71 of file x509_crl.h.

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

- src/lib/x509/x509_crl.h
- src/lib/x509/crl_ent.cpp