Botan 3.4.0
Crypto and TLS for C&
oid_map.h
Go to the documentation of this file.
1/*
2* (C) 2023 Jack Lloyd
3*
4* Botan is released under the Simplified BSD License (see license.txt)
5*/
6
7#ifndef BOTAN_OID_MAP_H_
8#define BOTAN_OID_MAP_H_
9
10#include <botan/asn1_obj.h>
11#include <botan/mutex.h>
12#include <string>
13#include <string_view>
14#include <unordered_map>
15
16namespace Botan {
17
19 public:
20 void add_oid(const OID& oid, std::string_view str);
21
22 void add_str2oid(const OID& oid, std::string_view str);
23
24 void add_oid2str(const OID& oid, std::string_view str);
25
26 std::string oid2str(const OID& oid);
27
28 OID str2oid(std::string_view str);
29
30 static OID_Map& global_registry();
31
32 private:
33 static std::unordered_map<std::string, std::string> load_oid2str_map();
34 static std::unordered_map<std::string, OID> load_str2oid_map();
35
36 OID_Map();
37
38 mutex_type m_mutex;
39 std::unordered_map<std::string, OID> m_str2oid;
40 std::unordered_map<std::string, std::string> m_oid2str;
41};
42
43} // namespace Botan
44
45#endif
std::string oid2str(const OID &oid)
Definition oid_map.cpp:56
void add_oid(const OID &oid, std::string_view str)
Definition oid_map.cpp:21
static OID_Map & global_registry()
Definition oid_map.cpp:16
void add_str2oid(const OID &oid, std::string_view str)
Definition oid_map.cpp:41
void add_oid2str(const OID &oid, std::string_view str)
Definition oid_map.cpp:48
OID str2oid(std::string_view str)
Definition oid_map.cpp:69
int(* final)(unsigned char *, CTX *)