Botan  2.4.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 }
 

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)
 
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

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 

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:45

◆ 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:45
std::string lookup(const OID &oid)
Definition: oids.cpp:18

◆ 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:45

◆ 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:45
std::string lookup(const OID &oid)
Definition: oids.cpp:18

Member Function Documentation

◆ 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(), oid, 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:45

◆ 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

◆ oid

OID Botan::AlgorithmIdentifier::oid

◆ parameters

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

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