Botan 3.6.1
Crypto and TLS for C&
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 22 of file oids.h.

22 {
23 OID::register_oid(oid, name);
24}
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 30 of file oids.h.

30 {
31 OID::register_oid(OID(oidstr), name);
32}

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

61 {
62 return oid.human_name_or_empty();
63}
std::string human_name_or_empty() const
Definition asn1_oid.cpp:147

◆ lookup() [2/2]

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

Definition at line 65 of file oids.h.

65 {
66 return OID::from_name(name).value_or(OID());
67}

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

39 {
40 return oid.human_name_or_empty();
41}

◆ oid2str_or_throw()

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

Definition at line 53 of file oids.h.

53 {
54 std::string s = oid.human_name_or_empty();
55 if(s.empty()) {
56 throw Lookup_Error("No name associated with OID " + oid.to_string());
57 }
58 return s;
59}
std::string to_string() const
Definition asn1_oid.cpp:125

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

49 {
50 return OID::from_name(name).value_or(OID());
51}

References name.