Botan: Botan::AlgorithmIdentifier Class Reference

Botan 1.10.17

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

`#include <alg_id.h>`

Inheritance diagram for Botan::AlgorithmIdentifier:

## Public Types
enum | Encoding_Option { USE_NULL_PARAM }

## Public Member Functions
| AlgorithmIdentifier ()
| AlgorithmIdentifier (const OID &, Encoding_Option)
| AlgorithmIdentifier (const std::string &, Encoding_Option)
| AlgorithmIdentifier (const OID &, const MemoryRegion< byte > &)
| AlgorithmIdentifier (const std::string &, const MemoryRegion< byte > &)
void | decode_from (class BER_Decoder &)
void | encode_into (class DER_Encoder &) const

## Public Attributes
OID | oid
SecureVector< byte > | parameters

## Detailed Description

Algorithm Identifier

Definition at line 20 of file alg_id.h.

## Member Enumeration Documentation

## ◆ Encoding_Option

enum Botan::AlgorithmIdentifier::Encoding_Option

Enumerator
USE_NULL_PARAM |

Definition at line 23 of file alg_id.h.

23 { USE_NULL_PARAM };
Botan::AlgorithmIdentifier::USE_NULL_PARAM
Definition: alg_id.h:23

## Constructor & Destructor Documentation

## ◆ AlgorithmIdentifier() [1/5]

Botan::AlgorithmIdentifier::AlgorithmIdentifier | ( |  | ) |
| inline

Definition at line 28 of file alg_id.h.

28 {}

## ◆ AlgorithmIdentifier() [2/5]

Botan::AlgorithmIdentifier::AlgorithmIdentifier | ( | const OID & | alg_id,
|  | Encoding_Option | option
| ) |  |

Definition at line 38 of file alg_id.cpp.

References oid, parameters, and USE_NULL_PARAM.

40 {
41 const byte DER_NULL[] = { 0x05, 0x00 };
42
43 oid = alg_id;
44
45 if(option == USE_NULL_PARAM)
46 {
47 parameters += std::pair<const byte*, size_t>(
48 DER_NULL, sizeof(DER_NULL));
49 }
50 }
Botan::AlgorithmIdentifier::parameters
SecureVector< byte > parameters
Definition: alg_id.h:36
Botan::byte
unsigned char byte
Definition: types.h:22
Botan::AlgorithmIdentifier::oid
OID oid
Definition: alg_id.h:35
Botan::AlgorithmIdentifier::USE_NULL_PARAM
Definition: alg_id.h:23

## ◆ AlgorithmIdentifier() [3/5]

Botan::AlgorithmIdentifier::AlgorithmIdentifier | ( | const std::string & | alg_id,
|  | Encoding_Option | option
| ) |  |

Definition at line 55 of file alg_id.cpp.

References Botan::OIDS::lookup(), oid, parameters, and USE_NULL_PARAM.

57 {
58 const byte DER_NULL[] = { 0x05, 0x00 };
59
60 oid = OIDS::lookup(alg_id);
61
62 if(option == USE_NULL_PARAM)
63 {
64 parameters += std::pair<const byte*, size_t>(
65 DER_NULL, sizeof(DER_NULL));
66 }
67 }
Botan::AlgorithmIdentifier::parameters
SecureVector< byte > parameters
Definition: alg_id.h:36
Botan::byte
unsigned char byte
Definition: types.h:22
Botan::OIDS::lookup
std::string lookup(const OID &oid)
Definition: oids.cpp:31
Botan::AlgorithmIdentifier::oid
OID oid
Definition: alg_id.h:35
Botan::AlgorithmIdentifier::USE_NULL_PARAM
Definition: alg_id.h:23

## ◆ AlgorithmIdentifier() [4/5]

Botan::AlgorithmIdentifier::AlgorithmIdentifier | ( | const OID & | alg_id,
|  | const MemoryRegion< byte > & | param
| ) |  |

Definition at line 18 of file alg_id.cpp.

References oid, and parameters.

20 {
21 oid = alg_id;
22 parameters = param;
23 }
Botan::AlgorithmIdentifier::parameters
SecureVector< byte > parameters
Definition: alg_id.h:36
Botan::AlgorithmIdentifier::oid
OID oid
Definition: alg_id.h:35

## ◆ AlgorithmIdentifier() [5/5]

Botan::AlgorithmIdentifier::AlgorithmIdentifier | ( | const std::string & | alg_id,
|  | const MemoryRegion< byte > & | param
| ) |  |

Definition at line 28 of file alg_id.cpp.

References Botan::OIDS::lookup(), oid, and parameters.

30 {
31 oid = OIDS::lookup(alg_id);
32 parameters = param;
33 }
Botan::AlgorithmIdentifier::parameters
SecureVector< byte > parameters
Definition: alg_id.h:36
Botan::OIDS::lookup
std::string lookup(const OID &oid)
Definition: oids.cpp:31
Botan::AlgorithmIdentifier::oid
OID oid
Definition: alg_id.h:35

## Member Function Documentation

## ◆ decode_from()

void Botan::AlgorithmIdentifier::decode_from | ( | class BER_Decoder & | from | ) |
| 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 103 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().

104 {
105 codec.start_cons(SEQUENCE)
106 .decode(oid)
107 .raw_bytes(parameters)
108 .end_cons();
109 }
Botan::AlgorithmIdentifier::parameters
SecureVector< byte > parameters
Definition: alg_id.h:36
Botan::AlgorithmIdentifier::oid
OID oid
Definition: alg_id.h:35
Botan::SEQUENCE
Definition: asn1_int.h:35

## ◆ encode_into()

void Botan::AlgorithmIdentifier::encode_into | ( | class DER_Encoder & | to | ) | const
| 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 92 of file alg_id.cpp.

References Botan::DER_Encoder::encode(), Botan::DER_Encoder::end_cons(), oid, parameters, Botan::DER_Encoder::raw_bytes(), Botan::SEQUENCE, and Botan::DER_Encoder::start_cons().

93 {
94 codec.start_cons(SEQUENCE)
95 .encode(oid)
96 .raw_bytes(parameters)
97 .end_cons();
98 }
Botan::AlgorithmIdentifier::parameters
SecureVector< byte > parameters
Definition: alg_id.h:36
Botan::AlgorithmIdentifier::oid
OID oid
Definition: alg_id.h:35
Botan::SEQUENCE
Definition: asn1_int.h:35

## Member Data Documentation

## ◆ oid

OID Botan::AlgorithmIdentifier::oid

Definition at line 35 of file alg_id.h.

Referenced by AlgorithmIdentifier(), Botan::EAC_Signed_Object::check_signature(), Botan::X509_Object::check_signature(), decode_from(), encode_into(), Botan::X509_Object::hash_used_for_signature(), Botan::make_public_key(), and Botan::operator==().

## ◆ parameters

SecureVector<byte> Botan::AlgorithmIdentifier::parameters

Definition at line 36 of file alg_id.h.

Referenced by AlgorithmIdentifier(), decode_from(), Botan::DL_Scheme_PrivateKey::DL_Scheme_PrivateKey(), Botan::DL_Scheme_PublicKey::DL_Scheme_PublicKey(), Botan::EC_PrivateKey::EC_PrivateKey(), Botan::EC_PublicKey::EC_PublicKey(), encode_into(), and Botan::operator==().

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

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