aboutsummaryrefslogtreecommitdiffstats
path: root/src/oids.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-05-18 18:33:19 +0000
committerlloyd <[email protected]>2006-05-18 18:33:19 +0000
commita2c99d3270eb73ef2db5704fc54356c6b75096f8 (patch)
treead3d6c4fcc8dd0f403f8105598943616246fe172 /src/oids.cpp
Initial checkin1.5.6
Diffstat (limited to 'src/oids.cpp')
-rw-r--r--src/oids.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/oids.cpp b/src/oids.cpp
new file mode 100644
index 000000000..df6a09f94
--- /dev/null
+++ b/src/oids.cpp
@@ -0,0 +1,52 @@
+/*************************************************
+* OID Registry Source File *
+* (C) 1999-2006 The Botan Project *
+*************************************************/
+
+#include <botan/oids.h>
+#include <botan/libstate.h>
+
+namespace Botan {
+
+namespace OIDS {
+
+/*************************************************
+* Register an OID to string mapping *
+*************************************************/
+void add_oid(const OID& oid, const std::string& name)
+ {
+ const std::string oid_str = oid.as_string();
+
+ if(!global_state().option_set("oid2str", oid_str))
+ global_state().set_option("oid2str", oid_str, name);
+ if(!global_state().option_set("str2oid", name))
+ global_state().set_option("str2oid", name, oid_str);
+ }
+
+/*************************************************
+* Do an OID to string lookup *
+*************************************************/
+std::string lookup(const OID& oid)
+ {
+ return global_state().get_option("oid2str", oid.as_string());
+ }
+
+/*************************************************
+* Do a string to OID lookup *
+*************************************************/
+OID lookup(const std::string& name)
+ {
+ return OID(global_state().get_option("str2oid", name));
+ }
+
+/*************************************************
+* Check to see if an OID exists in the table *
+*************************************************/
+bool have_oid(const std::string& name)
+ {
+ return global_state().option_set("str2oid", name);
+ }
+
+}
+
+}