diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2021-11-06 19:07:02 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2021-11-06 19:07:02 +0700 |
commit | 0661cf3bc3259e0f14fc70d660c44c47f0b03a83 (patch) | |
tree | 916e0de96aa3b351fb19ea0a5e76a4f7f7380e6d /crypto/src/asn1 | |
parent | Refactor GetString (diff) | |
download | BouncyCastle.NET-ed25519-0661cf3bc3259e0f14fc70d660c44c47f0b03a83.tar.xz |
Add Asn1Utilities class
Diffstat (limited to '')
-rw-r--r-- | crypto/src/asn1/Asn1Utilities.cs | 28 |
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 + "]"; + } + } + } +} |