Botan 2.13.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Public Attributes | Friends | List of all members
Botan::BER_Object Class Referencefinal

`#include <asn1_obj.h>`

## Public Member Functions
void | assert_is_a (ASN1_Tag type_tag, ASN1_Tag class_tag, const std::string &descr="object") const
| BER_Object ()
| BER_Object (const BER_Object &other)=default
| BER_Object (BER_Object &&other)=default
const uint8_t * | bits () const
ASN1_Tag | get_class () const
bool | is_a (ASN1_Tag type_tag, ASN1_Tag class_tag) const
bool | is_a (int type_tag, ASN1_Tag class_tag) const
bool | is_set () const
size_t | length () const
BER_Object & | operator= (const BER_Object &other)=default
BER_Object & | operator= (BER_Object &&other)=default
ASN1_Tag | tagging () const
ASN1_Tag | type () const

## Public Attributes
BOTAN_DEPRECATED_PUBLIC_MEMBER_VARIABLES | __pad0__: ASN1_Tag type_tag
BOTAN_DEPRECATED_PUBLIC_MEMBER_VARIABLES | class_tag
secure_vector< uint8_t > | value

## Friends
class | BER_Decoder

## Detailed Description

BER Encoded Object

Definition at line 97 of file asn1_obj.h.

## Constructor & Destructor Documentation

Botan::BER_Object::BER_Object | ( |  | ) |
| inline

Definition at line 100 of file asn1_obj.h.

100 : type_tag(NO_OBJECT), class_tag(UNIVERSAL) {}
Botan::BER_Object::class_tag
BOTAN_DEPRECATED_PUBLIC_MEMBER_VARIABLES class_tag
Definition: asn1_obj.h:134
Botan::UNIVERSAL
Definition: asn1_obj.h:24
Botan::NO_OBJECT
Definition: asn1_obj.h:56

Botan::BER_Object::BER_Object | ( | const BER_Object & | other | ) |
| default

Botan::BER_Object::BER_Object | ( | BER_Object && | other | ) |
| default

## Member Function Documentation

void Botan::BER_Object::assert_is_a | ( | ASN1_Tag | type_tag,
|  | ASN1_Tag | class_tag,
|  | const std::string & | descr = `"object"`
| ) |  | const

Definition at line 27 of file asn1_obj.cpp.

References Botan::asn1_class_to_string(), Botan::asn1_tag_to_string(), class_tag, Botan::CONSTRUCTED, is_a(), Botan::NO_OBJECT, Botan::ASN1::to_string(), and Botan::UNIVERSAL.

Referenced by Botan::BER_Decoder::decode(), Botan::BER_Decoder::decode_null(), Botan::BER_Decoder::get_next_value(), and Botan::BER_Decoder::start_cons().

29 {
30 if(this->is_a(type_tag_, class_tag_) == false)
31 {
32 std::stringstream msg;
33
34 msg << "Tag mismatch when decoding " << descr << " got ";
35
36 if(class_tag == NO_OBJECT && type_tag == NO_OBJECT)
37 {
38 msg << "EOF";
39 }
40 else
41 {
42 if(class_tag == UNIVERSAL || class_tag == CONSTRUCTED)
43 {
44 msg << asn1_tag_to_string(type_tag);
45 }
46 else
47 {
48 msg << std::to_string(type_tag);
49 }
50
51 msg << "/" << asn1_class_to_string(class_tag);
52 }
53
54 msg << " expected ";
55
56 if(class_tag_ == UNIVERSAL || class_tag_ == CONSTRUCTED)
57 {
58 msg << asn1_tag_to_string(type_tag_);
59 }
60 else
61 {
62 msg << std::to_string(type_tag_);
63 }
64
65 msg << "/" << asn1_class_to_string(class_tag_);
66
67 throw BER_Decoding_Error(msg.str());
68 }
69 }
Botan::asn1_tag_to_string
std::string asn1_tag_to_string(ASN1_Tag type)
Definition: asn1_obj.cpp:108
Botan::asn1_class_to_string
std::string asn1_class_to_string(ASN1_Tag type)
Definition: asn1_obj.cpp:87
Botan::CONSTRUCTED
Definition: asn1_obj.h:28
Botan::ASN1::to_string
std::string to_string(const BER_Object &obj)
Definition: asn1_obj.cpp:213
Botan::BER_Object::is_a
bool is_a(ASN1_Tag type_tag, ASN1_Tag class_tag) const
Definition: asn1_obj.cpp:71
Botan::BER_Object::class_tag
BOTAN_DEPRECATED_PUBLIC_MEMBER_VARIABLES class_tag
Definition: asn1_obj.h:134
Botan::UNIVERSAL
Definition: asn1_obj.h:24
Botan::NO_OBJECT
Definition: asn1_obj.h:56

const uint8_t* Botan::BER_Object::bits | ( |  | ) | const
| inline

Definition at line 117 of file asn1_obj.h.

