aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/asn1/asn1_obj.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-11-15 16:08:57 -0500
committerJack Lloyd <[email protected]>2017-11-15 16:50:53 -0500
commita94a462f6ddab82bae2e42ca19aa9d7e5780a5b0 (patch)
tree91e6d3eba5d5ed37eb6bf7e6e9407ce4c73b3517 /src/lib/asn1/asn1_obj.cpp
parente2217197ac766d11a28ee1389e414ca8bbb0b294 (diff)
Move ASN1 printer to the library
Diffstat (limited to 'src/lib/asn1/asn1_obj.cpp')
-rw-r--r--src/lib/asn1/asn1_obj.cpp57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/lib/asn1/asn1_obj.cpp b/src/lib/asn1/asn1_obj.cpp
index 2dc73738c..1f93a4b8b 100644
--- a/src/lib/asn1/asn1_obj.cpp
+++ b/src/lib/asn1/asn1_obj.cpp
@@ -12,6 +12,63 @@
namespace Botan {
+std::string asn1_tag_to_string(ASN1_Tag type)
+ {
+ switch(type)
+ {
+ case Botan::PRINTABLE_STRING:
+ return "PRINTABLE STRING";
+
+ case Botan::NUMERIC_STRING:
+ return "NUMERIC STRING";
+
+ case Botan::IA5_STRING:
+ return "IA5 STRING";
+
+ case Botan::T61_STRING:
+ return "T61 STRING";
+
+ case Botan::UTF8_STRING:
+ return "UTF8 STRING";
+
+ case Botan::VISIBLE_STRING:
+ return "VISIBLE STRING";
+
+ case Botan::BMP_STRING:
+ return "BMP STRING";
+
+ case Botan::UTC_TIME:
+ return "UTC TIME";
+
+ case Botan::GENERALIZED_TIME:
+ return "GENERALIZED TIME";
+
+ case Botan::OCTET_STRING:
+ return "OCTET STRING";
+
+ case Botan::BIT_STRING:
+ return "BIT STRING";
+
+ case Botan::ENUMERATED:
+ return "ENUMERATED";
+
+ case Botan::INTEGER:
+ return "INTEGER";
+
+ case Botan::NULL_TAG:
+ return "NULL";
+
+ case Botan::OBJECT_ID:
+ return "OBJECT";
+
+ case Botan::BOOLEAN:
+ return "BOOLEAN";
+
+ default:
+ return "TAG(" + std::to_string(static_cast<size_t>(type)) + ")";
+ }
+ }
+
/*
* BER Decoding Exceptions
*/