summary refs log tree commit diff
path: root/crypto/src/asn1/Asn1Utilities.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/Asn1Utilities.cs')
-rw-r--r--crypto/src/asn1/Asn1Utilities.cs28
1 files changed, 28 insertions, 0 deletions
diff --git a/crypto/src/asn1/Asn1Utilities.cs b/crypto/src/asn1/Asn1Utilities.cs
new file mode 100644
index 000000000..bdeb46483
--- /dev/null
+++ b/crypto/src/asn1/Asn1Utilities.cs
@@ -0,0 +1,28 @@
+using System;
+
+namespace Org.BouncyCastle.Asn1
+{
+    public abstract class Asn1Utilities
+    {
+        public static string GetTagText(Asn1TaggedObject taggedObject)
+        {
+            // TODO[asn1] Implement and use taggedObject.TagClass
+            return GetTagText(Asn1Tags.ContextSpecific, taggedObject.TagNo);
+        }
+
+        public static string GetTagText(int tagClass, int tagNo)
+        {
+            switch (tagClass)
+            {
+            case Asn1Tags.Application:
+                return "[APPLICATION " + tagNo + "]";
+            case Asn1Tags.ContextSpecific:
+                return "[CONTEXT " + tagNo + "]";
+            case Asn1Tags.Private:
+                return "[PRIVATE " + tagNo + "]";
+            default:
+                return "[UNIVERSAL " + tagNo + "]";
+            }
+        }
+    }
+}