Botan 2.19.5 Crypto and TLS for C&

Public Member Functions | List of all members
Botan::GeneralSubtree Class Referencefinal

A single Name Constraint. More...

`#include <pkix_types.h>`

Inheritance diagram for Botan::GeneralSubtree:

## Public Member Functions
const GeneralName & | base () const
std::vector< uint8_t > | BER_encode () const
void | decode_from (BER_Decoder &) override
void | encode_into (DER_Encoder &) const override
| GeneralSubtree ()
| GeneralSubtree (const GeneralName &base, size_t min, size_t max)
| GeneralSubtree (const std::string &str)
size_t | maximum () const
size_t | minimum () const

## Detailed Description

A single Name Constraint.

The Name Constraint extension adds a minimum and maximum path length to a GeneralName to form a constraint. The length limits are currently unused.

This entire class is deprecated and will be removed in a future major release

Definition at line 266 of file pkix_types.h.

## Constructor & Destructor Documentation

## ◆ GeneralSubtree() [1/3]

Botan::GeneralSubtree::GeneralSubtree | ( |  | ) |
| inline

Creates an empty name constraint.

Definition at line 273 of file pkix_types.h.

273 : m_base(), m_minimum(0), m_maximum(std::numeric_limits<std::size_t>::max())
274 {}

## ◆ GeneralSubtree() [2/3]

Botan::GeneralSubtree::GeneralSubtree | ( | const GeneralName & | base,
|  | size_t | min,
|  | size_t | max
| ) |  |
| inline

Definition at line 283 of file pkix_types.h.

284 : m_base(base), m_minimum(min), m_maximum(max)
285 {}
Botan::GeneralSubtree::base
const GeneralName & base() const
Definition: pkix_types.h:301

## ◆ GeneralSubtree() [3/3]

Botan::GeneralSubtree::GeneralSubtree | ( | const std::string & | str | ) |

Creates a new name constraint for its string format.

Parameters

  str | name constraint

Definition at line 248 of file name_constraint.cpp.

248 : GeneralSubtree()
249 {
250 size_t p0, p1;
251 const auto min = std::stoull(str, &p0, 10);
252 const auto max = std::stoull(str.substr(p0 + 1), &p1, 10);
253 GeneralName gn(str.substr(p0 + p1 + 2));
254
255 if(p0 > 0 && p1 > 0)
256 {
257 m_minimum = static_cast<size_t>(min);
258 m_maximum = static_cast<size_t>(max);
259 m_base = gn;
260 }
261 else
262 {
263 throw Invalid_Argument("Failed to decode Name Constraint");
264 }
265 }
Botan::GeneralSubtree::GeneralSubtree
GeneralSubtree()
Definition: pkix_types.h:273

## Member Function Documentation

## ◆ base()

const GeneralName & Botan::GeneralSubtree::base | ( |  | ) | const
| inline

Returns
  name

Definition at line 301 of file pkix_types.h.

301{ return m_base; }

Referenced by Botan::operator<<().

## ◆ 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::GeneralSubtree::decode_from | ( | 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 272 of file name_constraint.cpp.

273 {
274 ber.start_cons(SEQUENCE)
275 .decode(m_base)
276 .decode_optional(m_minimum,ASN1_Tag(0), CONTEXT_SPECIFIC,size_t(0))
277 .end_cons();
278
279 if(m_minimum != 0)
280 throw Decoding_Error("GeneralSubtree minimum must be 0");
281
282 m_maximum = std::numeric_limits<std::size_t>::max();
283 }
Botan::ASN1_Tag
ASN1_Tag
Definition: asn1_obj.h:25
Botan::SEQUENCE
@ SEQUENCE
Definition: asn1_obj.h:42
Botan::CONTEXT_SPECIFIC
@ CONTEXT_SPECIFIC
Definition: asn1_obj.h:28

References Botan::CONTEXT_SPECIFIC, Botan::BER_Decoder::decode(), Botan::BER_Decoder::decode_optional(), Botan::BER_Decoder::end_cons(), Botan::SEQUENCE, and Botan::BER_Decoder::start_cons().

## ◆ encode_into()

void Botan::GeneralSubtree::encode_into | ( | 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 267 of file name_constraint.cpp.

268 {
269 throw Not_Implemented("General Subtree encoding");
270 }

## ◆ maximum()

size_t Botan::GeneralSubtree::maximum | ( |  | ) | const
| inline

Returns
  maximum path length

Definition at line 311 of file pkix_types.h.

311{ return m_maximum; }

Referenced by Botan::operator<<().

## ◆ minimum()

size_t Botan::GeneralSubtree::minimum | ( |  | ) | const
| inline

Returns
  minimum path length

Definition at line 306 of file pkix_types.h.

306{ return m_minimum; }

Referenced by Botan::operator<<().

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

- src/lib/x509/pkix_types.h
- src/lib/x509/name_constraint.cpp