Botan 3.6.1
Crypto and TLS for C&
|
#include <asn1_obj.h>
Public Member Functions | |
std::vector< uint8_t > | BER_encode () const |
void | decode_from (BER_Decoder &) override |
bool | empty () const |
void | encode_into (DER_Encoder &) const override |
const std::vector< uint32_t > & | get_components () const |
const std::vector< uint32_t > & | get_id () const |
bool | has_value () const |
std::string | human_name_or_empty () const |
OID ()=default | |
OID (std::initializer_list< uint32_t > init) | |
OID (std::string_view str) | |
OID (std::vector< uint32_t > &&init) | |
bool | operator== (const OID &other) const |
bool | registered_oid () const |
std::string | to_formatted_string () const |
std::string | to_string () const |
Static Public Member Functions | |
static std::optional< OID > | from_name (std::string_view name) |
static OID | from_string (std::string_view str) |
static void | register_oid (const OID &oid, std::string_view name) |
This class represents ASN.1 object identifiers.
Definition at line 216 of file asn1_obj.h.
|
explicitdefault |
Create an uninitialied OID object
Referenced by from_string().
|
explicit |
Construct an OID from a string.
str | a string in the form "a.b.c" etc., where a,b,c are integers |
Note: it is currently required that each integer fit into 32 bits
Definition at line 115 of file asn1_oid.cpp.
|
explicit |
Initialize an OID from a sequence of integer values
Definition at line 104 of file asn1_oid.cpp.
|
explicit |
Initialize an OID from a vector of integer values
Definition at line 108 of file asn1_oid.cpp.
|
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.
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().
|
overridevirtual |
Decode whatever this object is from from
from | the BER_Decoder that will be read from |
Implements Botan::ASN1_Object.
Definition at line 207 of file asn1_oid.cpp.
References Botan::b, BOTAN_ASSERT_NOMSG, Botan::BER_Object::data(), Botan::BufferSlicer::empty(), Botan::BER_Decoder::get_next_object(), Botan::BER_Object::length(), Botan::ObjectId, Botan::BER_Object::tagging(), and Botan::Universal.
|
inline |
Find out whether this OID is empty
Definition at line 266 of file asn1_obj.h.
References empty().
Referenced by Botan::EC_Group_Data::EC_Group_Data(), empty(), and Botan::EC_Group_Data::set_oid().
|
overridevirtual |
Encode whatever this object is into to
to | the DER_Encoder that will be written to |
Implements Botan::ASN1_Object.
Definition at line 168 of file asn1_oid.cpp.
References Botan::DER_Encoder::add_object(), BOTAN_ASSERT_IS_SOME, Botan::checked_add(), Botan::high_bit(), Botan::ObjectId, and Botan::Universal.
|
static |
Construct an OID from a name
name | any known OID name (for example "RSA" or "X509v3.SubjectKeyIdentifier") |
Definition at line 72 of file asn1_oid.cpp.
References Botan::OID_Map::global_registry(), has_value(), name, and Botan::OID_Map::str2oid().
Referenced by Botan::EC_Group::from_name().
|
static |
Construct an OID from a string.
str | a string in the form "a.b.c" etc., where a,b,c are numbers or any known OID name (for example "RSA" or "X509v3.SubjectKeyIdentifier") |
Definition at line 86 of file asn1_oid.cpp.
References Botan::fmt(), Botan::OID_Map::global_registry(), has_value(), OID(), and Botan::OID_Map::str2oid().
Referenced by Botan::X509_DN::add_attribute(), Botan::X509_Cert_Options::add_ex_constraint(), Botan::TLS::Signature_Scheme::algorithm_identifier(), Botan::XMSS_Signature_Operation::algorithm_identifier(), Botan::X509_Certificate::allowed_extended_usage(), Botan::PKCS10_Request::constraints(), Botan::EC_Group::EC_Group(), Botan::PKCS10_Request::ex_constraints(), Botan::X509_DN::get_attribute(), Botan::X509_DN::get_first_attribute(), Botan::X509_Certificate::has_ex_constraint(), Botan::X509_DN::has_field(), Botan::PKCS10_Request::is_CA(), Botan::X509_Certificate::is_critical(), Botan::Asymmetric_Key::object_identifier(), Botan::DilithiumMode::object_identifier(), Botan::FrodoKEMMode::object_identifier(), Botan::HSS_LMS_PublicKeyInternal::object_identifier(), Botan::KyberMode::object_identifier(), Botan::PKCS10_Request::path_limit(), and Botan::HSS_LMS_PrivateKey::pkcs8_algorithm_identifier().
|
inline |
Get this OID as list (vector) of its components.
Definition at line 309 of file asn1_obj.h.
Referenced by Botan::operator<().
|
inline |
Definition at line 314 of file asn1_obj.h.
|
inline |
Find out whether this OID has a value
Definition at line 272 of file asn1_obj.h.
Referenced by Botan::X509::create_self_signed_cert(), Botan::EC_Group::EC_Group(), Botan::EC_Group::EC_Group(), from_name(), from_string(), and Botan::X509_DN::has_field().
std::string Botan::OID::human_name_or_empty | ( | ) | const |
If there is a known name associated with this OID, return that. Otherwise return the empty string.
Definition at line 147 of file asn1_oid.cpp.
References Botan::OID_Map::global_registry(), and Botan::OID_Map::oid2str().
Referenced by Botan::OIDS::oid2str_or_throw(), Botan::pbes2_decrypt(), registered_oid(), and to_formatted_string().
|
inline |
Compare two OIDs.
Definition at line 302 of file asn1_obj.h.
|
static |
Register a new OID in the internal table
Definition at line 67 of file asn1_oid.cpp.
References Botan::OID_Map::add_oid(), Botan::OID_Map::global_registry(), and name.
bool Botan::OID::registered_oid | ( | ) | const |
Return true if the OID in *this is registered in the internal set of constants as a known OID.
Definition at line 151 of file asn1_oid.cpp.
References human_name_or_empty().
Referenced by Botan::PKIX::check_chain().
std::string Botan::OID::to_formatted_string | ( | ) | const |
If there is a known name associated with this OID, return that. Otherwise return the result of to_string
Definition at line 139 of file asn1_oid.cpp.
References human_name_or_empty(), and to_string().
Referenced by Botan::Dilithium_PublicKey::algo_name(), Botan::Sphincs_Parameters::create(), Botan::TPM2::get_tpm2_curve_id(), Botan::PSS_Params::hash_function(), Botan::OCSP::CertID::is_id_for(), Botan::load_private_key(), Botan::load_public_key(), Botan::PSS_Params::mgf_function(), Botan::X942_PRF::name(), Botan::X509_Certificate::to_string(), and Botan::PK_Ops::Verification_with_Hash::Verification_with_Hash().
std::string Botan::OID::to_string | ( | ) | const |
Get this OID as a dotted-decimal string
Definition at line 125 of file asn1_oid.cpp.
Referenced by Botan::OID_Map::add_oid(), Botan::OID_Map::add_oid2str(), Botan::EC_Group::from_OID(), Botan::OID_Map::oid2str(), Botan::operator<<(), and to_formatted_string().