Botan 3.9.0
Crypto and TLS for C&
Botan::DER_Encoder Class Referencefinal

#include <der_enc.h>

Public Types

typedef std::function< void(const uint8_t[], size_t)> append_fn

Public Member Functions

DER_Encoderadd_object (ASN1_Type type_tag, ASN1_Class class_tag, const secure_vector< uint8_t > &rep)
DER_Encoderadd_object (ASN1_Type type_tag, ASN1_Class class_tag, const std::vector< uint8_t > &rep)
DER_Encoderadd_object (ASN1_Type type_tag, ASN1_Class class_tag, const uint8_t rep[], size_t length)
DER_Encoderadd_object (ASN1_Type type_tag, ASN1_Class class_tag, std::span< const uint8_t > rep)
DER_Encoderadd_object (ASN1_Type type_tag, ASN1_Class class_tag, std::string_view str)
DER_Encoderadd_object (ASN1_Type type_tag, ASN1_Class class_tag, uint8_t val)
 DER_Encoder ()=default
BOTAN_FUTURE_EXPLICIT DER_Encoder (append_fn append)
BOTAN_FUTURE_EXPLICIT DER_Encoder (secure_vector< uint8_t > &vec)
BOTAN_FUTURE_EXPLICIT DER_Encoder (std::vector< uint8_t > &vec)
DER_Encoderencode (bool b)
DER_Encoderencode (bool b, ASN1_Type type_tag, ASN1_Class class_tag=ASN1_Class::ContextSpecific)
DER_Encoderencode (const ASN1_Object &obj)
DER_Encoderencode (const BigInt &n)
DER_Encoderencode (const BigInt &n, ASN1_Type type_tag, ASN1_Class class_tag=ASN1_Class::ContextSpecific)
template<typename Alloc>
DER_Encoderencode (const std::vector< uint8_t, Alloc > &bytes, ASN1_Type real_type, ASN1_Type type_tag, ASN1_Class class_tag)
template<typename Alloc>
DER_Encoderencode (const std::vector< uint8_t, Alloc > &vec, ASN1_Type real_type)
DER_Encoderencode (const uint8_t v[], size_t len, ASN1_Type real_type, ASN1_Type type_tag, ASN1_Class class_tag=ASN1_Class::ContextSpecific)
DER_Encoderencode (const uint8_t val[], size_t len, ASN1_Type real_type)
DER_Encoderencode (size_t s)
DER_Encoderencode (size_t s, ASN1_Type type_tag, ASN1_Class class_tag=ASN1_Class::ContextSpecific)
DER_Encoderencode_if (bool pred, bool num)
DER_Encoderencode_if (bool pred, const ASN1_Object &obj)
DER_Encoderencode_if (bool pred, DER_Encoder &enc)
DER_Encoderencode_if (bool pred, size_t num)
template<typename T>
DER_Encoderencode_list (const std::vector< T > &values)
DER_Encoderencode_null ()
template<typename T>
DER_Encoderencode_optional (const std::optional< T > &value)
template<typename T>
DER_Encoderencode_optional (const T &value, const T &default_value)
DER_Encoderend_cons ()
DER_Encoderend_explicit ()
secure_vector< uint8_t > get_contents ()
std::vector< uint8_t > get_contents_unlocked ()
template<typename Alloc>
DER_Encoderraw_bytes (const std::vector< uint8_t, Alloc > &val)
DER_Encoderraw_bytes (const uint8_t val[], size_t len)
DER_Encoderstart_cons (ASN1_Type type_tag, ASN1_Class class_tag)
DER_Encoderstart_context_specific (uint32_t tag)
DER_Encoderstart_explicit (uint16_t type_tag)
DER_Encoderstart_explicit_context_specific (uint32_t tag)
DER_Encoderstart_sequence ()
DER_Encoderstart_set ()

Detailed Description

General DER Encoding Object

Definition at line 23 of file der_enc.h.

