8#include <botan/asn1_obj.h>
9#include <botan/der_enc.h>
10#include <botan/data_src.h>
11#include <botan/internal/stl_util.h>
12#include <botan/internal/fmt.h>
19 std::vector<uint8_t> output;
29 std::string_view descr)
const
31 if(this->
is_a(expected_type_tag, expected_class_tag) ==
false)
33 std::stringstream msg;
35 msg <<
"Tag mismatch when decoding " << descr <<
" got ";
49 msg << std::to_string(static_cast<uint32_t>(m_type_tag));
63 msg << std::to_string(static_cast<uint32_t>(expected_type_tag));
74 return (m_type_tag == expected_type_tag && m_class_tag == expected_class_tag);
79 return is_a(
ASN1_Type(expected_type_tag), expected_class_tag);
97 return "CONTEXT_SPECIFIC";
105 return "CLASS(" + std::to_string(
static_cast<size_t>(type)) +
")";
120 return "PRINTABLE STRING";
123 return "NUMERIC STRING";
132 return "UTF8 STRING";
135 return "VISIBLE STRING";
141 return "UNIVERSAL STRING";
147 return "GENERALIZED TIME";
150 return "OCTET STRING";
174 return "TAG(" + std::to_string(
static_cast<uint32_t
>(type)) +
")";
199 std::vector<uint8_t> output;
229 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)