11#include <botan/tls_extensions.h>
13#include <botan/tls_exceptn.h>
14#include <botan/tls_messages.h>
15#include <botan/internal/tls_reader.h>
20class RFC6066_Empty_Certificate_Status_Request {
22 RFC6066_Empty_Certificate_Status_Request() =
default;
24 RFC6066_Empty_Certificate_Status_Request(uint16_t extension_size) {
25 if(extension_size != 0) {
26 throw Decoding_Error(
"Received an unexpectedly non-empty Certificate_Status_Request");
30 std::vector<uint8_t> serialize()
const {
return {}; }
33class RFC6066_Certificate_Status_Request {
35 RFC6066_Certificate_Status_Request(std::vector<uint8_t> names, std::vector<std::vector<uint8_t>> keys) :
38 RFC6066_Certificate_Status_Request(TLS_Data_Reader& reader, uint16_t extension_size) {
39 if(extension_size == 0) {
40 throw Decoding_Error(
"Received an unexpectedly empty Certificate_Status_Request");
43 const uint8_t type = reader.get_byte();
45 const size_t len_resp_id_list = reader.get_uint16_t();
46 ocsp_names = reader.get_fixed<uint8_t>(len_resp_id_list);
47 const size_t len_requ_ext = reader.get_uint16_t();
52 reader.discard_next(extension_size - 1);
56 std::vector<uint8_t> serialize()
const {
75class Certificate_Status_Request_Internal {
78 std::variant<RFC6066_Empty_Certificate_Status_Request, RFC6066_Certificate_Status_Request, Certificate_Status>;
81 Certificate_Status_Request_Internal(Contents c) : content(std::move(c)) {}
87 uint16_t extension_size,
109 m_impl = std::make_unique<Certificate_Status_Request_Internal>(
110 RFC6066_Certificate_Status_Request(reader, extension_size));
123 m_impl = std::make_unique<Certificate_Status_Request_Internal>(
124 RFC6066_Empty_Certificate_Status_Request(extension_size));
139 m_impl = std::make_unique<Certificate_Status_Request_Internal>(
146 "Server sent a Certificate_Status_Request extension in an unsupported context");
151 m_impl(std::make_unique<Certificate_Status_Request_Internal>(RFC6066_Empty_Certificate_Status_Request())) {}
154 std::vector<std::vector<uint8_t>> ocsp_key_ids) :
155 m_impl(std::make_unique<Certificate_Status_Request_Internal>(
156 RFC6066_Certificate_Status_Request(std::move(ocsp_responder_ids), std::move(ocsp_key_ids)))) {}
159 m_impl(std::make_unique<Certificate_Status_Request_Internal>(
Certificate_Status(std::move(response)))) {}
166 return std::get<Certificate_Status>(m_impl->content).response();
171 return std::visit([](
const auto& c) {
return c.serialize(); }, m_impl->content);
#define BOTAN_STATE_CHECK(expr)
#define BOTAN_ASSERT_NONNULL(ptr)
~Certificate_Status_Request() override
Certificate_Status_Request()
const std::vector< uint8_t > & get_ocsp_response() const
std::vector< uint8_t > serialize(Connection_Side whoami) const override
std::vector< T > get_fixed(size_t size)
std::vector< std::vector< uint8_t > > ocsp_keys
std::vector< uint8_t > ocsp_names
std::vector< uint8_t > extension_bytes