Member Typedef Documentation

◆ append_fn

typedef std::function<void(const uint8_t[], size_t)> Botan::DER_Encoder::append_fn

Definition at line 25 of file der_enc.h.

Constructor & Destructor Documentation

◆ DER_Encoder() [1/4]

◆ DER_Encoder() [2/4]

Botan::DER_Encoder::DER_Encoder ( secure_vector< uint8_t > & vec)

DER encode, writing to

Parameters
vecIf this constructor is used, get_contents* may not be called.

Definition at line 68 of file der_enc.cpp.

68 {
69 m_append_output = [&vec](const uint8_t b[], size_t l) { vec.insert(vec.end(), b, b + l); };
70}

◆ DER_Encoder() [3/4]

Botan::DER_Encoder::DER_Encoder ( std::vector< uint8_t > & vec)

DER encode, writing to

Parameters
vecIf this constructor is used, get_contents* may not be called.

Definition at line 72 of file der_enc.cpp.

72 {
73 m_append_output = [&vec](const uint8_t b[], size_t l) { vec.insert(vec.end(), b, b + l); };
74}

◆ DER_Encoder() [4/4]

BOTAN_FUTURE_EXPLICIT Botan::DER_Encoder::DER_Encoder ( append_fn append)
inline

DER encode, calling append to write output If this constructor is used, get_contents* may not be called.

Definition at line 50 of file der_enc.h.

50: m_append_output(std::move(append)) {}

References BOTAN_FUTURE_EXPLICIT.

Member Function Documentation

◆ add_object() [1/6]

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

Definition at line 194 of file der_enc.h.

194 {
195 return add_object(type_tag, class_tag, std::span{rep});
196 }
DER_Encoder & add_object(ASN1_Type type_tag, ASN1_Class class_tag, const uint8_t rep[], size_t length)
Definition der_enc.cpp:224

References add_object(), and DER_Encoder().

◆ add_object() [2/6]

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

Definition at line 190 of file der_enc.h.

190 {
191 return add_object(type_tag, class_tag, std::span{rep});
192 }

References add_object(), and DER_Encoder().

◆ add_object() [3/6]

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

Definition at line 224 of file der_enc.cpp.

224 {
225 std::vector<uint8_t> hdr;
226 encode_tag(hdr, type_tag, class_tag);
227 encode_length(hdr, length);
228
229 if(!m_subsequences.empty()) {
230 m_subsequences[m_subsequences.size() - 1].add_bytes(hdr.data(), hdr.size(), rep, length);
231 } else if(m_append_output) {
232 m_append_output(hdr.data(), hdr.size());
233 m_append_output(rep, length);
234 } else {
235 m_default_outbuf += hdr;
236 m_default_outbuf += std::make_pair(rep, length);
237 }
238
239 return (*this);
240}

References DER_Encoder().

Referenced by add_object(), add_object(), add_object(), add_object(), add_object(), encode(), encode(), encode(), Botan::AlternativeName::encode_into(), Botan::ASN1_String::encode_into(), Botan::ASN1_Time::encode_into(), Botan::Cert_Extension::CRL_Distribution_Points::Distribution_Point::encode_into(), Botan::Cert_Extension::IPAddressBlocks::IPAddressFamily::encode_into(), Botan::Cert_Extension::IPAddressBlocks::IPAddressOrRange< V >::encode_into(), Botan::OID::encode_into(), and encode_null().

◆ add_object() [4/6]

DER_Encoder & Botan::DER_Encoder::add_object ( ASN1_Type type_tag,
ASN1_Class class_tag,
std::span< const uint8_t > rep )
inline

Definition at line 186 of file der_enc.h.

186 {
187 return add_object(type_tag, class_tag, rep.data(), rep.size());
188 }

References add_object(), and DER_Encoder().

◆ add_object() [5/6]

DER_Encoder & Botan::DER_Encoder::add_object ( ASN1_Type type_tag,
ASN1_Class class_tag,
std::string_view str )

