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

#include <alg_id.h>

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

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

Detailed Description

Algorithm Identifier

Definition at line 20 of file alg_id.h.

Member Enumeration Documentation

Enumerator
USE_NULL_PARAM 

Definition at line 23 of file alg_id.h.

Constructor & Destructor Documentation

Botan::AlgorithmIdentifier::AlgorithmIdentifier ( )
inline

Definition at line 28 of file alg_id.h.

28 {}
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  }
SecureVector< byte > parameters
Definition: alg_id.h:36
unsigned char byte
Definition: types.h:22
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  }
SecureVector< byte > parameters
Definition: alg_id.h:36
unsigned char byte
Definition: types.h:22
std::string lookup(const OID &oid)
Definition: oids.cpp:31
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  }
SecureVector< byte > parameters
Definition: alg_id.h:36
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  }
SecureVector< byte > parameters
Definition: alg_id.h:36
std::string lookup(const OID &oid)
Definition: oids.cpp:31

Member Function Documentation

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

Decode whatever this object is from from

Parameters
fromthe 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  }
SecureVector< byte > parameters
Definition: alg_id.h:36
void Botan::AlgorithmIdentifier::encode_into ( class DER_Encoder to) const
virtual

Encode whatever this object is into to

Parameters
tothe 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  }
SecureVector< byte > parameters
Definition: alg_id.h:36

Member Data Documentation

OID Botan::AlgorithmIdentifier::oid
SecureVector<byte> Botan::AlgorithmIdentifier::parameters

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