Botan 3.4.0
Crypto and TLS for C&
Functions
Botan::OIDS Namespace Reference

Functions

void add_oid (const OID &oid, std::string_view name)
 
BOTAN_UNSTABLE_API void add_oid2str (const OID &oid, std::string_view name)
 
void add_oidstr (const char *oidstr, const char *name)
 
BOTAN_UNSTABLE_API void add_str2oid (const OID &oid, std::string_view name)
 
std::string lookup (const OID &oid)
 
OID lookup (std::string_view name)
 
std::string oid2str_or_empty (const OID &oid)
 
std::string oid2str_or_throw (const OID &oid)
 
OID str2oid_or_empty (std::string_view name)
 

Function Documentation

◆ add_oid()

void Botan::OIDS::add_oid ( const OID & oid,
std::string_view name )
inline

Register an OID to string mapping.

Parameters
oidthe oid to register
namethe name to be associated with the oid

Definition at line 24 of file oids.h.

24 {
25 OID::register_oid(oid, name);
26}
std::string name

References name.

◆ add_oid2str()

void Botan::OIDS::add_oid2str ( const OID & oid,
std::string_view name )

Definition at line 14 of file oids.cpp.

14 {
15 OID_Map::global_registry().add_oid2str(oid, name);
16}

References Botan::OID_Map::add_oid2str(), Botan::OID_Map::global_registry(), and name.

◆ add_oidstr()

void Botan::OIDS::add_oidstr ( const char * oidstr,
const char * name )
inline

Definition at line 38 of file oids.h.

38 {
39 OID::register_oid(OID(oidstr), name);
40}

References name.

◆ add_str2oid()

void Botan::OIDS::add_str2oid ( const OID & oid,
std::string_view name )

Definition at line 18 of file oids.cpp.

18 {
19 OID_Map::global_registry().add_str2oid(oid, name);
20}

References Botan::OID_Map::add_str2oid(), Botan::OID_Map::global_registry(), and name.

◆ lookup() [1/2]

std::string Botan::OIDS::lookup ( const OID & oid)
inline

Definition at line 77 of file oids.h.

77 {
78 return oid.human_name_or_empty();
79}
std::string human_name_or_empty() const
Definition asn1_oid.cpp:122

◆ lookup() [2/2]

OID Botan::OIDS::lookup ( std::string_view name)
inline

Definition at line 83 of file oids.h.

83 {
84 return OID::from_name(name).value_or(OID());
85}

References name.

◆ oid2str_or_empty()

std::string Botan::OIDS::oid2str_or_empty ( const OID & oid)
inline

Resolve an OID

Parameters
oidthe OID to look up
Returns
name associated with this OID, or an empty string

Definition at line 49 of file oids.h.

49 {
50 return oid.human_name_or_empty();
51}

◆ oid2str_or_throw()

std::string Botan::OIDS::oid2str_or_throw ( const OID & oid)
inline

Definition at line 67 of file oids.h.

67 {
68 std::string s = oid.human_name_or_empty();
69 if(s.empty()) {
70 throw Lookup_Error("No name associated with OID " + oid.to_string());
71 }
72 return s;
73}
std::string to_string() const
Definition asn1_oid.cpp:108

References Botan::OID::human_name_or_empty().

◆ str2oid_or_empty()

OID Botan::OIDS::str2oid_or_empty ( std::string_view name)
inline

Find the OID to a name. The lookup will be performed in the general OID section of the configuration.

Parameters
namethe name to resolve
Returns
OID associated with the specified name

Definition at line 61 of file oids.h.

61 {
62 return OID::from_name(name).value_or(OID());
63}

References name.