Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Member Functions | List of all members
Botan::DER_Encoder Class Reference

`#include <der_enc.h>`

## Public Member Functions
DER_Encoder & | add_object (ASN1_Tag type_tag, ASN1_Tag class_tag, const uint8_t rep[], size_t length)
DER_Encoder & | add_object (ASN1_Tag type_tag, ASN1_Tag class_tag, const std::vector< uint8_t > &rep)
DER_Encoder & | add_object (ASN1_Tag type_tag, ASN1_Tag class_tag, const secure_vector< uint8_t > &rep)
DER_Encoder & | add_object (ASN1_Tag type_tag, ASN1_Tag class_tag, const std::string &str)
DER_Encoder & | add_object (ASN1_Tag type_tag, ASN1_Tag class_tag, uint8_t val)
DER_Encoder & | encode (bool b)
DER_Encoder & | encode (size_t s)
DER_Encoder & | encode (const BigInt &n)
DER_Encoder & | encode (const secure_vector< uint8_t > &v, ASN1_Tag real_type)
DER_Encoder & | encode (const std::vector< uint8_t > &v, ASN1_Tag real_type)
DER_Encoder & | encode (const uint8_t val[], size_t len, ASN1_Tag real_type)
DER_Encoder & | encode (bool b, ASN1_Tag type_tag, ASN1_Tag class_tag=CONTEXT_SPECIFIC)
DER_Encoder & | encode (size_t s, ASN1_Tag type_tag, ASN1_Tag class_tag=CONTEXT_SPECIFIC)
DER_Encoder & | encode (const BigInt &n, ASN1_Tag type_tag, ASN1_Tag class_tag=CONTEXT_SPECIFIC)
DER_Encoder & | encode (const std::vector< uint8_t > &v, ASN1_Tag real_type, ASN1_Tag type_tag, ASN1_Tag class_tag=CONTEXT_SPECIFIC)
DER_Encoder & | encode (const secure_vector< uint8_t > &v, ASN1_Tag real_type, ASN1_Tag type_tag, ASN1_Tag class_tag=CONTEXT_SPECIFIC)
DER_Encoder & | encode (const uint8_t v[], size_t len, ASN1_Tag real_type, ASN1_Tag type_tag, ASN1_Tag class_tag=CONTEXT_SPECIFIC)
DER_Encoder & | encode (const ASN1_Object &obj)
DER_Encoder & | encode_if (bool pred, DER_Encoder &enc)
DER_Encoder & | encode_if (bool pred, const ASN1_Object &obj)
template<typename T >
DER_Encoder & | encode_list (const std::vector< T > &values)
DER_Encoder & | encode_null ()
template<typename T >
DER_Encoder & | encode_optional (const T &value, const T &default_value)
DER_Encoder & | end_cons ()
DER_Encoder & | end_explicit ()
secure_vector< uint8_t > | get_contents ()
std::vector< uint8_t > | get_contents_unlocked ()
DER_Encoder & | raw_bytes (const uint8_t val[], size_t len)
DER_Encoder & | raw_bytes (const secure_vector< uint8_t > &val)
DER_Encoder & | raw_bytes (const std::vector< uint8_t > &val)
DER_Encoder & | start_cons (ASN1_Tag type_tag, ASN1_Tag class_tag=UNIVERSAL)
DER_Encoder & | start_explicit (uint16_t type_tag)

## Detailed Description

General DER Encoding Object

Definition at line 22 of file der_enc.h.

## Member Function Documentation

DER_Encoder & Botan::DER_Encoder::add_object | ( | ASN1_Tag | type_tag,
|  | ASN1_Tag | class_tag,
|  | const uint8_t | rep[],
|  | size_t | length
| ) |  |

Definition at line 381 of file der_enc.cpp.

References raw_bytes().

Referenced by add_object(), encode(), Botan::ASN1_String::encode_into(), Botan::OID::encode_into(), Botan::X509_Time::encode_into(), and encode_null().

383 {
384 secure_vector<uint8_t> buffer;
385 buffer += encode_tag(type_tag, class_tag);
386 buffer += encode_length(length);
387 buffer += std::make_pair(rep, length);
388
389 return raw_bytes(buffer);
390 }
Botan::DER_Encoder::raw_bytes
DER_Encoder & raw_bytes(const uint8_t val[], size_t len)
Definition: der_enc.cpp:195

