Botan 3.13.0
Crypto and TLS for C&
Botan::Cert_Extension::DistributionPointName Class Referencefinal

#include <x509_ext.h>

Inheritance diagram for Botan::Cert_Extension::DistributionPointName:
Botan::ASN1_Object

Public Member Functions

std::vector< uint8_t > BER_encode () const
void decode_from (BER_Decoder &from) override
 DistributionPointName ()=default
 DistributionPointName (AlternativeName full_name)
void encode_into (DER_Encoder &to) const override
const std::optional< AlternativeName > & full_name () const

Detailed Description

DistributionPointName used by CRLDistributionPoints and IssuingDistributionPoint (RFC 5280 4.2.1.13 / 5.2.5).

DistributionPointName ::= CHOICE {
     fullName                [0]     GeneralNames,
     nameRelativeToCRLIssuer [1]     RelativeDistinguishedName }

Currently only the fullName CHOICE arm is supported; nameRelativeToCRLIssuer is rejected at decode time.

Definition at line 570 of file x509_ext.h.

Constructor & Destructor Documentation

◆ DistributionPointName() [1/2]

Botan::Cert_Extension::DistributionPointName::DistributionPointName ( )
default

◆ DistributionPointName() [2/2]

Botan::Cert_Extension::DistributionPointName::DistributionPointName ( AlternativeName full_name)
inlineexplicit

Definition at line 574 of file x509_ext.h.

574: m_full_name(std::move(full_name)) {}
const std::optional< AlternativeName > & full_name() const
Definition x509_ext.h:587

References full_name().

Member Function Documentation

◆ 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::Cert_Extension::DistributionPointName::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 1355 of file x509_ext.cpp.

1355 {
1356 const BER_Object& obj = ber.peek_next_object();
1358 AlternativeName full_name;
1359 ber.decode_implicit(full_name,
1360 ASN1_Type(0),
1364 // RFC 5280 4.2.1.6: GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName
1365 if(!full_name.has_items()) {
1366 throw Decoding_Error("DistributionPointName fullName must contain at least one GeneralName");
1367 }
1368 if(std::ranges::any_of(full_name.directory_names(), [](const X509_DN& dn) { return dn.empty(); })) {
1369 throw Decoding_Error("DistributionPointName fullName must not contain an empty directoryName");
1370 }
1371 m_full_name = std::move(full_name);
1372 } else if(obj.is_a(1, ASN1_Class::ContextSpecific | ASN1_Class::Constructed)) {
1373 throw Decoding_Error("nameRelativeToCrlIssuer not supported in DistributionPointName");
1374 } else {
1375 throw Decoding_Error("DistributionPointName CHOICE is neither fullName nor nameRelativeToCRLIssuer");
1376 }
1377}
ASN1_Type
Definition asn1_obj.h:47

References Botan::Constructed, Botan::ContextSpecific, Botan::BER_Decoder::decode_implicit(), full_name(), Botan::BER_Object::is_a(), Botan::BER_Decoder::peek_next_object(), and Botan::Sequence.

◆ encode_into()

void Botan::Cert_Extension::DistributionPointName::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 1345 of file x509_ext.cpp.

1345 {
1346 if(!m_full_name.has_value()) {
1347 throw Encoding_Error("DistributionPointName has no fullName to encode");
1348 }
1349 // fullName [0] IMPLICIT GeneralNames. emit_general_names_implicit rejects
1350 // empty AlternativeNames per RFC 5280 4.2.1.6: GeneralNames ::= SEQUENCE
1351 // SIZE (1..MAX).
1352 emit_general_names_implicit(der, *m_full_name, 0);
1353}

◆ full_name()

const std::optional< AlternativeName > & Botan::Cert_Extension::DistributionPointName::full_name ( ) const
inline

The fullName GeneralNames

In the current implementation this will always be set, it returns an optional to help any future addition of nameRelativeToCRLIssuer, in which case full_name would return nullopt and another getter would return the relative name.

Definition at line 587 of file x509_ext.h.

587{ return m_full_name; }

Referenced by decode_from(), and DistributionPointName().


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