Referenced by Botan::BER_Decoder::decode(), Botan::ASN1_String::decode_from(), Botan::AlternativeName::decode_from(), Botan::GeneralName::decode_from(), Botan::OID::decode_from(), Botan::BER_Decoder::get_next_value(), and Botan::ASN1::to_string().

117 { return value.data(); }
Botan::BER_Object::value
secure_vector< uint8_t > value
Definition: asn1_obj.h:135

ASN1_Tag Botan::BER_Object::get_class | ( |  | ) | const
| inline

Definition at line 115 of file asn1_obj.h.

Referenced by Botan::AlternativeName::decode_from().

115 { return class_tag; }
Botan::BER_Object::class_tag
BOTAN_DEPRECATED_PUBLIC_MEMBER_VARIABLES class_tag
Definition: asn1_obj.h:134

bool Botan::BER_Object::is_a | ( | ASN1_Tag | type_tag,
|  | ASN1_Tag | class_tag
| ) |  | const

Definition at line 71 of file asn1_obj.cpp.

References class_tag.

Referenced by assert_is_a(), Botan::AlternativeName::decode_from(), Botan::GeneralName::decode_from(), Botan::BER_Decoder::decode_optional(), Botan::BER_Decoder::decode_optional_implicit(), Botan::BER_Decoder::decode_optional_string(), and is_a().

72 {
73 return (type_tag == type_tag_ && class_tag == class_tag_);
74 }
Botan::BER_Object::class_tag
BOTAN_DEPRECATED_PUBLIC_MEMBER_VARIABLES class_tag
Definition: asn1_obj.h:134

bool Botan::BER_Object::is_a | ( | int | type_tag,
|  | ASN1_Tag | class_tag
| ) |  | const

Definition at line 76 of file asn1_obj.cpp.

References is_a().

77 {
78 return is_a(ASN1_Tag(type_tag_), class_tag_);
79 }
Botan::ASN1_Tag
ASN1_Tag
Definition: asn1_obj.h:23
Botan::BER_Object::is_a
bool is_a(ASN1_Tag type_tag, ASN1_Tag class_tag) const
Definition: asn1_obj.cpp:71

bool Botan::BER_Object::is_set | ( |  | ) | const
| inline

Definition at line 110 of file asn1_obj.h.

References Botan::NO_OBJECT.

Referenced by Botan::BER_Decoder::get_next_object(), Botan::BER_Decoder::more_items(), Botan::BER_Decoder::push_back(), and Botan::BER_Decoder::verify_end().

110 { return type_tag != NO_OBJECT; }
Botan::NO_OBJECT
Definition: asn1_obj.h:56

size_t Botan::BER_Object::length | ( |  | ) | const
| inline

Definition at line 119 of file asn1_obj.h.

Referenced by Botan::BER_Decoder::decode(), Botan::ASN1_String::decode_from(), Botan::AlternativeName::decode_from(), Botan::GeneralName::decode_from(), Botan::OID::decode_from(), Botan::BER_Decoder::decode_null(), Botan::BER_Decoder::get_next_value(), and Botan::ASN1::to_string().

119 { return value.size(); }
Botan::BER_Object::value
secure_vector< uint8_t > value
Definition: asn1_obj.h:135

BER_Object& Botan::BER_Object::operator= | ( | const BER_Object & | other | ) |
| default

BER_Object& Botan::BER_Object::operator= | ( | BER_Object && | other | ) |
| default

ASN1_Tag Botan::BER_Object::tagging | ( |  | ) | const
| inline

Definition at line 112 of file asn1_obj.h.

References type.

Referenced by Botan::OID::decode_from(), and Botan::BER_Decoder::get_next_object().

112 { return ASN1_Tag(type() | get_class()); }
Botan::BER_Object::type
ASN1_Tag type() const
Definition: asn1_obj.h:114
Botan::ASN1_Tag
ASN1_Tag
Definition: asn1_obj.h:23
Botan::BER_Object::get_class
ASN1_Tag get_class() const
Definition: asn1_obj.h:115

ASN1_Tag Botan::BER_Object::type | ( |  | ) | const
| inline

Definition at line 114 of file asn1_obj.h.

Referenced by Botan::ASN1_String::decode_from(), Botan::AlternativeName::decode_from(), Botan::X509_Time::decode_from(), and Botan::OCSP::SingleResponse::decode_from().

114 { return type_tag; }

## Friends And Related Function Documentation

friend class BER_Decoder
| friend

Definition at line 139 of file asn1_obj.h.

## Member Data Documentation

BOTAN_DEPRECATED_PUBLIC_MEMBER_VARIABLES Botan::BER_Object::__pad0__

Definition at line 134 of file asn1_obj.h.

BOTAN_DEPRECATED_PUBLIC_MEMBER_VARIABLES Botan::BER_Object::class_tag

Definition at line 134 of file asn1_obj.h.

Referenced by assert_is_a(), and is_a().

secure_vector<uint8_t> Botan::BER_Object::value

Definition at line 135 of file asn1_obj.h.

The documentation for this class was generated from the following files:

- src/lib/asn1/asn1_obj.h
- src/lib/asn1/asn1_obj.cpp