DER_Encoder& Botan::DER_Encoder::add_object | ( | ASN1_Tag | type_tag,
|  | ASN1_Tag | class_tag,
|  | const std::vector< uint8_t > & | rep
| ) |  |
| inline

Definition at line 99 of file der_enc.h.

101 {
102 return add_object(type_tag, class_tag, rep.data(), rep.size());
103 }
Botan::DER_Encoder::add_object
DER_Encoder & add_object(ASN1_Tag type_tag, ASN1_Tag class_tag, const uint8_t rep[], size_t length)
Definition: der_enc.cpp:381

DER_Encoder& Botan::DER_Encoder::add_object | ( | ASN1_Tag | type_tag,
|  | ASN1_Tag | class_tag,
|  | const secure_vector< uint8_t > & | rep
| ) |  |
| inline

Definition at line 105 of file der_enc.h.

107 {
108 return add_object(type_tag, class_tag, rep.data(), rep.size());
109 }
Botan::DER_Encoder::add_object
DER_Encoder & add_object(ASN1_Tag type_tag, ASN1_Tag class_tag, const uint8_t rep[], size_t length)
Definition: der_enc.cpp:381

DER_Encoder & Botan::DER_Encoder::add_object | ( | ASN1_Tag | type_tag,
|  | ASN1_Tag | class_tag,
|  | const std::string & | str
| ) |  |

Definition at line 395 of file der_enc.cpp.

References add_object().

397 {
398 const uint8_t* rep = reinterpret_cast<const uint8_t*>(rep_str.data());
399 const size_t rep_len = rep_str.size();
400 return add_object(type_tag, class_tag, rep, rep_len);
401 }
Botan::DER_Encoder::add_object
DER_Encoder & add_object(ASN1_Tag type_tag, ASN1_Tag class_tag, const uint8_t rep[], size_t length)
Definition: der_enc.cpp:381

DER_Encoder & Botan::DER_Encoder::add_object | ( | ASN1_Tag | type_tag,
|  | ASN1_Tag | class_tag,
|  | uint8_t | val
| ) |  |

Definition at line 406 of file der_enc.cpp.

References add_object().

408 {
409 return add_object(type_tag, class_tag, &rep, 1);
410 }
Botan::DER_Encoder::add_object
DER_Encoder & add_object(ASN1_Tag type_tag, ASN1_Tag class_tag, const uint8_t rep[], size_t length)
Definition: der_enc.cpp:381

DER_Encoder & Botan::DER_Encoder::encode | ( | bool | b | ) |

Definition at line 216 of file der_enc.cpp.

References Botan::BOOLEAN, and Botan::UNIVERSAL.

Referenced by Botan::GOST_3410_PublicKey::algorithm_identifier(), Botan::OCSP::Request::BER_encode(), Botan::PKCS8::BER_encode(), Botan::PKCS8::BER_encode_encrypted_pbkdf_iter(), Botan::PKCS8::BER_encode_encrypted_pbkdf_msec(), Botan::X509::create_cert_req(), Botan::EC_Group::DER_encode(), Botan::TLS::Session::DER_encode(), Botan::DL_Group::DER_encode(), encode(), encode_if(), Botan::Attribute::encode_into(), Botan::AlternativeName::encode_into(), Botan::AlgorithmIdentifier::encode_into(), Botan::OCSP::CertID::encode_into(), Botan::CRL_Entry::encode_into(), Botan::X509_Object::encode_into(), Botan::Extensions::encode_into(), Botan::X509_Object::make_signed(), Botan::Curve25519_PrivateKey::private_key_bits(), Botan::DL_Scheme_PrivateKey::private_key_bits(), Botan::McEliece_PrivateKey::private_key_bits(), Botan::EC_PrivateKey::private_key_bits(), Botan::RSA_PrivateKey::private_key_bits(), Botan::Private_Key::private_key_info(), Botan::DL_Scheme_PublicKey::public_key_bits(), Botan::Curve25519_PublicKey::public_key_bits(), Botan::McEliece_PublicKey::public_key_bits(), Botan::RSA_PublicKey::public_key_bits(), Botan::GOST_3410_PublicKey::public_key_bits(), Botan::TPM_PrivateKey::public_key_bits(), and Botan::Public_Key::subject_public_key().