Definition at line 345 of file der_enc.cpp.

345 {
346 return add_object(type_tag, class_tag, as_span_of_bytes(rep_str));
347}
std::span< const uint8_t > as_span_of_bytes(const char *s, size_t len)
Definition mem_utils.h:28

References add_object(), Botan::as_span_of_bytes(), and DER_Encoder().

◆ add_object() [6/6]

DER_Encoder & Botan::DER_Encoder::add_object ( ASN1_Type type_tag,
ASN1_Class class_tag,
uint8_t val )

Definition at line 352 of file der_enc.cpp.

352 {
353 return add_object(type_tag, class_tag, std::span<const uint8_t>{&rep, 1});
354}

References add_object(), and DER_Encoder().

◆ encode() [1/11]

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

Definition at line 252 of file der_enc.cpp.

252 {
254}
DER_Encoder & encode(bool b)
Definition der_enc.cpp:252

References Botan::Boolean, DER_Encoder(), encode(), 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::PKCS10_Request::create(), Botan::DL_Group::DER_encode(), Botan::DL_PrivateKey::DER_encode(), Botan::DL_PublicKey::DER_encode(), Botan::EC_Group::DER_encode(), Botan::TLS::Session::DER_encode(), encode(), encode(), encode(), encode(), encode(), encode(), encode(), encode_if(), encode_if(), encode_if(), Botan::AlgorithmIdentifier::encode_into(), Botan::AlternativeName::encode_into(), Botan::Attribute::encode_into(), Botan::Cert_Extension::ASBlocks::ASIdentifiers::encode_into(), Botan::Cert_Extension::ASBlocks::ASIdOrRange::encode_into(), Botan::Cert_Extension::IPAddressBlocks::IPAddressFamily::encode_into(), Botan::CRL_Entry::encode_into(), Botan::Extensions::encode_into(), Botan::OCSP::CertID::encode_into(), Botan::PSS_Params::encode_into(), Botan::X509_DN::encode_into(), Botan::X509_Object::encode_into(), encode_list(), encode_optional(), encode_optional(), Botan::X509_Object::make_signed(), Botan::EC_PrivateKey::private_key_bits(), Botan::Ed25519_PrivateKey::private_key_bits(), Botan::Ed448_PrivateKey::private_key_bits(), Botan::RSA_PrivateKey::private_key_bits(), Botan::X25519_PrivateKey::private_key_bits(), Botan::X448_PrivateKey::private_key_bits(), Botan::XMSS_PrivateKey::private_key_bits(), Botan::Private_Key::private_key_info(), Botan::GOST_3410_PublicKey::public_key_bits(), Botan::McEliece_PublicKey::public_key_bits(), Botan::RSA_PublicKey::public_key_bits(), Botan::TPM_PrivateKey::public_key_bits(), Botan::XMSS_PublicKey::public_key_bits(), Botan::PSS_Params::serialize(), Botan::TLS::Certificate_Request_12::serialize(), Botan::EC_Group_Data::set_oid(), and Botan::Public_Key::subject_public_key().

◆ encode() [2/11]

DER_Encoder & Botan::DER_Encoder::encode ( bool b,
ASN1_Type type_tag,
ASN1_Class class_tag = ASN1_Class::ContextSpecific )

Definition at line 280 of file der_enc.cpp.

280 {
281 uint8_t val = is_true ? 0xFF : 0x00;
282 return add_object(type_tag, class_tag, &val, 1);
283}

References add_object(), and DER_Encoder().

◆ encode() [3/11]

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

Definition at line 337 of file der_enc.cpp.

337 {
338 obj.encode_into(*this);
339 return (*this);
340}

References DER_Encoder(), and Botan::ASN1_Object::encode_into().

◆ encode() [4/11]

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

Definition at line 266 of file der_enc.cpp.

References DER_Encoder(), encode(), Botan::Integer, and Botan::Universal.

