Botan 3.1.1
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 26 of file oids.h.

26 {
27 OID::register_oid(oid, name);
28}
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 40 of file oids.h.

40 {
41 OID::register_oid(OID(oidstr), name);
42}

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 78 of file oids.h.

78 {
79 return oid.human_name_or_empty();
80}
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 84 of file oids.h.

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

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 51 of file oids.h.

51 {
52 return oid.human_name_or_empty();
53}

◆ oid2str_or_throw()

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

Definition at line 69 of file oids.h.

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

◆ 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 63 of file oids.h.

63 {
64 return OID::from_name(name).value_or(OID());
65}

References name.