217 {
218 return encode(is_true, BOOLEAN, UNIVERSAL);
219 }
Botan::UNIVERSAL
Definition: asn1_obj.h:23
Botan::DER_Encoder::encode
DER_Encoder & encode(bool b)
Definition: der_enc.cpp:216
Botan::BOOLEAN
Definition: asn1_obj.h:32

DER_Encoder & Botan::DER_Encoder::encode | ( | size_t | s | ) |

Definition at line 224 of file der_enc.cpp.

References encode(), Botan::INTEGER, and Botan::UNIVERSAL.

225 {
226 return encode(BigInt(n), INTEGER, UNIVERSAL);
227 }
Botan::INTEGER
Definition: asn1_obj.h:33
Botan::UNIVERSAL
Definition: asn1_obj.h:23
Botan::DER_Encoder::encode
DER_Encoder & encode(bool b)
Definition: der_enc.cpp:216

DER_Encoder & Botan::DER_Encoder::encode | ( | const BigInt & | n | ) |

Definition at line 232 of file der_enc.cpp.

References encode(), Botan::INTEGER, and Botan::UNIVERSAL.

233 {
234 return encode(n, INTEGER, UNIVERSAL);
235 }
Botan::INTEGER
Definition: asn1_obj.h:33
Botan::UNIVERSAL
Definition: asn1_obj.h:23
Botan::DER_Encoder::encode
DER_Encoder & encode(bool b)
Definition: der_enc.cpp:216

DER_Encoder & Botan::DER_Encoder::encode | ( | const secure_vector< uint8_t > & | v,
|  | ASN1_Tag | real_type
| ) |  |

Definition at line 240 of file der_enc.cpp.

References encode(), and Botan::UNIVERSAL.

242 {
243 return encode(bytes.data(), bytes.size(),
244 real_type, real_type, UNIVERSAL);
245 }
Botan::UNIVERSAL
Definition: asn1_obj.h:23
Botan::DER_Encoder::encode
DER_Encoder & encode(bool b)
Definition: der_enc.cpp:216

DER_Encoder & Botan::DER_Encoder::encode | ( | const std::vector< uint8_t > & | v,
|  | ASN1_Tag | real_type
| ) |  |

Definition at line 250 of file der_enc.cpp.

References encode(), and Botan::UNIVERSAL.

252 {
253 return encode(bytes.data(), bytes.size(),
254 real_type, real_type, UNIVERSAL);
255 }
Botan::UNIVERSAL
Definition: asn1_obj.h:23
Botan::DER_Encoder::encode
DER_Encoder & encode(bool b)
Definition: der_enc.cpp:216

DER_Encoder & Botan::DER_Encoder::encode | ( | const uint8_t | val[],
|  | size_t | len,
|  | ASN1_Tag | real_type
| ) |  |

Definition at line 260 of file der_enc.cpp.

References encode(), and Botan::UNIVERSAL.

262 {
263 return encode(bytes, length, real_type, real_type, UNIVERSAL);
264 }
Botan::UNIVERSAL
Definition: asn1_obj.h:23
Botan::DER_Encoder::encode
DER_Encoder & encode(bool b)
Definition: der_enc.cpp:216

DER_Encoder & Botan::DER_Encoder::encode | ( | bool | b,
|  | ASN1_Tag | type_tag,
|  | ASN1_Tag | class_tag = `CONTEXT_SPECIFIC`
| ) |  |

Definition at line 269 of file der_enc.cpp.

References add_object().

271 {
272 uint8_t val = is_true ? 0xFF : 0x00;
273 return add_object(type_tag, class_tag, &val, 1);
274 }
Botan::DER_Encoder::add_object
DER_Encoder & add_object(ASN1_Tag type_tag, ASN1_Tag class_tag, const uint8_t rep[], size_t length)
Definition: der_enc.cpp:381

DER_Encoder & Botan::DER_Encoder::encode | ( | size_t | s,
|  | ASN1_Tag | type_tag,
|  | ASN1_Tag | class_tag = `CONTEXT_SPECIFIC`
| ) |  |

Definition at line 279 of file der_enc.cpp.

