Botan 3.9.0
Crypto and TLS for C&
Botan::Cert_Extension::ASBlocks::ASIdentifierChoice Class Referencefinal

#include <x509_ext.h>

Inheritance diagram for Botan::Cert_Extension::ASBlocks::ASIdentifierChoice:
Botan::ASN1_Object

Public Member Functions

 ASIdentifierChoice ()=default
 ASIdentifierChoice (const std::optional< std::vector< ASIdOrRange > > &ranges)
std::vector< uint8_t > BER_encode () const
void decode_from (BER_Decoder &from) override
void encode_into (DER_Encoder &to) const override
const std::optional< std::vector< ASIdOrRange > > & ranges () const

Detailed Description

Definition at line 817 of file x509_ext.h.

Constructor & Destructor Documentation

◆ ASIdentifierChoice() [1/2]

Botan::Cert_Extension::ASBlocks::ASIdentifierChoice::ASIdentifierChoice ( )
default

References ASIdentifierChoice(), and ranges().

Referenced by ASIdentifierChoice().

◆ ASIdentifierChoice() [2/2]

Botan::Cert_Extension::ASBlocks::ASIdentifierChoice::ASIdentifierChoice ( const std::optional< std::vector< ASIdOrRange > > & ranges)
explicit

Definition at line 1577 of file x509_ext.cpp.

1577 {
1578 m_as_ranges = sort_and_merge_ranges<ASIdOrRange>(ranges);
1579}
const std::optional< std::vector< ASIdOrRange > > & ranges() const
Definition x509_ext.h:826

References ranges().

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 19 of file asn1_obj.cpp.

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

References encode_into().

Referenced by decode_from(), 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(), Botan::PSS_Params::PSS_Params(), and Botan::Certificate_Store_In_SQL::revoke_cert().

◆ decode_from()

void Botan::Cert_Extension::ASBlocks::ASIdentifierChoice::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 1581 of file x509_ext.cpp.

1581 {
1582 const ASN1_Type next_tag = from.peek_next_object().type_tag();
1583
1584 if(next_tag == ASN1_Type::Null) {
1585 m_as_ranges = std::nullopt;
1586 } else if(next_tag == ASN1_Type::Sequence) {
1587 std::vector<ASIdOrRange> as_ranges;
1588 from.decode_list(as_ranges);
1589
1590 m_as_ranges = sort_and_merge_ranges<ASIdOrRange>(as_ranges);
1591 } else {
1592 throw Decoding_Error(fmt("Unexpected type for ASIdentifierChoice {}", static_cast<uint32_t>(next_tag)));
1593 }
1594}
const BER_Object & peek_next_object()
Definition ber_dec.cpp:237
BER_Decoder & decode_list(std::vector< T > &out, ASN1_Type type_tag=ASN1_Type::Sequence, ASN1_Class class_tag=ASN1_Class::Universal)
Definition ber_dec.h:393
ASN1_Type type_tag() const
Definition asn1_obj.h:142
std::string fmt(std::string_view format, const T &... args)
Definition fmt.h:53
ASN1_Type
Definition asn1_obj.h:43

References Botan::BER_Decoder::decode_list(), Botan::fmt(), Botan::Null, Botan::BER_Decoder::peek_next_object(), Botan::Sequence, and Botan::BER_Object::type_tag().

◆ encode_into()

void Botan::Cert_Extension::ASBlocks::ASIdentifierChoice::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 1569 of file x509_ext.cpp.

1569 {
1570 if(m_as_ranges.has_value()) {
1571 into.start_sequence().encode_list(m_as_ranges.value()).end_cons();
1572 } else {
1573 into.encode_null();
1574 }
1575}

References Botan::DER_Encoder::encode_list(), Botan::DER_Encoder::encode_null(), Botan::DER_Encoder::end_cons(), and Botan::DER_Encoder::start_sequence().

◆ ranges()

const std::optional< std::vector< ASIdOrRange > > & Botan::Cert_Extension::ASBlocks::ASIdentifierChoice::ranges ( ) const
inline

Definition at line 826 of file x509_ext.h.

826{ return m_as_ranges; }

Referenced by ASIdentifierChoice(), and ASIdentifierChoice().


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