◆ encode() [5/11]

DER_Encoder & Botan::DER_Encoder::encode ( const BigInt & n,
ASN1_Type type_tag,
ASN1_Class class_tag = ASN1_Class::ContextSpecific )

Definition at line 295 of file der_enc.cpp.

295 {
296 if(n == 0) {
297 return add_object(type_tag, class_tag, 0);
298 }
299
300 const size_t extra_zero = (n.bits() % 8 == 0) ? 1 : 0;
301
302 auto contents = n.serialize(n.bytes() + extra_zero);
303 if(n < 0) {
304 for(unsigned char& content : contents) {
305 content = ~content;
306 }
307 for(size_t i = contents.size(); i > 0; --i) {
308 contents[i - 1] += 1;
309 if(contents[i - 1] != 0) {
310 break;
311 }
312 }
313 }
314
315 return add_object(type_tag, class_tag, contents);
316}

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

◆ encode() [6/11]

template<typename Alloc>
DER_Encoder & Botan::DER_Encoder::encode ( const std::vector< uint8_t, Alloc > & bytes,
ASN1_Type real_type,
ASN1_Type type_tag,
ASN1_Class class_tag )
inline

Definition at line 116 of file der_enc.h.

119 {
120 return encode(bytes.data(), bytes.size(), real_type, type_tag, class_tag);
121 }

References DER_Encoder(), and encode().

◆ encode() [7/11]

template<typename Alloc>
DER_Encoder & Botan::DER_Encoder::encode ( const std::vector< uint8_t, Alloc > & vec,
ASN1_Type real_type )
inline

Definition at line 99 of file der_enc.h.

99 {
100 return encode(vec.data(), vec.size(), real_type);
101 }

References DER_Encoder(), and encode().

◆ encode() [8/11]

DER_Encoder & Botan::DER_Encoder::encode ( const uint8_t v[],
size_t len,
ASN1_Type real_type,
ASN1_Type type_tag,
ASN1_Class class_tag = ASN1_Class::ContextSpecific )

Definition at line 321 of file der_enc.cpp.

322 {
323 if(real_type != ASN1_Type::OctetString && real_type != ASN1_Type::BitString) {
324 throw Invalid_Argument("DER_Encoder: Invalid tag for byte/bit string");
325 }
326
327 if(real_type == ASN1_Type::BitString) {
329 encoded.push_back(0);
330 encoded += std::make_pair(bytes, length);
331 return add_object(type_tag, class_tag, encoded);
332 } else {
333 return add_object(type_tag, class_tag, bytes, length);
334 }
335}
std::vector< T, secure_allocator< T > > secure_vector
Definition secmem.h:69

References add_object(), Botan::BitString, DER_Encoder(), and Botan::OctetString.

◆ encode() [9/11]

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

Definition at line 273 of file der_enc.cpp.

273 {
274 return encode(bytes, length, real_type, real_type, ASN1_Class::Universal);
275}

References DER_Encoder(), encode(), and Botan::Universal.

◆ encode() [10/11]

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

Definition at line 259 of file der_enc.cpp.

259 {
261}
static BigInt from_u64(uint64_t n)
Definition bigint.cpp:29

References DER_Encoder(), encode(), Botan::BigInt::from_u64(), Botan::Integer, and Botan::Universal.

◆ encode() [11/11]

DER_Encoder & Botan::DER_Encoder::encode ( size_t s,
ASN1_Type type_tag,
ASN1_Class class_tag = ASN1_Class::ContextSpecific )

Definition at line 288 of file der_enc.cpp.

288 {
289 return encode(BigInt::from_u64(n), type_tag, class_tag);
290}

References DER_Encoder(), encode(), and Botan::BigInt::from_u64().

◆ encode_if() [1/4]

DER_Encoder & Botan::DER_Encoder::encode_if ( bool pred,
bool num )
inline

Definition at line 177 of file der_enc.h.