References encode().

281 {
282 return encode(BigInt(n), type_tag, class_tag);
283 }
Botan::DER_Encoder::encode
DER_Encoder & encode(bool b)
Definition: der_enc.cpp:216

DER_Encoder & Botan::DER_Encoder::encode | ( | const BigInt & | n,
|  | ASN1_Tag | type_tag,
|  | ASN1_Tag | class_tag = `CONTEXT_SPECIFIC`
| ) |  |

Definition at line 288 of file der_enc.cpp.

References add_object(), Botan::BigInt::bits(), Botan::BigInt::bytes(), and Botan::BigInt::encode().

290 {
291 if(n == 0)
292 return add_object(type_tag, class_tag, 0);
293
294 bool extra_zero = (n.bits() % 8 == 0);
295 secure_vector<uint8_t> contents(extra_zero + n.bytes());
296 BigInt::encode(&contents[extra_zero], n);
297 if(n < 0)
298 {
299 for(size_t i = 0; i != contents.size(); ++i)
300 contents[i] = ~contents[i];
301 for(size_t i = contents.size(); i > 0; --i)
302 if(++contents[i-1])
303 break;
304 }
305
306 return add_object(type_tag, class_tag, contents);
307 }
Botan::DER_Encoder::add_object
DER_Encoder & add_object(ASN1_Tag type_tag, ASN1_Tag class_tag, const uint8_t rep[], size_t length)
Definition: der_enc.cpp:381
Botan::BigInt::encode
static std::vector< uint8_t > encode(const BigInt &n, Base base=Binary)
Definition: big_code.cpp:54

DER_Encoder & Botan::DER_Encoder::encode | ( | const std::vector< uint8_t > & | v,
|  | ASN1_Tag | real_type,
|  | ASN1_Tag | type_tag,
|  | ASN1_Tag | class_tag = `CONTEXT_SPECIFIC`
| ) |  |

Definition at line 323 of file der_enc.cpp.

References encode().

326 {
327 return encode(bytes.data(), bytes.size(),
328 real_type, type_tag, class_tag);
329 }
Botan::DER_Encoder::encode
DER_Encoder & encode(bool b)
Definition: der_enc.cpp:216

DER_Encoder & Botan::DER_Encoder::encode | ( | const secure_vector< uint8_t > & | v,
|  | ASN1_Tag | real_type,
|  | ASN1_Tag | type_tag,
|  | ASN1_Tag | class_tag = `CONTEXT_SPECIFIC`
| ) |  |

Definition at line 312 of file der_enc.cpp.

References encode().

315 {
316 return encode(bytes.data(), bytes.size(),
317 real_type, type_tag, class_tag);
318 }
Botan::DER_Encoder::encode
DER_Encoder & encode(bool b)
Definition: der_enc.cpp:216

DER_Encoder & Botan::DER_Encoder::encode | ( | const uint8_t | v[],
|  | size_t | len,
|  | ASN1_Tag | real_type,
|  | ASN1_Tag | type_tag,
|  | ASN1_Tag | class_tag = `CONTEXT_SPECIFIC`
| ) |  |

Definition at line 334 of file der_enc.cpp.

References add_object(), Botan::BIT_STRING, and Botan::OCTET_STRING.

337 {
338 if(real_type != OCTET_STRING && real_type != BIT_STRING)
339 throw Invalid_Argument("DER_Encoder: Invalid tag for byte/bit string");
340
341 if(real_type == BIT_STRING)
342 {
343 secure_vector<uint8_t> encoded;
344 encoded.push_back(0);
345 encoded += std::make_pair(bytes, length);
346 return add_object(type_tag, class_tag, encoded);
347 }
348 else
349 return add_object(type_tag, class_tag, bytes, length);
350 }
Botan::DER_Encoder::add_object
DER_Encoder & add_object(ASN1_Tag type_tag, ASN1_Tag class_tag, const uint8_t rep[], size_t length)
Definition: der_enc.cpp:381
Botan::OCTET_STRING
Definition: asn1_obj.h:35
Botan::BIT_STRING
Definition: asn1_obj.h:34

DER_Encoder & Botan::DER_Encoder::encode | ( | const ASN1_Object & | obj | ) |

Definition at line 372 of file der_enc.cpp.

