Botan  2.7.0
Crypto and TLS for C++11
Public Types | Public Member Functions | Public Attributes | List of all members
Botan::AlgorithmIdentifier Class Referencefinal

#include <alg_id.h>

Inheritance diagram for Botan::AlgorithmIdentifier:
Botan::ASN1_Object

Public Types

enum  Encoding_Option { USE_NULL_PARAM, USE_EMPTY_PARAM }
 

Public Member Functions

 AlgorithmIdentifier ()=default
 
 AlgorithmIdentifier (const OID &oid, Encoding_Option enc)
 
 AlgorithmIdentifier (const std::string &oid_name, Encoding_Option enc)
 
 AlgorithmIdentifier (const OID &oid, const std::vector< uint8_t > &params)
 
 AlgorithmIdentifier (const std::string &oid_name, const std::vector< uint8_t > &params)
 
std::vector< uint8_t > BER_encode () const
 
void decode_from (class BER_Decoder &) override
 
void encode_into (class DER_Encoder &) const override
 
const OIDget_oid () const
 
const std::vector< uint8_t > & get_parameters () const
 

Public Attributes

BOTAN_DEPRECATED_PUBLIC_MEMBER_VARIABLES __pad0__: OID oid
 
std::vector< uint8_t > parameters
 

Detailed Description

Algorithm Identifier

Definition at line 21 of file alg_id.h.

Member Enumeration Documentation

◆ Encoding_Option

Enumerator
USE_NULL_PARAM 
USE_EMPTY_PARAM 

Definition at line 24 of file alg_id.h.

Constructor & Destructor Documentation

◆ AlgorithmIdentifier() [1/5]

Botan::AlgorithmIdentifier::AlgorithmIdentifier ( )
default

◆ AlgorithmIdentifier() [2/5]

Botan::AlgorithmIdentifier::AlgorithmIdentifier ( const OID oid,
Encoding_Option  enc 
)

Definition at line 36 of file alg_id.cpp.

References parameters, and USE_NULL_PARAM.

37  :
38  oid(alg_id),
39  parameters()
40  {
41  const uint8_t DER_NULL[] = { 0x05, 0x00 };
42 
43  if(option == USE_NULL_PARAM)
44  parameters.assign(DER_NULL, DER_NULL + 2);
45  }
std::vector< uint8_t > parameters
Definition: alg_id.h:46

◆ AlgorithmIdentifier() [3/5]

Botan::AlgorithmIdentifier::AlgorithmIdentifier ( const std::string &  oid_name,
Encoding_Option  enc 
)

Definition at line 50 of file alg_id.cpp.

References parameters, and USE_NULL_PARAM.

51  :
52  oid(OIDS::lookup(alg_id)),
53  parameters()
54  {
55  const uint8_t DER_NULL[] = { 0x05, 0x00 };
56 
57  if(option == USE_NULL_PARAM)
58  parameters.assign(DER_NULL, DER_NULL + 2);
59  }
std::vector< uint8_t > parameters
Definition: alg_id.h:46
std::string lookup(const OID &oid)
Definition: oids.cpp:113

◆ AlgorithmIdentifier() [4/5]

Botan::AlgorithmIdentifier::AlgorithmIdentifier ( const OID oid,
const std::vector< uint8_t > &  params 
)

Definition at line 18 of file alg_id.cpp.

19  :
20  oid(alg_id),
21  parameters(param)
22  {}
std::vector< uint8_t > parameters
Definition: alg_id.h:46

◆ AlgorithmIdentifier() [5/5]

Botan::AlgorithmIdentifier::AlgorithmIdentifier ( const std::string &  oid_name,
const std::vector< uint8_t > &  params 
)

Definition at line 27 of file alg_id.cpp.

28  :
29  oid(OIDS::lookup(alg_id)),
30  parameters(param)
31  {}
std::vector< uint8_t > parameters
Definition: alg_id.h:46
std::string lookup(const OID &oid)
Definition: oids.cpp:113

Member Function Documentation

◆ BER_encode()

std::vector< uint8_t > Botan::ASN1_Object::BER_encode ( ) const
inherited

Return the encoding of this object. This is a convenience method when just one object needs to be serialized. Use DER_Encoder for complicated encodings.

Definition at line 16 of file asn1_obj.cpp.

References Botan::ASN1_Object::encode_into().

Referenced by Botan::PSSR::config_for_x509(), Botan::Certificate_Store_In_SQL::find_all_certs(), Botan::Certificate_Store_In_SQL::find_cert(), Botan::X509_Certificate::fingerprint(), Botan::Certificate_Store_In_SQL::insert_cert(), Botan::X509_Object::PEM_encode(), and Botan::Certificate_Store_In_SQL::revoke_cert().

17  {
18  std::vector<uint8_t> output;
19  DER_Encoder der(output);
20  this->encode_into(der);
21  return output;
22  }
virtual void encode_into(DER_Encoder &to) const =0

◆ decode_from()

void Botan::AlgorithmIdentifier::decode_from ( class BER_Decoder from)
overridevirtual

Decode whatever this object is from from

Parameters
fromthe BER_Decoder that will be read from

Implements Botan::ASN1_Object.

Definition at line 109 of file alg_id.cpp.

References Botan::BER_Decoder::decode(), Botan::BER_Decoder::end_cons(), parameters, Botan::BER_Decoder::raw_bytes(), Botan::SEQUENCE, and Botan::BER_Decoder::start_cons().

110  {
111  codec.start_cons(SEQUENCE)
112  .decode(oid)
113  .raw_bytes(parameters)
114  .end_cons();
115  }
std::vector< uint8_t > parameters
Definition: alg_id.h:46

◆ encode_into()

void Botan::AlgorithmIdentifier::encode_into ( class DER_Encoder to) const
overridevirtual

Encode whatever this object is into to

Parameters
tothe DER_Encoder that will be written to

Implements Botan::ASN1_Object.

Definition at line 98 of file alg_id.cpp.

References Botan::DER_Encoder::encode(), Botan::DER_Encoder::end_cons(), get_oid(), get_parameters(), Botan::DER_Encoder::raw_bytes(), Botan::SEQUENCE, and Botan::DER_Encoder::start_cons().

99  {
100  codec.start_cons(SEQUENCE)
101  .encode(get_oid())
102  .raw_bytes(get_parameters())
103  .end_cons();
104  }
const std::vector< uint8_t > & get_parameters() const
Definition: alg_id.h:38
const OID & get_oid() const
Definition: alg_id.h:37

◆ get_oid()

const OID& Botan::AlgorithmIdentifier::get_oid ( ) const
inline

◆ get_parameters()

const std::vector<uint8_t>& Botan::AlgorithmIdentifier::get_parameters ( ) const
inline

Member Data Documentation

◆ __pad0__

BOTAN_DEPRECATED_PUBLIC_MEMBER_VARIABLES Botan::AlgorithmIdentifier::__pad0__

Definition at line 45 of file alg_id.h.

◆ parameters

std::vector<uint8_t> Botan::AlgorithmIdentifier::parameters

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