177 {
178 if(pred) {
179 encode(num);
180 }
181 return (*this);
182 }

References DER_Encoder(), and encode().

◆ encode_if() [2/4]

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

Definition at line 163 of file der_enc.h.

163 {
164 if(pred) {
165 encode(obj);
166 }
167 return (*this);
168 }

References DER_Encoder(), and encode().

◆ encode_if() [3/4]

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

Definition at line 156 of file der_enc.h.

156 {
157 if(pred) {
158 return raw_bytes(enc.get_contents());
159 }
160 return (*this);
161 }
DER_Encoder & raw_bytes(const uint8_t val[], size_t len)
Definition der_enc.cpp:209
BOTAN_FORCE_INLINE BOTAN_FN_ISA_AES void enc(uint8x16_t &B, uint8x16_t K)
Definition aes_armv8.cpp:21

References DER_Encoder(), and raw_bytes().

◆ encode_if() [4/4]

DER_Encoder & Botan::DER_Encoder::encode_if ( bool pred,
size_t num )
inline

Definition at line 170 of file der_enc.h.

170 {
171 if(pred) {
172 encode(num);
173 }
174 return (*this);
175 }

References DER_Encoder(), and encode().

◆ encode_list()

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

Definition at line 141 of file der_enc.h.

141 {
142 for(size_t i = 0; i != values.size(); ++i) {
143 encode(values[i]);
144 }
145 return (*this);
146 }

References DER_Encoder(), and encode().

Referenced by Botan::TLS::Session::DER_encode(), Botan::Cert_Extension::ASBlocks::ASIdentifierChoice::encode_into(), and Botan::Cert_Extension::IPAddressBlocks::IPAddressChoice< V >::encode_into().

◆ encode_null()

◆ encode_optional() [1/2]

template<typename T>
DER_Encoder & Botan::DER_Encoder::encode_optional ( const std::optional< T > & value)
inline

Definition at line 133 of file der_enc.h.

133 {
134 if(value) {
135 encode(*value);
136 }
137 return (*this);
138 }

References DER_Encoder(), and encode().

◆ encode_optional() [2/2]

template<typename T>
DER_Encoder & Botan::DER_Encoder::encode_optional ( const T & value,
const T & default_value )
inline

Definition at line 125 of file der_enc.h.

125 {
126 if(value != default_value) {
127 encode(value);
128 }
129 return (*this);
130 }

References DER_Encoder(), encode(), and encode_optional().

Referenced by Botan::Extensions::encode_into(), and encode_optional().

◆ end_cons()

DER_Encoder & Botan::DER_Encoder::end_cons ( )

Definition at line 173 of file der_enc.cpp.

173 {
174 if(m_subsequences.empty()) {
175 throw Invalid_State("DER_Encoder::end_cons: No such sequence");
176 }
177
178 DER_Sequence last_seq = std::move(m_subsequences[m_subsequences.size() - 1]);
179 m_subsequences.pop_back();
180 last_seq.push_contents(*this);
181
182 return (*this);
183}

References DER_Encoder().

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::PKCS10_Request::create(), Botan::DL_Group::DER_encode(), Botan::EC_Group::DER_encode(), Botan::TLS::Session::DER_encode(), Botan::AlgorithmIdentifier::encode_into(), Botan::AlternativeName::encode_into(), Botan::Attribute::encode_into(), Botan::Cert_Extension::ASBlocks::ASIdentifierChoice::encode_into(), Botan::Cert_Extension::ASBlocks::ASIdentifiers::encode_into(), Botan::Cert_Extension::ASBlocks::ASIdOrRange::encode_into(), Botan::Cert_Extension::CRL_Distribution_Points::Distribution_Point::encode_into(), Botan::Cert_Extension::IPAddressBlocks::IPAddressChoice< V >::encode_into(), Botan::Cert_Extension::IPAddressBlocks::IPAddressFamily::encode_into(), Botan::Cert_Extension::IPAddressBlocks::IPAddressOrRange< V >::encode_into(), Botan::CRL_Entry::encode_into(), Botan::Extensions::encode_into(), Botan::OCSP::CertID::encode_into(), Botan::PSS_Params::encode_into(), Botan::X509_DN::encode_into(), Botan::X509_Object::encode_into(), end_explicit(), Botan::X509_Object::make_signed(), Botan::EC_PrivateKey::private_key_bits(), Botan::RSA_PrivateKey::private_key_bits(), Botan::Private_Key::private_key_info(), Botan::McEliece_PublicKey::public_key_bits(), Botan::RSA_PublicKey::public_key_bits(), Botan::TPM_PrivateKey::public_key_bits(), Botan::ASN1::put_in_sequence(), and Botan::Public_Key::subject_public_key().

