Botan 3.6.1
Crypto and TLS for C&
Botan::OCSP::Request Class Referencefinal

#include <ocsp.h>

Public Member Functions

std::string base64_encode () const
 
std::vector< uint8_t > BER_encode () const
 
const X509_Certificateissuer () const
 
const std::vector< uint8_t > & issuer_key_hash () const
 
 Request (const X509_Certificate &issuer_cert, const BigInt &subject_serial)
 
 Request (const X509_Certificate &issuer_cert, const X509_Certificate &subject_cert)
 
const X509_Certificatesubject () const
 

Detailed Description

An OCSP request.

Definition at line 70 of file ocsp.h.

Constructor & Destructor Documentation

◆ Request() [1/2]

Botan::OCSP::Request::Request ( const X509_Certificate & issuer_cert,
const X509_Certificate & subject_cert )

Create an OCSP request.

Parameters
issuer_certissuer certificate
subject_certsubject certificate

Definition at line 48 of file ocsp.cpp.

48 :
49 m_issuer(issuer_cert), m_certid(m_issuer, BigInt::from_bytes(subject_cert.serial_number())) {
50 if(subject_cert.issuer_dn() != issuer_cert.subject_dn()) {
51 throw Invalid_Argument("Invalid cert pair to OCSP::Request (mismatched issuer,subject args?)");
52 }
53}
static BigInt from_bytes(std::span< const uint8_t > bytes)
Definition bigint.cpp:95

References Botan::X509_Certificate::issuer_dn(), and Botan::X509_Certificate::subject_dn().

◆ Request() [2/2]

Botan::OCSP::Request::Request ( const X509_Certificate & issuer_cert,
const BigInt & subject_serial )

Definition at line 55 of file ocsp.cpp.

55 :
56 m_issuer(issuer_cert), m_certid(m_issuer, subject_serial) {}

Member Function Documentation

◆ base64_encode()

std::string Botan::OCSP::Request::base64_encode ( ) const
Returns
Base64-encoded OCSP request

Definition at line 77 of file ocsp.cpp.

77 {
79}
std::vector< uint8_t > BER_encode() const
Definition ocsp.cpp:58
size_t base64_encode(char out[], const uint8_t in[], size_t input_length, size_t &input_consumed, bool final_inputs)
Definition base64.cpp:160

References Botan::base64_encode(), and BER_encode().

◆ BER_encode()

std::vector< uint8_t > Botan::OCSP::Request::BER_encode ( ) const
Returns
BER-encoded OCSP request

Definition at line 58 of file ocsp.cpp.

58 {
59 std::vector<uint8_t> output;
60 DER_Encoder(output)
61 .start_sequence()
62 .start_sequence()
63 .start_explicit(0)
64 .encode(static_cast<size_t>(0)) // version #
65 .end_explicit()
66 .start_sequence()
67 .start_sequence()
68 .encode(m_certid)
69 .end_cons()
70 .end_cons()
71 .end_cons()
72 .end_cons();
73
74 return output;
75}

References Botan::DER_Encoder::encode(), Botan::DER_Encoder::end_cons(), Botan::DER_Encoder::end_explicit(), Botan::DER_Encoder::start_explicit(), and Botan::DER_Encoder::start_sequence().

Referenced by base64_encode().

◆ issuer()

const X509_Certificate & Botan::OCSP::Request::issuer ( ) const
inline
Returns
issuer certificate

Definition at line 94 of file ocsp.h.

94{ return m_issuer; }

◆ issuer_key_hash()

const std::vector< uint8_t > & Botan::OCSP::Request::issuer_key_hash ( ) const
inline

Definition at line 101 of file ocsp.h.

101{ return m_certid.issuer_key_hash(); }
const std::vector< uint8_t > & issuer_key_hash() const
Definition ocsp.h:37

◆ subject()

const X509_Certificate & Botan::OCSP::Request::subject ( ) const
inline
Returns
subject certificate

Definition at line 99 of file ocsp.h.

99{ throw Not_Implemented("Method have been deprecated"); }

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