Botan 2.19.1
Crypto and TLS for C&
|
#include <ber_dec.h>
Public Member Functions | |
BER_Decoder (BER_Object &&obj) | |
BER_Decoder (const BER_Decoder &other) | |
BER_Decoder (const BER_Object &obj) | |
BER_Decoder (const secure_vector< uint8_t > &vec) | |
BER_Decoder (const std::vector< uint8_t > &vec) | |
BER_Decoder (const uint8_t buf[], size_t len) | |
BER_Decoder (DataSource &src) | |
BER_Decoder & | decode (BigInt &out) |
BER_Decoder & | decode (BigInt &v, ASN1_Tag type_tag, ASN1_Tag class_tag=CONTEXT_SPECIFIC) |
BER_Decoder & | decode (bool &out) |
BER_Decoder & | decode (bool &v, ASN1_Tag type_tag, ASN1_Tag class_tag=CONTEXT_SPECIFIC) |
BER_Decoder & | decode (class ASN1_Object &obj, ASN1_Tag type_tag=NO_OBJECT, ASN1_Tag class_tag=NO_OBJECT) |
BER_Decoder & | decode (secure_vector< uint8_t > &v, ASN1_Tag real_type, ASN1_Tag type_tag, ASN1_Tag class_tag=CONTEXT_SPECIFIC) |
BER_Decoder & | decode (size_t &out) |
BER_Decoder & | decode (size_t &v, ASN1_Tag type_tag, ASN1_Tag class_tag=CONTEXT_SPECIFIC) |
BER_Decoder & | decode (std::vector< uint8_t > &v, ASN1_Tag real_type, ASN1_Tag type_tag, ASN1_Tag class_tag=CONTEXT_SPECIFIC) |
template<typename Alloc > | |
BER_Decoder & | decode (std::vector< uint8_t, Alloc > &out, ASN1_Tag real_type) |
template<typename T > | |
BER_Decoder & | decode_and_check (const T &expected, const std::string &error_msg) |
uint64_t | decode_constrained_integer (ASN1_Tag type_tag, ASN1_Tag class_tag, size_t T_bytes) |
template<typename T > | |
BER_Decoder & | decode_integer_type (T &out) |
template<typename T > | |
BER_Decoder & | decode_integer_type (T &out, ASN1_Tag type_tag, ASN1_Tag class_tag=CONTEXT_SPECIFIC) |
template<typename T > | |
BER_Decoder & | decode_list (std::vector< T > &out, ASN1_Tag type_tag=SEQUENCE, ASN1_Tag class_tag=UNIVERSAL) |
BER_Decoder & | decode_null () |
BER_Decoder & | decode_octet_string_bigint (BigInt &b) |
template<typename T > | |
BER_Decoder & | decode_optional (T &out, ASN1_Tag type_tag, ASN1_Tag class_tag, const T &default_value=T()) |
template<typename T > | |
BER_Decoder & | decode_optional_implicit (T &out, ASN1_Tag type_tag, ASN1_Tag class_tag, ASN1_Tag real_type, ASN1_Tag real_class, const T &default_value=T()) |
template<typename Alloc > | |
BER_Decoder & | decode_optional_string (std::vector< uint8_t, Alloc > &out, ASN1_Tag real_type, uint16_t type_no, ASN1_Tag class_tag=CONTEXT_SPECIFIC) |
BER_Decoder & | discard_remaining () |
BER_Decoder & | end_cons () |
BER_Decoder & | get_next (BER_Object &ber) |
BER_Object | get_next_object () |
std::vector< uint8_t > | get_next_octet_string () |
template<typename T > | |
BER_Decoder & | get_next_value (T &out, ASN1_Tag type_tag, ASN1_Tag class_tag=CONTEXT_SPECIFIC) |
bool | more_items () const |
BER_Decoder & | operator= (const BER_Decoder &)=delete |
void | push_back (BER_Object &&obj) |
void | push_back (const BER_Object &obj) |
template<typename Alloc > | |
BER_Decoder & | raw_bytes (std::vector< uint8_t, Alloc > &out) |
BER_Decoder | start_cons (ASN1_Tag type_tag, ASN1_Tag class_tag=UNIVERSAL) |
BER_Decoder & | verify_end () |
BER_Decoder & | verify_end (const std::string &err_msg) |
Botan::BER_Decoder::BER_Decoder | ( | const uint8_t | buf[], |
size_t | len | ||
) |
Set up to BER decode the data in buf of length len
Definition at line 327 of file ber_dec.cpp.
Referenced by decode_optional(), and start_cons().
|
explicit |
Set up to BER decode the data in vec
Definition at line 336 of file ber_dec.cpp.
|
explicit |
Set up to BER decode the data in vec
Definition at line 345 of file ber_dec.cpp.
|
explicit |
Set up to BER decode the data in src
Definition at line 319 of file ber_dec.cpp.
|
inline |
Set up to BER decode the data in obj
Definition at line 47 of file ber_dec.h.
|
inline |
Botan::BER_Decoder::BER_Decoder | ( | const BER_Decoder & | other | ) |
Definition at line 354 of file ber_dec.cpp.
|
inline |
Definition at line 186 of file ber_dec.h.
References Botan::PEM_Code::decode(), Botan::INTEGER, and Botan::UNIVERSAL.
BER_Decoder & Botan::BER_Decoder::decode | ( | BigInt & | v, |
ASN1_Tag | type_tag, | ||
ASN1_Tag | class_tag = CONTEXT_SPECIFIC |
||
) |
Definition at line 458 of file ber_dec.cpp.
References Botan::BER_Object::assert_is_a(), Botan::BER_Object::bits(), Botan::BigInt::flip_sign(), get_next_object(), and Botan::BER_Object::length().
|
inline |
Decode a BER encoded BOOLEAN
Definition at line 170 of file ber_dec.h.
References Botan::BOOLEAN, Botan::PEM_Code::decode(), and Botan::UNIVERSAL.
Referenced by Botan::PK_Verifier::check_signature(), Botan::Curve25519_PrivateKey::Curve25519_PrivateKey(), decode(), decode_constrained_integer(), Botan::X509_DN::decode_from(), Botan::AlternativeName::decode_from(), Botan::GeneralSubtree::decode_from(), Botan::Attribute::decode_from(), Botan::AlgorithmIdentifier::decode_from(), Botan::Extensions::decode_from(), Botan::CRL_Entry::decode_from(), Botan::OCSP::CertID::decode_from(), Botan::OCSP::SingleResponse::decode_from(), Botan::X509_Object::decode_from(), decode_list(), decode_octet_string_bigint(), decode_optional(), decode_optional_implicit(), decode_optional_string(), Botan::DL_Scheme_PrivateKey::DL_Scheme_PrivateKey(), Botan::Ed25519_PrivateKey::Ed25519_PrivateKey(), Botan::GOST_3410_PublicKey::GOST_3410_PublicKey(), Botan::X509::load_key(), Botan::McEliece_PrivateKey::McEliece_PrivateKey(), Botan::McEliece_PublicKey::McEliece_PublicKey(), Botan::pbes2_decrypt(), Botan::OCSP::Response::Response(), Botan::RSA_PublicKey::RSA_PublicKey(), and Botan::TLS::Session::Session().
BER_Decoder & Botan::BER_Decoder::decode | ( | bool & | v, |
ASN1_Tag | type_tag, | ||
ASN1_Tag | class_tag = CONTEXT_SPECIFIC |
||
) |
Definition at line 396 of file ber_dec.cpp.
References Botan::BER_Object::assert_is_a(), Botan::BER_Object::bits(), get_next_object(), and Botan::BER_Object::length().
BER_Decoder & Botan::BER_Decoder::decode | ( | class ASN1_Object & | obj, |
ASN1_Tag | type_tag = NO_OBJECT , |
||
ASN1_Tag | class_tag = NO_OBJECT |
||
) |
Definition at line 366 of file ber_dec.cpp.
References Botan::ASN1_Object::decode_from().
BER_Decoder & Botan::BER_Decoder::decode | ( | secure_vector< uint8_t > & | v, |
ASN1_Tag | real_type, | ||
ASN1_Tag | type_tag, | ||
ASN1_Tag | class_tag = CONTEXT_SPECIFIC |
||
) |
Definition at line 527 of file ber_dec.cpp.
References Botan::BIT_STRING, get_next_object(), and Botan::OCTET_STRING.
|
inline |
Definition at line 178 of file ber_dec.h.
References Botan::PEM_Code::decode(), Botan::INTEGER, and Botan::UNIVERSAL.
BER_Decoder & Botan::BER_Decoder::decode | ( | size_t & | v, |
ASN1_Tag | type_tag, | ||
ASN1_Tag | class_tag = CONTEXT_SPECIFIC |
||
) |
Definition at line 412 of file ber_dec.cpp.
References Botan::BigInt::bits(), Botan::BigInt::byte_at(), decode(), and Botan::BigInt::is_negative().
BER_Decoder & Botan::BER_Decoder::decode | ( | std::vector< uint8_t > & | v, |
ASN1_Tag | real_type, | ||
ASN1_Tag | type_tag, | ||
ASN1_Tag | class_tag = CONTEXT_SPECIFIC |
||
) |
Definition at line 538 of file ber_dec.cpp.
References Botan::BIT_STRING, get_next_object(), and Botan::OCTET_STRING.
|
inline |
Definition at line 202 of file ber_dec.h.
References Botan::PEM_Code::decode(), and Botan::UNIVERSAL.
|
inline |
Definition at line 277 of file ber_dec.h.
References Botan::PEM_Code::decode(), and T.
Referenced by Botan::EC_PrivateKey::EC_PrivateKey(), Botan::OCSP::Response::Response(), Botan::RSA_PrivateKey::RSA_PrivateKey(), and Botan::TLS::Session::Session().
uint64_t Botan::BER_Decoder::decode_constrained_integer | ( | ASN1_Tag | type_tag, |
ASN1_Tag | class_tag, | ||
size_t | T_bytes | ||
) |
Definition at line 435 of file ber_dec.cpp.
References Botan::BigInt::bits(), Botan::BigInt::byte_at(), and decode().
|
inline |
Definition at line 242 of file ber_dec.h.
References Botan::INTEGER, and Botan::UNIVERSAL.
Referenced by Botan::TLS::Session::Session().
|
inline |
Definition at line 248 of file ber_dec.h.
References T.
BER_Decoder & Botan::BER_Decoder::decode_list | ( | std::vector< T > & | out, |
ASN1_Tag | type_tag = SEQUENCE , |
||
ASN1_Tag | class_tag = UNIVERSAL |
||
) |
Definition at line 398 of file ber_dec.h.
References decode(), end_cons(), more_items(), push_back(), start_cons(), and T.
Referenced by Botan::OCSP::Response::Response().
BER_Decoder & Botan::BER_Decoder::decode_null | ( | ) |
Definition at line 376 of file ber_dec.cpp.
References Botan::BER_Object::assert_is_a(), get_next_object(), Botan::BER_Object::length(), Botan::NULL_TAG, and Botan::UNIVERSAL.
BER_Decoder & Botan::BER_Decoder::decode_octet_string_bigint | ( | BigInt & | b | ) |
Decode an integer value which is typed as an octet string
Definition at line 385 of file ber_dec.cpp.
References decode(), Botan::BigInt::decode(), and Botan::OCTET_STRING.
BER_Decoder & Botan::BER_Decoder::decode_optional | ( | T & | out, |
ASN1_Tag | type_tag, | ||
ASN1_Tag | class_tag, | ||
const T & | default_value = T() |
||
) |
Definition at line 337 of file ber_dec.h.
References BER_Decoder(), Botan::CONSTRUCTED, Botan::CONTEXT_SPECIFIC, decode(), get_next_object(), Botan::BER_Object::is_a(), and push_back().
Referenced by Botan::GeneralSubtree::decode_from(), Botan::Extensions::decode_from(), Botan::OCSP::SingleResponse::decode_from(), Botan::EC_PrivateKey::EC_PrivateKey(), and Botan::OCSP::Response::Response().
BER_Decoder & Botan::BER_Decoder::decode_optional_implicit | ( | T & | out, |
ASN1_Tag | type_tag, | ||
ASN1_Tag | class_tag, | ||
ASN1_Tag | real_type, | ||
ASN1_Tag | real_class, | ||
const T & | default_value = T() |
||
) |
Definition at line 369 of file ber_dec.h.
References decode(), get_next_object(), Botan::BER_Object::is_a(), and push_back().
Referenced by Botan::Cert_Extension::CRL_Distribution_Points::Distribution_Point::decode_from().
|
inline |
Definition at line 293 of file ber_dec.h.
References Botan::CONSTRUCTED, Botan::CONTEXT_SPECIFIC, decode(), Botan::PEM_Code::decode(), Botan::BER_Object::is_a(), and verify_end().
Referenced by Botan::OCSP::Response::Response().
BER_Decoder & Botan::BER_Decoder::discard_remaining | ( | ) |
Discard any data that remains unread Returns (*this)
Definition at line 226 of file ber_dec.cpp.
References Botan::DataSource::read_byte().
Referenced by Botan::Curve25519_PrivateKey::Curve25519_PrivateKey(), and Botan::Ed25519_PrivateKey::Ed25519_PrivateKey().
BER_Decoder & Botan::BER_Decoder::end_cons | ( | ) |
Finish decoding a constructed data, throws if any data remains. Returns the parent of *this (ie the object on which start_cons was called).
Definition at line 300 of file ber_dec.cpp.
References Botan::DataSource::end_of_data().
Referenced by Botan::X509_DN::decode_from(), Botan::GeneralSubtree::decode_from(), Botan::Attribute::decode_from(), Botan::AlgorithmIdentifier::decode_from(), Botan::Extensions::decode_from(), Botan::CRL_Entry::decode_from(), Botan::Cert_Extension::CRL_Distribution_Points::Distribution_Point::decode_from(), Botan::OCSP::CertID::decode_from(), Botan::OCSP::SingleResponse::decode_from(), Botan::X509_Object::decode_from(), decode_list(), Botan::EC_PrivateKey::EC_PrivateKey(), Botan::X509::load_key(), Botan::McEliece_PrivateKey::McEliece_PrivateKey(), Botan::McEliece_PublicKey::McEliece_PublicKey(), Botan::pbes2_decrypt(), Botan::OCSP::Response::Response(), Botan::RSA_PublicKey::RSA_PublicKey(), and Botan::TLS::Session::Session().
|
inline |
Definition at line 66 of file ber_dec.h.
Referenced by Botan::OCSP::SingleResponse::decode_from().
BER_Object Botan::BER_Decoder::get_next_object | ( | ) |
Get the next object in the data stream. If EOF, returns an object with type NO_OBJECT.
Definition at line 237 of file ber_dec.cpp.
References Botan::DataSource::check_available(), Botan::EOC, Botan::BER_Object::is_set(), Botan::DataSource::read(), and Botan::BER_Object::tagging().
Referenced by decode(), Botan::ASN1_Time::decode_from(), Botan::AlternativeName::decode_from(), Botan::GeneralName::decode_from(), Botan::OID::decode_from(), Botan::ASN1_String::decode_from(), decode_null(), decode_optional(), decode_optional_implicit(), and start_cons().
|
inline |
Definition at line 191 of file ber_dec.h.
References Botan::PEM_Code::decode(), and Botan::OCTET_STRING.
Referenced by Botan::OCSP::Response::Response().
|
inline |
Get next object and copy value to POD type Asserts value length is equal to POD type sizeof. Asserts Type tag and optional Class tag according to parameters. Copy value to POD type (struct, union, C-style array, std::array, etc.).
out | POD type reference where to copy object value |
type_tag | ASN1_Tag enum to assert type on object read |
class_tag | ASN1_Tag enum to assert class on object read (default: CONTEXT_SPECIFIC) |
Definition at line 131 of file ber_dec.h.
References Botan::BER_Object::assert_is_a(), Botan::BER_Object::bits(), Botan::copy_mem(), Botan::BER_Object::length(), T, and Botan::ASN1::to_string().
bool Botan::BER_Decoder::more_items | ( | ) | const |
Return true if there is at least one more item remaining
Definition at line 198 of file ber_dec.cpp.
References Botan::DataSource::end_of_data(), and Botan::BER_Object::is_set().
Referenced by Botan::PK_Verifier::check_signature(), Botan::X509_DN::decode_from(), Botan::AlternativeName::decode_from(), Botan::Extensions::decode_from(), Botan::CRL_Entry::decode_from(), decode_list(), and Botan::OCSP::Response::Response().
|
delete |
void Botan::BER_Decoder::push_back | ( | BER_Object && | obj | ) |
Push an object back onto the stream. Throws if another object was previously pushed and has not been subsequently read out.
Definition at line 283 of file ber_dec.cpp.
References Botan::BER_Object::is_set().
void Botan::BER_Decoder::push_back | ( | const BER_Object & | obj | ) |
Push an object back onto the stream. Throws if another object was previously pushed and has not been subsequently read out.
Definition at line 276 of file ber_dec.cpp.
References Botan::BER_Object::is_set().
Referenced by decode_list(), decode_optional(), decode_optional_implicit(), Botan::McEliece_PrivateKey::McEliece_PrivateKey(), and raw_bytes().
|
inline |
Definition at line 156 of file ber_dec.h.
References push_back().
Referenced by Botan::X509_DN::decode_from(), Botan::Attribute::decode_from(), Botan::AlgorithmIdentifier::decode_from(), Botan::X509_Object::decode_from(), and Botan::OCSP::Response::Response().
BER_Decoder Botan::BER_Decoder::start_cons | ( | ASN1_Tag | type_tag, |
ASN1_Tag | class_tag = UNIVERSAL |
||
) |
Start decoding a constructed data (sequence or set)
Definition at line 290 of file ber_dec.cpp.
References Botan::BER_Object::assert_is_a(), BER_Decoder(), Botan::CONSTRUCTED, and get_next_object().
Referenced by Botan::PK_Verifier::check_signature(), Botan::X509_DN::decode_from(), Botan::AlternativeName::decode_from(), Botan::GeneralSubtree::decode_from(), Botan::Attribute::decode_from(), Botan::AlgorithmIdentifier::decode_from(), Botan::Extensions::decode_from(), Botan::CRL_Entry::decode_from(), Botan::Cert_Extension::CRL_Distribution_Points::Distribution_Point::decode_from(), Botan::OCSP::CertID::decode_from(), Botan::OCSP::SingleResponse::decode_from(), Botan::X509_Object::decode_from(), decode_list(), Botan::EC_PrivateKey::EC_PrivateKey(), Botan::GOST_3410_PublicKey::GOST_3410_PublicKey(), Botan::X509::load_key(), Botan::McEliece_PrivateKey::McEliece_PrivateKey(), Botan::McEliece_PublicKey::McEliece_PublicKey(), Botan::pbes2_decrypt(), Botan::OCSP::Response::Response(), Botan::RSA_PrivateKey::RSA_PrivateKey(), Botan::RSA_PublicKey::RSA_PublicKey(), and Botan::TLS::Session::Session().
BER_Decoder & Botan::BER_Decoder::verify_end | ( | ) |
Verify the stream is concluded, throws otherwise. Returns (*this)
Definition at line 208 of file ber_dec.cpp.
References verify_end().
Referenced by Botan::AlternativeName::decode_from(), Botan::Extensions::decode_from(), decode_optional_string(), Botan::pbes2_decrypt(), Botan::TLS::Session::Session(), and verify_end().
BER_Decoder & Botan::BER_Decoder::verify_end | ( | const std::string & | err_msg | ) |
Verify the stream is concluded, throws otherwise. Returns (*this)
Definition at line 216 of file ber_dec.cpp.
References Botan::DataSource::end_of_data(), and Botan::BER_Object::is_set().