Botan 3.13.0
Crypto and TLS for C&
Botan::GeneralSubtree Class Referencefinal

A single Name Constraint. More...

#include <pkix_types.h>

Inheritance diagram for Botan::GeneralSubtree:
Botan::ASN1_Object

Public Member Functions

const GeneralNamebase () const
std::vector< uint8_t > BER_encode () const
void decode_from (BER_Decoder &from) override
void encode_into (DER_Encoder &to) const override
 GeneralSubtree ()
 GeneralSubtree (GeneralName base)

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 not used in PKIX.

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

Definition at line 718 of file pkix_types.h.

Constructor & Destructor Documentation

◆ GeneralSubtree() [1/2]

Botan::GeneralSubtree::GeneralSubtree ( )
default

Creates an empty name constraint.

References GeneralSubtree().

Referenced by GeneralSubtree(), and GeneralSubtree().

◆ GeneralSubtree() [2/2]

Botan::GeneralSubtree::GeneralSubtree ( GeneralName base)
inlineexplicit

Creates a name constraint over the given base name.

Definition at line 728 of file pkix_types.h.

728: m_base(std::move(base)) {}
const GeneralName & base() const
Definition pkix_types.h:737

References base(), and GeneralSubtree().

Member Function Documentation

◆ base()

const GeneralName & Botan::GeneralSubtree::base ( ) const
inline
Returns
name

Definition at line 737 of file pkix_types.h.

737{ return m_base; }

Referenced by GeneralSubtree(), and 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 21 of file asn1_obj.cpp.

21 {
22 std::vector<uint8_t> output;
23 DER_Encoder der(output);
24 this->encode_into(der);
25 return output;
26}
virtual void encode_into(DER_Encoder &to) const =0

References encode_into().

Referenced by decode_from(), Botan::PKCS12::export_to(), 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::PSS_Params::PSS_Params().

◆ decode_from()

void Botan::GeneralSubtree::decode_from ( BER_Decoder & from)
overridevirtual

Decode whatever this object is from from

Parameters
fromthe BER_Decoder that will be read from

Implements Botan::ASN1_Object.

Definition at line 804 of file name_constraint.cpp.

804 {
805 /*
806 * RFC 5280 Section 4.2.1.10:
807 * Within this profile, the minimum and maximum fields are not used with any
808 * name forms, thus, the minimum MUST be zero, and maximum MUST be absent.
809 */
810 size_t minimum = 0;
811 std::optional<size_t> maximum;
812
813 ber.start_sequence()
814 .decode(m_base)
815 .decode_optional(minimum, ASN1_Type(0), ASN1_Class::ContextSpecific, size_t(0))
816 .decode_optional(maximum, ASN1_Type(1), ASN1_Class::ContextSpecific)
817 .end_cons();
818
819 if(minimum != 0) {
820 throw Decoding_Error("GeneralSubtree minimum must be 0");
821 }
822 if(maximum.has_value()) {
823 throw Decoding_Error("GeneralSubtree maximum must be absent");
824 }
825}
ASN1_Type
Definition asn1_obj.h:47

References Botan::ContextSpecific, Botan::BER_Decoder::decode(), Botan::BER_Decoder::decode_optional(), Botan::BER_Decoder::end_cons(), and Botan::BER_Decoder::start_sequence().

◆ encode_into()

void Botan::GeneralSubtree::encode_into ( DER_Encoder & to) const
overridevirtual

Encode whatever this object is into to

Parameters
tothe DER_Encoder that will be written to

Implements Botan::ASN1_Object.

Definition at line 793 of file name_constraint.cpp.

793 {
794 /*
795 * RFC 5280 Section 4.2.1.10:
796 * Within this profile, the minimum and maximum fields are not used with any
797 * name forms, thus, the minimum MUST be zero, and maximum MUST be absent.
798 *
799 * minimum is DEFAULT 0 so it is not encoded.
800 */
801 to.start_sequence().encode(m_base).end_cons();
802}

References Botan::DER_Encoder::encode(), Botan::DER_Encoder::end_cons(), and Botan::DER_Encoder::start_sequence().


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