Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- Namespace List
- Namespace Members

Functions
Botan::ASN1 Namespace Reference

## Functions
bool | maybe_BER (DataSource &source)
std::vector< uint8_t > | put_in_sequence (const std::vector< uint8_t > &contents)
std::string | to_string (const BER_Object &obj)

## Function Documentation

bool Botan::ASN1::maybe_BER | ( | DataSource & | src | ) |

Heuristics tests; is this object possibly BER?

Parameters

  src | a data source that will be peeked at but not modified

Definition at line 55 of file asn1_obj.cpp.

References BOTAN_ASSERT_EQUAL, Botan::CONSTRUCTED, Botan::DataSource::peek_byte(), Botan::DataSource::read_byte(), and Botan::SEQUENCE.

Referenced by Botan::X509::load_key().

56 {
57 uint8_t first_u8;
58 if(!source.peek_byte(first_u8))
59 {
60 BOTAN_ASSERT_EQUAL(source.read_byte(first_u8), 0, "Expected EOF");
61 throw Stream_IO_Error("ASN1::maybe_BER: Source was empty");
62 }
63
64 if(first_u8 == (SEQUENCE | CONSTRUCTED))
65 return true;
66 return false;
67 }
Botan::CONSTRUCTED
Definition: asn1_obj.h:27
BOTAN_ASSERT_EQUAL
#define BOTAN_ASSERT_EQUAL(expr1, expr2, assertion_made)
Definition: assert.h:53
Botan::SEQUENCE
Definition: asn1_obj.h:39

std::vector< uint8_t > Botan::ASN1::put_in_sequence | ( | const std::vector< uint8_t > & | contents | ) |

Definition at line 35 of file asn1_obj.cpp.

References Botan::DER_Encoder::end_cons(), Botan::DER_Encoder::get_contents_unlocked(), Botan::DER_Encoder::raw_bytes(), Botan::SEQUENCE, and Botan::DER_Encoder::start_cons().

Referenced by Botan::X509_Certificate::subject_public_key(), Botan::X509_Object::tbs_data(), and Botan::OCSP::Response::verify_signature().

36 {
37 return DER_Encoder()
38 .start_cons(SEQUENCE)
39 .raw_bytes(contents)
40 .end_cons()
41 .get_contents_unlocked();
42 }
Botan::SEQUENCE
Definition: asn1_obj.h:39

std::string Botan::ASN1::to_string | ( | const BER_Object & | obj | ) |

Definition at line 47 of file asn1_obj.cpp.

References Botan::BER_Object::value.

Referenced by Botan::Data_Store::add(), Botan::TLS::Stream_Handshake_IO::add_record(), Botan::TLS::Alert::Alert(), Botan::SCAN_Name::arg(), Botan::OID::as_string(), Botan::ASN1_String::ASN1_String(), Botan::BER_Object::assert_is_a(), Botan::DL_Group::BER_decode(), botan_bcrypt_generate(), Botan::CCM_Mode::CCM_Mode(), Botan::CFB_Mode::CFB_Mode(), Botan::check_passhash9(), Botan::TLS::Policy::check_peer_key_acceptable(), Botan::TLS::Client_Key_Exchange::Client_Key_Exchange(), Botan::CMAC::CMAC(), Botan::TLS::Handshake_State::confirm_transition_to(), Botan::ASN1_String::decode_from(), Botan::AlternativeName::decode_from(), Botan::X509_Time::decode_from(), Botan::GeneralName::decode_from(), Botan::DL_Group::DER_encode(), Botan::Device_EntropySource::Device_EntropySource(), Botan::DL_Group::DL_Group(), Botan::EAX_Mode::EAX_Mode(), Botan::Blowfish::eks_key_schedule(), Botan::GCM_Mode::GCM_Mode(), Botan::generate_dsa_primes(), Botan::generate_passhash9(), Botan::BER_Decoder::get_next_value(), Botan::TLS::handshake_type_to_string(), Botan::HTTP::http_sync(), Botan::ipv4_to_string(), Botan::Keccak_1600::Keccak_1600(), Botan::Tiger::name(), Botan::SipHash::name(), Botan::CFB_Mode::name(), Botan::RC4::name(), Botan::GCM_Mode::name(), Botan::CCM_Mode::name(), Botan::Keccak_1600::name(), Botan::SHA_3::name(), Botan::SHAKE_128::name(), Botan::Skein_512::name(), Botan::Blake2b::name(), Botan::Lion::name(), Botan::ChaCha::name(), Botan::SHAKE_256::name(), Botan::HTTP::operator<<(), Botan::OS2ECP(), Botan::pbkdf2(), Botan::DL_Group::PEM_encode(), Botan::CMAC::poly_double(), Botan::random_prime(), Botan::random_safe_prime(), Botan::read_cfg(), Botan::TLS::Channel::received_data(), Botan::OCSP::Response::Response(), Botan::rfc3394_keyunwrap(), Botan::rfc3394_keywrap(), Botan::RSA_PrivateKey::RSA_PrivateKey(), Botan::SHA_3::SHA_3(), Botan::SHAKE_128::SHAKE_128(), Botan::SHAKE_256::SHAKE_256(), Botan::TLS::Application_Layer_Protocol_Notification::single_protocol(), Botan::srp6_group_identifier(), Botan::Tiger::Tiger(), Botan::X509_Time::to_string(), Botan::TLS::Protocol_Version::to_string(), Botan::polyn_gf2m::to_string(), Botan::to_u32bit(), Botan::Charset::transcode(), and Botan::TLS::Alert::type_string().

48 {
49 return to_string(obj.value);
50 }
Botan::ASN1::to_string
std::string to_string(const BER_Object &obj)
Definition: asn1_obj.cpp:47