Botan 3.8.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}
static void register_oid(const OID &oid, std::string_view name)
Definition asn1_oid.cpp:67

References add_oid(), and Botan::OID::register_oid().

Referenced by add_oid().

◆ add_oid2str()

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

Definition at line 14 of file oids.cpp.

14 {
16}
static OID_Map & global_registry()
Definition oid_map.cpp:16
void add_oid2str(const OID &oid, std::string_view str)
Definition oid_map.cpp:46

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

◆ 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 add_oidstr(), BOTAN_DEPRECATED, and Botan::OID::register_oid().

Referenced by add_oidstr().

◆ add_str2oid()

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

Definition at line 18 of file oids.cpp.

18 {
20}
void add_str2oid(const OID &oid, std::string_view str)
Definition oid_map.cpp:39

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

◆ 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

References lookup().

Referenced by lookup(), and lookup().

◆ 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}
static std::optional< OID > from_name(std::string_view name)
Definition asn1_oid.cpp:72

References Botan::OID::from_name(), and lookup().

◆ 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}

References oid2str_or_empty().

Referenced by oid2str_or_empty().

◆ 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 oid2str_or_throw().

Referenced by oid2str_or_throw().

◆ 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 Botan::OID::from_name(), and str2oid_or_empty().

Referenced by str2oid_or_empty().