Botan 3.0.0
Crypto and TLS for C&
|
#include <pkix_types.h>
Public Member Functions | |
void | add (std::unique_ptr< Certificate_Extension > extn, bool critical=false) |
bool | add_new (std::unique_ptr< Certificate_Extension > extn, bool critical=false) |
std::vector< uint8_t > | BER_encode () const |
bool | critical_extension_set (const OID &oid) const |
void | decode_from (BER_Decoder &) override |
void | encode_into (DER_Encoder &) const override |
bool | extension_set (const OID &oid) const |
Extensions () | |
std::vector< std::pair< std::unique_ptr< Certificate_Extension >, bool > > | extensions () const |
Extensions (const Extensions &)=default | |
Extensions (Extensions &&)=default | |
std::map< OID, std::pair< std::vector< uint8_t >, bool > > | extensions_raw () const |
std::unique_ptr< Certificate_Extension > | get (const OID &oid) const |
std::vector< uint8_t > | get_extension_bits (const OID &oid) const |
const Certificate_Extension * | get_extension_object (const OID &oid) const |
template<typename T > | |
const T * | get_extension_object_as (const OID &oid=T::static_oid()) const |
const std::vector< OID > & | get_extension_oids () const |
template<typename T > | |
std::unique_ptr< T > | get_raw (const OID &oid) const |
Extensions & | operator= (const Extensions &)=default |
Extensions & | operator= (Extensions &&)=default |
bool | remove (const OID &oid) |
void | replace (std::unique_ptr< Certificate_Extension > extn, bool critical=false) |
X.509 Certificate Extension List
Definition at line 399 of file pkix_types.h.
|
inline |
Definition at line 545 of file pkix_types.h.
|
default |
|
default |
void Botan::Extensions::add | ( | std::unique_ptr< Certificate_Extension > | extn, |
bool | critical = false |
||
) |
Adds a new extension to the list.
extn | pointer to the certificate extension (Extensions takes ownership) |
critical | whether this extension should be marked as critical |
Invalid_Argument | if the extension is already present in the list |
Definition at line 118 of file x509_ext.cpp.
References name.
bool Botan::Extensions::add_new | ( | std::unique_ptr< Certificate_Extension > | extn, |
bool | critical = false |
||
) |
Adds a new extension to the list unless it already exists. If the extension already exists within the Extensions object, the extn pointer will be deleted.
extn | pointer to the certificate extension (Extensions takes ownership) |
critical | whether this extension should be marked as critical |
Definition at line 133 of file x509_ext.cpp.
Referenced by Botan::X509::create_cert_req(), and Botan::X509::create_self_signed_cert().
|
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 17 of file asn1_obj.cpp.
References Botan::ASN1_Object::encode_into().
Referenced by Botan::PSS_Params::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(), and Botan::Certificate_Store_In_SQL::revoke_cert().
bool Botan::Extensions::critical_extension_set | ( | const OID & | oid | ) | const |
Return true if an extesion was set and marked critical
Definition at line 175 of file x509_ext.cpp.
Referenced by Botan::X509_Certificate::is_critical().
|
overridevirtual |
Decode whatever this object is from from
from | the BER_Decoder that will be read from |
Implements Botan::ASN1_Object.
Definition at line 264 of file x509_ext.cpp.
References Botan::Boolean, Botan::BER_Decoder::decode(), Botan::BER_Decoder::decode_optional(), Botan::BER_Decoder::end_cons(), Botan::BER_Decoder::more_items(), Botan::OctetString, Botan::BER_Decoder::start_sequence(), Botan::Universal, and Botan::BER_Decoder::verify_end().
|
overridevirtual |
Encode whatever this object is into to
to | the DER_Encoder that will be written to |
Implements Botan::ASN1_Object.
Definition at line 240 of file x509_ext.cpp.
References Botan::DER_Encoder::encode(), Botan::DER_Encoder::encode_optional(), Botan::DER_Encoder::end_cons(), Botan::OctetString, and Botan::DER_Encoder::start_sequence().
bool Botan::Extensions::extension_set | ( | const OID & | oid | ) | const |
Return true if an extension was set
Definition at line 170 of file x509_ext.cpp.
std::vector< std::pair< std::unique_ptr< Certificate_Extension >, bool > > Botan::Extensions::extensions | ( | ) | const |
Returns a copy of the list of extensions together with the corresponding criticality flag. All extensions are encoded as some object, falling back to Unknown_Extension class which simply allows reading the bytes as well as the criticality flag.
Definition at line 210 of file x509_ext.cpp.
Referenced by Botan::PKIX::check_chain().
std::map< OID, std::pair< std::vector< uint8_t >, bool > > Botan::Extensions::extensions_raw | ( | ) | const |
Returns the list of extensions as raw, encoded bytes together with the corresponding criticality flag. Contains all extensions, including any extensions encoded as Unknown_Extension
Definition at line 225 of file x509_ext.cpp.
std::unique_ptr< Certificate_Extension > Botan::Extensions::get | ( | const OID & | oid | ) | const |
Searches for an extension by OID and returns the result. Only the known extensions types declared in this header are searched for by this function.
Definition at line 201 of file x509_ext.cpp.
References get_extension_object().
std::vector< uint8_t > Botan::Extensions::get_extension_bits | ( | const OID & | oid | ) | const |
Return the raw bytes of the extension Will throw if OID was not set as an extension.
Definition at line 183 of file x509_ext.cpp.
const Certificate_Extension * Botan::Extensions::get_extension_object | ( | const OID & | oid | ) | const |
Look up an object in the extensions, based on OID Returns nullptr if not set, if the extension was either absent or not handled. The pointer returned is owned by the Extensions object. This would be better with an optional<T> return value
Definition at line 192 of file x509_ext.cpp.
Referenced by get().
|
inline |
Definition at line 412 of file pkix_types.h.
References T.
|
inline |
Return the set of extensions in the order they appeared in the certificate (or as they were added, if constructed)
Definition at line 438 of file pkix_types.h.
Referenced by Botan::PKIX::check_chain().
|
inline |
Searches for an extension by OID and returns the result decoding it to some arbitrary extension type chosen by the application.
Only the unknown extensions, that is, extensions types that are not declared in this header, are searched for by this function.
Definition at line 513 of file pkix_types.h.
|
default |
|
default |
bool Botan::Extensions::remove | ( | const OID & | oid | ) |
Remove an extension from the list. Returns true if the extension had been set, false otherwise.
Definition at line 147 of file x509_ext.cpp.
Referenced by replace().
void Botan::Extensions::replace | ( | std::unique_ptr< Certificate_Extension > | extn, |
bool | critical = false |
||
) |
Adds an extension to the list or replaces it.
extn | the certificate extension |
critical | whether this extension should be marked as critical |
Definition at line 159 of file x509_ext.cpp.
References remove().
Referenced by Botan::X509_CA::choose_extensions().