Botan 2.19.5 Crypto and TLS for C&

Public Types | Public Member Functions | Public Attributes | List of all members
Botan::AlgorithmIdentifier Class Referencefinal

`#include <asn1_obj.h>`

Inheritance diagram for Botan::AlgorithmIdentifier:

## Public Types
enum | Encoding_Option { USE_NULL_PARAM , USE_EMPTY_PARAM }

## Public Member Functions
| AlgorithmIdentifier ()=default
| AlgorithmIdentifier (const OID &oid, const std::vector< uint8_t > &params)
| AlgorithmIdentifier (const OID &oid, Encoding_Option enc)
| AlgorithmIdentifier (const std::string &oid_name, const std::vector< uint8_t > &params)
| AlgorithmIdentifier (const std::string &oid_name, Encoding_Option enc)
std::vector< uint8_t > | BER_encode () const
void | decode_from (class BER_Decoder &) override
void | encode_into (class DER_Encoder &) const override
const OID & | get_oid () const
const std::vector< uint8_t > & | get_parameters () const
bool | parameters_are_empty () const
bool | parameters_are_null () const
bool | parameters_are_null_or_empty () const

## Public Attributes
BOTAN_DEPRECATED_PUBLIC_MEMBER_VARIABLES | __pad0__: OID oid
std::vector< uint8_t > | parameters

## Detailed Description

Algorithm Identifier

Definition at line 429 of file asn1_obj.h.

## Member Enumeration Documentation

## ◆ Encoding_Option

enum Botan::AlgorithmIdentifier::Encoding_Option

Enumerator
USE_NULL_PARAM |
USE_EMPTY_PARAM |

Definition at line 432 of file asn1_obj.h.

432{ USE_NULL_PARAM, USE_EMPTY_PARAM };
Botan::AlgorithmIdentifier::USE_EMPTY_PARAM
@ USE_EMPTY_PARAM
Definition: asn1_obj.h:432
Botan::AlgorithmIdentifier::USE_NULL_PARAM
@ USE_NULL_PARAM
Definition: asn1_obj.h:432

## 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 35 of file alg_id.cpp.

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

References parameters, and USE_NULL_PARAM.

## ◆ AlgorithmIdentifier() [3/5]

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

Definition at line 49 of file alg_id.cpp.

50 :
51 oid(OID::from_string(alg_id)),
52 parameters()
53 {
54 const uint8_t DER_NULL[] = { 0x05, 0x00 };
55
56 if(option == USE_NULL_PARAM)
57 parameters.assign(DER_NULL, DER_NULL + 2);
58 }
Botan::OID::from_string
static OID from_string(const std::string &str)
Definition: asn1_oid.cpp:62

References parameters, and USE_NULL_PARAM.

## ◆ 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 {}

## ◆ 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 AlgorithmIdentifier(OID::from_string(alg_id), param)
30 {}
Botan::AlgorithmIdentifier::AlgorithmIdentifier
AlgorithmIdentifier()=default

## 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.

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

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

## ◆ decode_from()

void Botan::AlgorithmIdentifier::decode_from | ( | class BER_Decoder & | from | ) |
| override virtual

Decode whatever this object is from from

Parameters

  from | the BER_Decoder that will be read from

Implements Botan::ASN1_Object.

Definition at line 101 of file alg_id.cpp.

102 {
103 codec.start_cons(SEQUENCE)
104 .decode(oid)
105 .raw_bytes(parameters)
106 .end_cons();
107 }
Botan::SEQUENCE
@ SEQUENCE
Definition: asn1_obj.h:42

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

## ◆ encode_into()

void Botan::AlgorithmIdentifier::encode_into | ( | class DER_Encoder & | to | ) | const
| override virtual

Encode whatever this object is into to

Parameters

  to | the DER_Encoder that will be written to

Implements Botan::ASN1_Object.

Definition at line 90 of file alg_id.cpp.

91 {
92 codec.start_cons(SEQUENCE)
93 .encode(get_oid())
94 .raw_bytes(get_parameters())
95 .end_cons();
96 }
Botan::AlgorithmIdentifier::get_parameters
const std::vector< uint8_t > & get_parameters() const
Definition: asn1_obj.h:446
Botan::AlgorithmIdentifier::get_oid
const OID & get_oid() const
Definition: asn1_obj.h:445

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

## ◆ get_oid()

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

Definition at line 445 of file asn1_obj.h.

445{ return oid; }

Referenced by Botan::X509::create_self_signed_cert(), encode_into(), Botan::X509_Object::hash_used_for_signature(), Botan::OCSP::CertID::is_id_for(), Botan::load_private_key(), Botan::load_public_key(), Botan::operator==(), Botan::pbes2_decrypt(), Botan::X509_Certificate::to_string(), Botan::X509_Object::verify_signature(), Botan::OCSP::Response::verify_signature(), and Botan::X509_CA::X509_CA().

## ◆ get_parameters()

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

Definition at line 446 of file asn1_obj.h.

446{ return parameters; }

Referenced by Botan::EMSA1::config_for_x509(), Botan::DL_Scheme_PrivateKey::DL_Scheme_PrivateKey(), Botan::EC_PrivateKey::EC_PrivateKey(), encode_into(), Botan::GOST_3410_PublicKey::GOST_3410_PublicKey(), Botan::operator==(), and Botan::pbes2_decrypt().

## ◆ parameters_are_empty()

bool Botan::AlgorithmIdentifier::parameters_are_empty | ( |  | ) | const
| inline

Definition at line 449 of file asn1_obj.h.

449{ return parameters.empty(); }

## ◆ parameters_are_null()

bool Botan::AlgorithmIdentifier::parameters_are_null | ( |  | ) | const

Definition at line 60 of file alg_id.cpp.

61 {
62 return (parameters.size() == 2 && (parameters[0] == 0x05) && (parameters[1] == 0x00));
63 }

References parameters.

## ◆ parameters_are_null_or_empty()

bool Botan::AlgorithmIdentifier::parameters_are_null_or_empty | ( |  | ) | const
| inline

Definition at line 451 of file asn1_obj.h.

452 {
453 return parameters_are_empty() || parameters_are_null();
454 }
Botan::AlgorithmIdentifier::parameters_are_empty
bool parameters_are_empty() const
Definition: asn1_obj.h:449
Botan::AlgorithmIdentifier::parameters_are_null
bool parameters_are_null() const
Definition: alg_id.cpp:60

Referenced by Botan::operator==().

## Member Data Documentation

## ◆ __pad0__

BOTAN_DEPRECATED_PUBLIC_MEMBER_VARIABLES Botan::AlgorithmIdentifier::__pad0__

Definition at line 456 of file asn1_obj.h.

## ◆ parameters

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

Definition at line 462 of file asn1_obj.h.

Referenced by AlgorithmIdentifier(), decode_from(), and parameters_are_null().

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

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