◆ end_explicit()

DER_Encoder & Botan::DER_Encoder::end_explicit ( )

◆ get_contents()

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

Definition at line 134 of file der_enc.cpp.

134 {
135 if(!m_subsequences.empty()) {
136 throw Invalid_State("DER_Encoder: Sequence hasn't been marked done");
137 }
138
139 if(m_append_output) {
140 throw Invalid_State("DER_Encoder Cannot get contents when using output vector");
141 }
142
144 std::swap(output, m_default_outbuf);
145 return output;
146}

Referenced by Botan::PKCS10_Request::create(), Botan::DL_PrivateKey::DER_encode(), Botan::TLS::Session::DER_encode(), Botan::EC_PrivateKey::private_key_bits(), Botan::Ed25519_PrivateKey::private_key_bits(), Botan::Ed448_PrivateKey::private_key_bits(), Botan::RSA_PrivateKey::private_key_bits(), Botan::X25519_PrivateKey::private_key_bits(), Botan::X448_PrivateKey::private_key_bits(), Botan::XMSS_PrivateKey::private_key_bits(), Botan::Private_Key::private_key_info(), and Botan::TLS::Certificate_Request_12::serialize().

◆ get_contents_unlocked()

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

Return the encoded contents as a std::vector

If using this function, instead pass a std::vector to the contructor of DER_Encoder where the output will be placed. This avoids several unecessary copies.

Definition at line 148 of file der_enc.cpp.

148 {
149 if(!m_subsequences.empty()) {
150 throw Invalid_State("DER_Encoder: Sequence hasn't been marked done");
151 }
152
153 if(m_append_output) {
154 throw Invalid_State("DER_Encoder Cannot get contents when using output vector");
155 }
156
157 std::vector<uint8_t> output(m_default_outbuf.begin(), m_default_outbuf.end());
158 m_default_outbuf.clear();
159 return output;
160}

◆ raw_bytes() [1/2]

template<typename Alloc>
DER_Encoder & Botan::DER_Encoder::raw_bytes ( const std::vector< uint8_t, Alloc > & val)
inline

Definition at line 88 of file der_enc.h.

88 {
89 return raw_bytes(val.data(), val.size());
90 }

References DER_Encoder(), and raw_bytes().

◆ raw_bytes() [2/2]

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

Insert raw bytes directly into the output stream

Definition at line 209 of file der_enc.cpp.

209 {
210 if(!m_subsequences.empty()) {
211 m_subsequences[m_subsequences.size() - 1].add_bytes(bytes, length);
212 } else if(m_append_output) {
213 m_append_output(bytes, length);
214 } else {
215 m_default_outbuf += std::make_pair(bytes, length);
216 }
217
218 return (*this);
219}

References DER_Encoder().

Referenced by Botan::PKCS10_Request::create(), encode_if(), Botan::AlgorithmIdentifier::encode_into(), Botan::Attribute::encode_into(), Botan::X509_DN::encode_into(), Botan::X509_Object::encode_into(), Botan::X509_Object::make_signed(), Botan::ASN1::put_in_sequence(), and raw_bytes().

◆ start_cons()