References Botan::ASN1_Object::encode_into().

373 {
374 obj.encode_into(*this);
375 return (*this);
376 }

DER_Encoder & Botan::DER_Encoder::encode_if | ( | bool | pred,
|  | DER_Encoder & | enc
| ) |  |

Definition at line 355 of file der_enc.cpp.

References get_contents(), and raw_bytes().

356 {
357 if(cond)
358 return raw_bytes(codec.get_contents());
359 return (*this);
360 }
Botan::DER_Encoder::raw_bytes
DER_Encoder & raw_bytes(const uint8_t val[], size_t len)
Definition: der_enc.cpp:195

DER_Encoder & Botan::DER_Encoder::encode_if | ( | bool | pred,
|  | const ASN1_Object & | obj
| ) |  |

Definition at line 362 of file der_enc.cpp.

References encode().

363 {
364 if(cond)
365 encode(obj);
366 return (*this);
367 }
Botan::DER_Encoder::encode
DER_Encoder & encode(bool b)
Definition: der_enc.cpp:216
template<typename T >

DER_Encoder& Botan::DER_Encoder::encode_list | ( | const std::vector< T > & | values | ) |
| inline

Definition at line 85 of file der_enc.h.

References Botan::PEM_Code::encode().

Referenced by Botan::PK_Signer::signature().

86 {
87 for(size_t i = 0; i != values.size(); ++i)
88 encode(values[i]);
89 return (*this);
90 }
Botan::DER_Encoder::encode
DER_Encoder & encode(bool b)
Definition: der_enc.cpp:216

DER_Encoder & Botan::DER_Encoder::encode_null | ( |  | ) |

Definition at line 208 of file der_enc.cpp.

References add_object(), Botan::NULL_TAG, and Botan::UNIVERSAL.

Referenced by Botan::EC_Group::DER_encode().

209 {
210 return add_object(NULL_TAG, UNIVERSAL, nullptr, 0);
211 }
Botan::DER_Encoder::add_object
DER_Encoder & add_object(ASN1_Tag type_tag, ASN1_Tag class_tag, const uint8_t rep[], size_t length)
Definition: der_enc.cpp:381
Botan::UNIVERSAL
Definition: asn1_obj.h:23
Botan::NULL_TAG
Definition: asn1_obj.h:36
template<typename T >

DER_Encoder& Botan::DER_Encoder::encode_optional | ( | const T & | value,
|  | const T & | default_value
| ) |  |
| inline

Definition at line 77 of file der_enc.h.

References Botan::PEM_Code::encode().

Referenced by Botan::Extensions::encode_into().

78 {
79 if(value != default_value)
80 encode(value);
81 return (*this);
82 }
Botan::DER_Encoder::encode
DER_Encoder & encode(bool b)
Definition: der_enc.cpp:216

DER_Encoder & Botan::DER_Encoder::end_cons | ( |  | ) |

Definition at line 147 of file der_enc.cpp.

References raw_bytes().

Referenced by Botan::GOST_3410_PublicKey::algorithm_identifier(), Botan::OCSP::Request::BER_encode(), Botan::PKCS8::BER_encode(), Botan::PKCS8::BER_encode_encrypted_pbkdf_iter(), Botan::PKCS8::BER_encode_encrypted_pbkdf_msec(), Botan::X509::create_cert_req(), Botan::EC_Group::DER_encode(), Botan::TLS::Session::DER_encode(), Botan::DL_Group::DER_encode(), Botan::Attribute::encode_into(), Botan::AlternativeName::encode_into(), Botan::AlgorithmIdentifier::encode_into(), Botan::X509_DN::encode_into(), Botan::OCSP::CertID::encode_into(), Botan::CRL_Entry::encode_into(), Botan::X509_Object::encode_into(), Botan::Extensions::encode_into(), end_explicit(), Botan::Curve25519_PrivateKey::private_key_bits(), Botan::McEliece_PrivateKey::private_key_bits(), Botan::EC_PrivateKey::private_key_bits(), Botan::RSA_PrivateKey::private_key_bits(), Botan::Private_Key::private_key_info(), Botan::Curve25519_PublicKey::public_key_bits(), Botan::RSA_PublicKey::public_key_bits(), Botan::McEliece_PublicKey::public_key_bits(), Botan::TPM_PrivateKey::public_key_bits(), Botan::ASN1::put_in_sequence(), Botan::PK_Signer::signature(), and Botan::Public_Key::subject_public_key().

