8#include <botan/asn1_obj.h>
10#include <botan/data_src.h>
11#include <botan/der_enc.h>
12#include <botan/mem_ops.h>
13#include <botan/internal/fmt.h>
14#include <botan/internal/stl_util.h>
20 std::vector<uint8_t> output;
30 if(this->
is_a(expected_type_tag, expected_class_tag) ==
false) {
31 std::stringstream msg;
33 msg <<
"Tag mismatch when decoding " << descr <<
" got ";
41 msg << std::to_string(static_cast<uint32_t>(m_type_tag));
52 msg << std::to_string(static_cast<uint32_t>(expected_type_tag));
62 return (m_type_tag == expected_type_tag && m_class_tag == expected_class_tag);
66 return is_a(
ASN1_Type(expected_type_tag), expected_class_tag);
81 return "CONTEXT_SPECIFIC";
89 return "CLASS(" + std::to_string(
static_cast<size_t>(type)) +
")";
102 return "PRINTABLE STRING";
105 return "NUMERIC STRING";
114 return "UTF8 STRING";
117 return "VISIBLE STRING";
123 return "UNIVERSAL STRING";
129 return "GENERALIZED TIME";
132 return "OCTET STRING";
156 return "TAG(" + std::to_string(
static_cast<uint32_t
>(type)) +
")";
177 std::vector<uint8_t> output;
200 if(first_u8 == cons_seq) {
#define BOTAN_ASSERT_EQUAL(expr1, expr2, assertion_made)
virtual void encode_into(DER_Encoder &to) const =0
std::vector< uint8_t > BER_encode() const
BER_Bad_Tag(std::string_view msg, uint32_t tagging)
BER_Decoding_Error(std::string_view)
const uint8_t * bits() const
bool is_a(ASN1_Type type_tag, ASN1_Class class_tag) const
ASN1_Type type_tag() const
void assert_is_a(ASN1_Type type_tag, ASN1_Class class_tag, std::string_view descr="object") const
ASN1_Class class_tag() const
DER_Encoder & start_sequence()
DER_Encoder & raw_bytes(const uint8_t val[], size_t len)
size_t peek_byte(uint8_t &out) const
size_t read_byte(uint8_t &out)
std::vector< uint8_t > put_in_sequence(const std::vector< uint8_t > &contents)
bool maybe_BER(DataSource &source)
std::string to_string(const BER_Object &obj)
std::string asn1_tag_to_string(ASN1_Type type)
std::string fmt(std::string_view format, const T &... args)
std::string asn1_class_to_string(ASN1_Class type)
const char * cast_uint8_ptr_to_char(const uint8_t *b)