DER_Encoder & Botan::DER_Encoder::start_cons ( ASN1_Type type_tag,
ASN1_Class class_tag )

Definition at line 165 of file der_enc.cpp.

165 {
166 m_subsequences.push_back(DER_Sequence(type_tag, class_tag));
167 return (*this);
168}

References DER_Encoder().

Referenced by Botan::Cert_Extension::CRL_Distribution_Points::Distribution_Point::encode_into(), start_context_specific(), start_explicit(), start_explicit_context_specific(), start_sequence(), and start_set().

◆ start_context_specific()

DER_Encoder & Botan::DER_Encoder::start_context_specific ( uint32_t tag)
inline

Definition at line 69 of file der_enc.h.

69 {
71 }
DER_Encoder & start_cons(ASN1_Type type_tag, ASN1_Class class_tag)
Definition der_enc.cpp:165
ASN1_Type
Definition asn1_obj.h:43

References Botan::ContextSpecific, DER_Encoder(), and start_cons().

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

◆ start_explicit()

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

Definition at line 188 of file der_enc.cpp.

188 {
189 ASN1_Type type_tag = static_cast<ASN1_Type>(type_no);
190
191 // This would confuse DER_Sequence
192 if(type_tag == ASN1_Type::Set) {
193 throw Internal_Error("DER_Encoder.start_explicit(SET) not supported");
194 }
195
196 return start_cons(type_tag, ASN1_Class::ContextSpecific);
197}

References Botan::ContextSpecific, DER_Encoder(), Botan::Set, and start_cons().

Referenced by Botan::OCSP::Request::BER_encode(), Botan::PKCS10_Request::create(), Botan::AlternativeName::encode_into(), and Botan::Cert_Extension::ASBlocks::ASIdentifiers::encode_into().

◆ start_explicit_context_specific()

DER_Encoder & Botan::DER_Encoder::start_explicit_context_specific ( uint32_t tag)
inline

◆ start_sequence()

DER_Encoder & Botan::DER_Encoder::start_sequence ( )
inline

Definition at line 65 of file der_enc.h.

References DER_Encoder(), Botan::Sequence, start_cons(), start_sequence(), 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::PKCS10_Request::create(), Botan::DL_Group::DER_encode(), Botan::EC_Group::DER_encode(), Botan::TLS::Session::DER_encode(), Botan::AlgorithmIdentifier::encode_into(), Botan::AlternativeName::encode_into(), Botan::Attribute::encode_into(), Botan::Cert_Extension::ASBlocks::ASIdentifierChoice::encode_into(), Botan::Cert_Extension::ASBlocks::ASIdentifiers::encode_into(), Botan::Cert_Extension::ASBlocks::ASIdOrRange::encode_into(), Botan::Cert_Extension::CRL_Distribution_Points::Distribution_Point::encode_into(), Botan::Cert_Extension::IPAddressBlocks::IPAddressChoice< V >::encode_into(), Botan::Cert_Extension::IPAddressBlocks::IPAddressFamily::encode_into(), Botan::Cert_Extension::IPAddressBlocks::IPAddressOrRange< V >::encode_into(), Botan::CRL_Entry::encode_into(), Botan::Extensions::encode_into(), Botan::OCSP::CertID::encode_into(), Botan::PSS_Params::encode_into(), Botan::X509_DN::encode_into(), Botan::X509_Object::encode_into(), Botan::X509_Object::make_signed(), Botan::EC_PrivateKey::private_key_bits(), Botan::RSA_PrivateKey::private_key_bits(), Botan::Private_Key::private_key_info(), Botan::McEliece_PublicKey::public_key_bits(), Botan::RSA_PublicKey::public_key_bits(), Botan::TPM_PrivateKey::public_key_bits(), Botan::ASN1::put_in_sequence(), start_sequence(), and Botan::Public_Key::subject_public_key().

◆ start_set()

DER_Encoder & Botan::DER_Encoder::start_set ( )
inline

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