148 {
149 if(m_subsequences.empty())
150 throw Invalid_State("DER_Encoder::end_cons: No such sequence");
151
152 secure_vector<uint8_t> seq = m_subsequences[m_subsequences.size()-1].get_contents();
153 m_subsequences.pop_back();
154 raw_bytes(seq);
155 return (*this);
156 }
Botan::DER_Encoder::raw_bytes
DER_Encoder & raw_bytes(const uint8_t val[], size_t len)
Definition: der_enc.cpp:195

DER_Encoder & Botan::DER_Encoder::end_explicit | ( |  | ) |

Definition at line 174 of file der_enc.cpp.

References end_cons().

Referenced by Botan::OCSP::Request::BER_encode(), Botan::X509::create_cert_req(), and Botan::AlternativeName::encode_into().

175 {
176 return end_cons();
177 }
Botan::DER_Encoder::end_cons
DER_Encoder & end_cons()
Definition: der_enc.cpp:147

secure_vector< uint8_t > Botan::DER_Encoder::get_contents | ( |  | ) |

Definition at line 124 of file der_enc.cpp.

Referenced by Botan::X509::create_cert_req(), Botan::TLS::Session::DER_encode(), encode_if(), Botan::Curve25519_PrivateKey::private_key_bits(), Botan::DL_Scheme_PrivateKey::private_key_bits(), Botan::McEliece_PrivateKey::private_key_bits(), Botan::EC_PrivateKey::private_key_bits(), Botan::RSA_PrivateKey::private_key_bits(), and Botan::Private_Key::private_key_info().

125 {
126 if(m_subsequences.size() != 0)
127 throw Invalid_State("DER_Encoder: Sequence hasn't been marked done");
128
129 secure_vector<uint8_t> output;
130 std::swap(output, m_contents);
131 return output;
132 }

std::vector<uint8_t> Botan::DER_Encoder::get_contents_unlocked | ( |  | ) |
| inline

Definition at line 27 of file der_enc.h.

References Botan::unlock().

Referenced by Botan::GOST_3410_PublicKey::algorithm_identifier(), Botan::OCSP::Request::BER_encode(), Botan::X509_Object::BER_encode(), Botan::PKCS8::BER_encode(), Botan::PKCS8::BER_encode_encrypted_pbkdf_iter(), Botan::PKCS8::BER_encode_encrypted_pbkdf_msec(), Botan::EC_Group::DER_encode(), Botan::DL_Group::DER_encode(), Botan::Certificate_Store_In_SQL::find_cert(), Botan::Certificate_Store_In_SQL::insert_cert(), Botan::X509_Object::make_signed(), Botan::DL_Scheme_PublicKey::public_key_bits(), Botan::Curve25519_PublicKey::public_key_bits(), Botan::McEliece_PublicKey::public_key_bits(), Botan::RSA_PublicKey::public_key_bits(), Botan::GOST_3410_PublicKey::public_key_bits(), Botan::TPM_PrivateKey::public_key_bits(), Botan::ASN1::put_in_sequence(), Botan::Certificate_Store_In_SQL::revoke_cert(), Botan::PK_Signer::signature(), and Botan::Public_Key::subject_public_key().

28 { return unlock(get_contents()); }
Botan::DER_Encoder::get_contents
secure_vector< uint8_t > get_contents()
Definition: der_enc.cpp:124
Botan::unlock
std::vector< T > unlock(const secure_vector< T > &in)
Definition: secmem.h:125

DER_Encoder & Botan::DER_Encoder::raw_bytes | ( | const uint8_t | val[],
|  | size_t | len
| ) |  |

Definition at line 195 of file der_enc.cpp.

Referenced by add_object(), Botan::X509::create_cert_req(), encode_if(), Botan::Attribute::encode_into(), Botan::X509_DN::encode_into(), Botan::AlgorithmIdentifier::encode_into(), Botan::X509_Object::encode_into(), end_cons(), Botan::X509_Object::make_signed(), Botan::ASN1::put_in_sequence(), and raw_bytes().

