Botan
2.1.0
Crypto and TLS for C++11
|
#include <ber_dec.h>
Public Member Functions | |
BER_Decoder (DataSource &) | |
BER_Decoder (const uint8_t[], size_t) | |
BER_Decoder (const secure_vector< uint8_t > &) | |
BER_Decoder (const std::vector< uint8_t > &vec) | |
BER_Decoder (const BER_Decoder &) | |
BER_Decoder & | decode (bool &v) |
BER_Decoder & | decode (size_t &v) |
BER_Decoder & | decode (class BigInt &v) |
BER_Decoder & | decode (std::vector< uint8_t > &v, ASN1_Tag type_tag) |
BER_Decoder & | decode (secure_vector< uint8_t > &v, ASN1_Tag type_tag) |
BER_Decoder & | decode (bool &v, ASN1_Tag type_tag, ASN1_Tag class_tag=CONTEXT_SPECIFIC) |
BER_Decoder & | decode (size_t &v, ASN1_Tag type_tag, ASN1_Tag class_tag=CONTEXT_SPECIFIC) |
BER_Decoder & | decode (class BigInt &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) |
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 (class ASN1_Object &obj, ASN1_Tag type_tag=NO_OBJECT, ASN1_Tag class_tag=NO_OBJECT) |
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 (class 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 (const BER_Object &obj) |
BER_Decoder & | raw_bytes (secure_vector< uint8_t > &v) |
BER_Decoder & | raw_bytes (std::vector< uint8_t > &v) |
BER_Decoder | start_cons (ASN1_Tag type_tag, ASN1_Tag class_tag=UNIVERSAL) |
BER_Decoder & | verify_end () |
~BER_Decoder () | |
|
explicit |
Definition at line 284 of file ber_dec.cpp.
References Botan::BER_Object::class_tag, Botan::NO_OBJECT, and Botan::BER_Object::type_tag.
Referenced by decode_optional().
Botan::BER_Decoder::BER_Decoder | ( | const uint8_t | data[], |
size_t | length | ||
) |
Definition at line 295 of file ber_dec.cpp.
References Botan::BER_Object::class_tag, Botan::NO_OBJECT, and Botan::BER_Object::type_tag.
|
explicit |
Definition at line 306 of file ber_dec.cpp.
References Botan::BER_Object::class_tag, Botan::NO_OBJECT, and Botan::BER_Object::type_tag.
|
explicit |
Definition at line 317 of file ber_dec.cpp.
References Botan::BER_Object::class_tag, Botan::NO_OBJECT, and Botan::BER_Object::type_tag.
Botan::BER_Decoder::BER_Decoder | ( | const BER_Decoder & | other | ) |
Definition at line 328 of file ber_dec.cpp.
References Botan::BER_Object::class_tag, Botan::NO_OBJECT, and Botan::BER_Object::type_tag.
Botan::BER_Decoder::~BER_Decoder | ( | ) |
Definition at line 344 of file ber_dec.cpp.
BER_Decoder & Botan::BER_Decoder::decode | ( | bool & | v | ) |
Definition at line 376 of file ber_dec.cpp.
References Botan::BOOLEAN, and Botan::UNIVERSAL.
Referenced by Botan::DL_Group::BER_decode(), Botan::PK_Verifier::check_signature(), Botan::Curve25519_PrivateKey::Curve25519_PrivateKey(), Botan::Curve25519_PublicKey::Curve25519_PublicKey(), decode(), decode_constrained_integer(), Botan::Attribute::decode_from(), Botan::AlternativeName::decode_from(), Botan::X509_DN::decode_from(), Botan::AlgorithmIdentifier::decode_from(), Botan::OCSP::CertID::decode_from(), Botan::CRL_Entry::decode_from(), Botan::OCSP::SingleResponse::decode_from(), Botan::X509_Object::decode_from(), Botan::Extensions::decode_from(), Botan::GeneralSubtree::decode_from(), decode_list(), decode_octet_string_bigint(), decode_optional(), decode_optional_implicit(), decode_optional_string(), Botan::DL_Scheme_PrivateKey::DL_Scheme_PrivateKey(), Botan::DL_Scheme_PublicKey::DL_Scheme_PublicKey(), Botan::EC_Group::EC_Group(), get_next_octet_string(), 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 | ( | size_t & | v | ) |
Definition at line 384 of file ber_dec.cpp.
References decode(), Botan::INTEGER, and Botan::UNIVERSAL.
BER_Decoder & Botan::BER_Decoder::decode | ( | class BigInt & | v | ) |
Definition at line 392 of file ber_dec.cpp.
References decode(), Botan::INTEGER, and Botan::UNIVERSAL.
BER_Decoder & Botan::BER_Decoder::decode | ( | std::vector< uint8_t > & | v, |
ASN1_Tag | type_tag | ||
) |
Definition at line 514 of file ber_dec.cpp.
References decode(), and Botan::UNIVERSAL.
BER_Decoder & Botan::BER_Decoder::decode | ( | secure_vector< uint8_t > & | v, |
ASN1_Tag | type_tag | ||
) |
Definition at line 506 of file ber_dec.cpp.
References decode(), and Botan::UNIVERSAL.
BER_Decoder & Botan::BER_Decoder::decode | ( | bool & | v, |
ASN1_Tag | type_tag, | ||
ASN1_Tag | class_tag = CONTEXT_SPECIFIC |
||
) |
Definition at line 415 of file ber_dec.cpp.
References Botan::BER_Object::assert_is_a(), get_next_object(), and Botan::BER_Object::value.
BER_Decoder & Botan::BER_Decoder::decode | ( | size_t & | v, |
ASN1_Tag | type_tag, | ||
ASN1_Tag | class_tag = CONTEXT_SPECIFIC |
||
) |
Definition at line 431 of file ber_dec.cpp.
References Botan::BigInt::bits(), Botan::BigInt::byte_at(), and decode().
BER_Decoder & Botan::BER_Decoder::decode | ( | class BigInt & | v, |
ASN1_Tag | type_tag, | ||
ASN1_Tag | class_tag = CONTEXT_SPECIFIC |
||
) |
Definition at line 473 of file ber_dec.cpp.
References Botan::BER_Object::assert_is_a(), Botan::BigInt::flip_sign(), get_next_object(), and Botan::BER_Object::value.
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 547 of file ber_dec.cpp.
References Botan::BER_Object::assert_is_a(), Botan::BIT_STRING, Botan::copy_mem(), get_next_object(), Botan::OCTET_STRING, Botan::unlock(), and Botan::BER_Object::value.
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 522 of file ber_dec.cpp.
References Botan::BER_Object::assert_is_a(), Botan::BIT_STRING, Botan::copy_mem(), get_next_object(), Botan::OCTET_STRING, and Botan::BER_Object::value.
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 354 of file ber_dec.cpp.
References Botan::ASN1_Object::decode_from().
|
inline |
Definition at line 146 of file ber_dec.h.
References Botan::PEM_Code::decode().
Referenced by Botan::EC_Group::EC_Group(), 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 450 of file ber_dec.cpp.
References Botan::BigInt::bits(), Botan::BigInt::byte_at(), and decode().
|
inline |
Definition at line 111 of file ber_dec.h.
References Botan::INTEGER, and Botan::UNIVERSAL.
Referenced by Botan::TLS::Session::Session().
|
inline |
Definition at line 117 of file ber_dec.h.
BER_Decoder & Botan::BER_Decoder::decode_list | ( | std::vector< T > & | out, |
ASN1_Tag | type_tag = SEQUENCE , |
||
ASN1_Tag | class_tag = UNIVERSAL |
||
) |
Definition at line 272 of file ber_dec.h.
References decode(), end_cons(), more_items(), push_back(), and start_cons().
Referenced by Botan::OCSP::Response::Response().
BER_Decoder & Botan::BER_Decoder::decode_null | ( | ) |
Definition at line 364 of file ber_dec.cpp.
References Botan::BER_Object::assert_is_a(), get_next_object(), Botan::NULL_TAG, Botan::UNIVERSAL, and Botan::BER_Object::value.
BER_Decoder & Botan::BER_Decoder::decode_octet_string_bigint | ( | class BigInt & | b | ) |
Definition at line 397 of file ber_dec.cpp.
References decode(), Botan::BigInt::decode(), and Botan::OCTET_STRING.
Referenced by Botan::EC_Group::EC_Group().
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 213 of file ber_dec.h.
References BER_Decoder(), Botan::BER_Object::class_tag, Botan::CONSTRUCTED, Botan::CONTEXT_SPECIFIC, decode(), get_next_object(), push_back(), Botan::BER_Object::type_tag, and Botan::BER_Object::value.
Referenced by Botan::OCSP::SingleResponse::decode_from(), Botan::Extensions::decode_from(), Botan::GeneralSubtree::decode_from(), Botan::EC_PrivateKey::EC_PrivateKey(), Botan::pbes2_decrypt(), 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 243 of file ber_dec.h.
References Botan::BER_Object::class_tag, decode(), get_next_object(), push_back(), and Botan::BER_Object::type_tag.
Referenced by Botan::Cert_Extension::CRL_Distribution_Points::Distribution_Point::decode_from().
|
inline |
Definition at line 162 of file ber_dec.h.
References Botan::BER_Object::class_tag, Botan::CONSTRUCTED, Botan::CONTEXT_SPECIFIC, Botan::PEM_Code::decode(), decode(), Botan::BER_Object::type_tag, Botan::BER_Object::value, and verify_end().
Referenced by Botan::EC_PrivateKey::EC_PrivateKey(), and Botan::OCSP::Response::Response().
BER_Decoder & Botan::BER_Decoder::discard_remaining | ( | ) |
Definition at line 199 of file ber_dec.cpp.
References Botan::DataSource::read_byte().
Referenced by Botan::DL_Group::BER_decode().
BER_Decoder & Botan::BER_Decoder::end_cons | ( | ) |
Definition at line 272 of file ber_dec.cpp.
References Botan::DataSource::end_of_data().
Referenced by Botan::Curve25519_PrivateKey::Curve25519_PrivateKey(), Botan::Curve25519_PublicKey::Curve25519_PublicKey(), Botan::Attribute::decode_from(), Botan::X509_DN::decode_from(), Botan::AlgorithmIdentifier::decode_from(), Botan::OCSP::CertID::decode_from(), Botan::CRL_Entry::decode_from(), Botan::OCSP::SingleResponse::decode_from(), Botan::X509_Object::decode_from(), Botan::Extensions::decode_from(), Botan::GeneralSubtree::decode_from(), Botan::Cert_Extension::CRL_Distribution_Points::Distribution_Point::decode_from(), decode_list(), Botan::EC_Group::EC_Group(), 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().
BER_Decoder & Botan::BER_Decoder::get_next | ( | BER_Object & | ber | ) |
Definition at line 239 of file ber_dec.cpp.
References get_next_object().
Referenced by Botan::OCSP::SingleResponse::decode_from().
BER_Object Botan::BER_Decoder::get_next_object | ( | ) |
Definition at line 210 of file ber_dec.cpp.
References Botan::DataSource::check_available(), Botan::BER_Object::class_tag, Botan::EOC, Botan::NO_OBJECT, Botan::DataSource::read(), Botan::BER_Object::type_tag, Botan::UNIVERSAL, and Botan::BER_Object::value.
Referenced by decode(), Botan::ASN1_String::decode_from(), Botan::OID::decode_from(), Botan::AlternativeName::decode_from(), Botan::X509_Time::decode_from(), Botan::GeneralName::decode_from(), decode_null(), decode_optional(), decode_optional_implicit(), Botan::EC_Group::EC_Group(), get_next(), and start_cons().
std::vector< uint8_t > Botan::BER_Decoder::get_next_octet_string | ( | ) |
Definition at line 405 of file ber_dec.cpp.
References 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 48 of file ber_dec.h.
References Botan::BER_Object::assert_is_a(), Botan::copy_mem(), Botan::ASN1::to_string(), and Botan::BER_Object::value.
bool Botan::BER_Decoder::more_items | ( | ) | const |
Definition at line 158 of file ber_dec.cpp.
References Botan::DataSource::end_of_data(), Botan::NO_OBJECT, and Botan::BER_Object::type_tag.
Referenced by Botan::PK_Verifier::check_signature(), Botan::AlternativeName::decode_from(), Botan::X509_DN::decode_from(), Botan::CRL_Entry::decode_from(), Botan::Extensions::decode_from(), decode_list(), and Botan::OCSP::Response::Response().
|
delete |
void Botan::BER_Decoder::push_back | ( | const BER_Object & | obj | ) |
Definition at line 248 of file ber_dec.cpp.
References Botan::NO_OBJECT, and Botan::BER_Object::type_tag.
Referenced by decode_list(), decode_optional(), decode_optional_implicit(), Botan::McEliece_PrivateKey::McEliece_PrivateKey(), and raw_bytes().
BER_Decoder & Botan::BER_Decoder::raw_bytes | ( | secure_vector< uint8_t > & | v | ) |
Definition at line 178 of file ber_dec.cpp.
References push_back(), and Botan::DataSource::read_byte().
Referenced by Botan::Attribute::decode_from(), Botan::AlgorithmIdentifier::decode_from(), Botan::X509_DN::decode_from(), Botan::X509_Object::decode_from(), and Botan::OCSP::Response::Response().
BER_Decoder & Botan::BER_Decoder::raw_bytes | ( | std::vector< uint8_t > & | v | ) |
Definition at line 187 of file ber_dec.cpp.
References push_back(), and Botan::DataSource::read_byte().
BER_Decoder Botan::BER_Decoder::start_cons | ( | ASN1_Tag | type_tag, |
ASN1_Tag | class_tag = UNIVERSAL |
||
) |
Definition at line 258 of file ber_dec.cpp.
References Botan::BER_Object::assert_is_a(), Botan::CONSTRUCTED, get_next_object(), and Botan::BER_Object::value.
Referenced by Botan::DL_Group::BER_decode(), Botan::PK_Verifier::check_signature(), Botan::Curve25519_PrivateKey::Curve25519_PrivateKey(), Botan::Curve25519_PublicKey::Curve25519_PublicKey(), Botan::Attribute::decode_from(), Botan::AlternativeName::decode_from(), Botan::X509_DN::decode_from(), Botan::AlgorithmIdentifier::decode_from(), Botan::OCSP::CertID::decode_from(), Botan::CRL_Entry::decode_from(), Botan::OCSP::SingleResponse::decode_from(), Botan::X509_Object::decode_from(), Botan::Extensions::decode_from(), Botan::GeneralSubtree::decode_from(), Botan::Cert_Extension::CRL_Distribution_Points::Distribution_Point::decode_from(), decode_list(), Botan::EC_Group::EC_Group(), 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 | ( | ) |
Definition at line 168 of file ber_dec.cpp.
References Botan::DataSource::end_of_data(), Botan::NO_OBJECT, and Botan::BER_Object::type_tag.
Referenced by Botan::DL_Group::BER_decode(), Botan::AlternativeName::decode_from(), Botan::Extensions::decode_from(), decode_optional_string(), Botan::EC_Group::EC_Group(), Botan::pbes2_decrypt(), and Botan::TLS::Session::Session().