Botan  2.6.0
Crypto and TLS for C++11
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 ()
 
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
 
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 88 of file asn1_obj.h.

Constructor & Destructor Documentation

◆ BER_Object()

Botan::BER_Object::BER_Object ( )
inline

Definition at line 91 of file asn1_obj.h.

91 : type_tag(NO_OBJECT), class_tag(UNIVERSAL) {}
BOTAN_DEPRECATED_PUBLIC_MEMBER_VARIABLES class_tag
Definition: asn1_obj.h:117

Member Function Documentation

◆ assert_is_a()

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

Definition at line 18 of file asn1_obj.cpp.

References class_tag, is_a(), and Botan::ASN1::to_string().

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

20  {
21  if(this->is_a(type_tag_, class_tag_) == false)
22  {
23  throw BER_Decoding_Error("Tag mismatch when decoding " + descr + " got " +
24  std::to_string(type_tag) + "/" +
25  std::to_string(class_tag) + " expected " +
26  std::to_string(type_tag_) + "/" +
27  std::to_string(class_tag_));
28  }
29  }
bool is_a(ASN1_Tag type_tag, ASN1_Tag class_tag) const
Definition: asn1_obj.cpp:31
std::string to_string(const BER_Object &obj)
Definition: asn1_obj.cpp:145
BOTAN_DEPRECATED_PUBLIC_MEMBER_VARIABLES class_tag
Definition: asn1_obj.h:117

◆ bits()

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

◆ get_class()

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

Definition at line 98 of file asn1_obj.h.

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

98 { return class_tag; }
BOTAN_DEPRECATED_PUBLIC_MEMBER_VARIABLES class_tag
Definition: asn1_obj.h:117

◆ is_a() [1/2]

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

Definition at line 31 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().

32  {
33  return (type_tag == type_tag_ && class_tag == class_tag_);
34  }
BOTAN_DEPRECATED_PUBLIC_MEMBER_VARIABLES class_tag
Definition: asn1_obj.h:117

◆ is_a() [2/2]

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

Definition at line 36 of file asn1_obj.cpp.

References is_a().

37  {
38  return is_a(ASN1_Tag(type_tag_), class_tag_);
39  }
bool is_a(ASN1_Tag type_tag, ASN1_Tag class_tag) const
Definition: asn1_obj.cpp:31
ASN1_Tag
Definition: asn1_obj.h:22

◆ is_set()

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

◆ length()

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

◆ tagging()

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

Definition at line 95 of file asn1_obj.h.

References type.

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

95 { return ASN1_Tag(type() | get_class()); }
ASN1_Tag
Definition: asn1_obj.h:22
ASN1_Tag type() const
Definition: asn1_obj.h:97
ASN1_Tag get_class() const
Definition: asn1_obj.h:98

◆ type()

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

Definition at line 97 of file asn1_obj.h.

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

97 { return type_tag; }

Friends And Related Function Documentation

◆ BER_Decoder

friend class BER_Decoder
friend

Definition at line 122 of file asn1_obj.h.

Member Data Documentation

◆ __pad0__

BOTAN_DEPRECATED_PUBLIC_MEMBER_VARIABLES Botan::BER_Object::__pad0__

Definition at line 117 of file asn1_obj.h.

◆ class_tag

BOTAN_DEPRECATED_PUBLIC_MEMBER_VARIABLES Botan::BER_Object::class_tag

Definition at line 117 of file asn1_obj.h.

Referenced by assert_is_a(), and is_a().

◆ value

secure_vector<uint8_t> Botan::BER_Object::value

Definition at line 118 of file asn1_obj.h.


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