196 {
197 if(m_subsequences.size())
198 m_subsequences[m_subsequences.size()-1].add_bytes(bytes, length);
199 else
200 m_contents += std::make_pair(bytes, length);
201
202 return (*this);
203 }

DER_Encoder & Botan::DER_Encoder::raw_bytes | ( | const secure_vector< uint8_t > & | val | ) |

Definition at line 182 of file der_enc.cpp.

References raw_bytes().

183 {
184 return raw_bytes(val.data(), val.size());
185 }
Botan::DER_Encoder::raw_bytes
DER_Encoder & raw_bytes(const uint8_t val[], size_t len)
Definition: der_enc.cpp:195

DER_Encoder & Botan::DER_Encoder::raw_bytes | ( | const std::vector< uint8_t > & | val | ) |

Definition at line 187 of file der_enc.cpp.

References raw_bytes().

188 {
189 return raw_bytes(val.data(), val.size());
190 }
Botan::DER_Encoder::raw_bytes
DER_Encoder & raw_bytes(const uint8_t val[], size_t len)
Definition: der_enc.cpp:195

DER_Encoder & Botan::DER_Encoder::start_cons | ( | ASN1_Tag | type_tag,
|  | ASN1_Tag | class_tag = `UNIVERSAL`
| ) |  |

Definition at line 137 of file der_enc.cpp.

Referenced by Botan::GOST_3410_PublicKey::algorithm_identifier(), Botan::OCSP::Request::BER_encode(), Botan::PKCS8::BER_encode(), Botan::PKCS8::BER_encode_encrypted_pbkdf_iter(), Botan::PKCS8::BER_encode_encrypted_pbkdf_msec(), Botan::X509::create_cert_req(), Botan::EC_Group::DER_encode(), Botan::TLS::Session::DER_encode(), Botan::DL_Group::DER_encode(), Botan::Attribute::encode_into(), Botan::AlternativeName::encode_into(), Botan::AlgorithmIdentifier::encode_into(), Botan::X509_DN::encode_into(), Botan::OCSP::CertID::encode_into(), Botan::CRL_Entry::encode_into(), Botan::X509_Object::encode_into(), Botan::Extensions::encode_into(), Botan::X509_Object::make_signed(), Botan::Curve25519_PrivateKey::private_key_bits(), Botan::McEliece_PrivateKey::private_key_bits(), Botan::EC_PrivateKey::private_key_bits(), Botan::RSA_PrivateKey::private_key_bits(), Botan::Private_Key::private_key_info(), Botan::Curve25519_PublicKey::public_key_bits(), Botan::RSA_PublicKey::public_key_bits(), Botan::McEliece_PublicKey::public_key_bits(), Botan::TPM_PrivateKey::public_key_bits(), Botan::ASN1::put_in_sequence(), Botan::PK_Signer::signature(), start_explicit(), and Botan::Public_Key::subject_public_key().

139 {
140 m_subsequences.push_back(DER_Sequence(type_tag, class_tag));
141 return (*this);
142 }

DER_Encoder & Botan::DER_Encoder::start_explicit | ( | uint16_t | type_tag | ) |

Definition at line 161 of file der_enc.cpp.

References Botan::CONTEXT_SPECIFIC, Botan::SET, and start_cons().

Referenced by Botan::OCSP::Request::BER_encode(), Botan::X509::create_cert_req(), and Botan::AlternativeName::encode_into().

162 {
163 ASN1_Tag type_tag = static_cast<ASN1_Tag>(type_no);
164
165 if(type_tag == SET)
166 throw Internal_Error("DER_Encoder.start_explicit(SET); cannot perform");
167
168 return start_cons(type_tag, CONTEXT_SPECIFIC);
169 }
Botan::CONTEXT_SPECIFIC
Definition: asn1_obj.h:25
Botan::ASN1_Tag
ASN1_Tag
Definition: asn1_obj.h:22
Botan::SET
Definition: asn1_obj.h:40
Botan::DER_Encoder::start_cons
DER_Encoder & start_cons(ASN1_Tag type_tag, ASN1_Tag class_tag=UNIVERSAL)
Definition: der_enc.cpp:137

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

- src/lib/asn1/der_enc.h
- src/lib/asn1/der_enc.cpp