summary refs log tree commit diff
path: root/crypto/src/crypto/tls/AlertLevel.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/crypto/tls/AlertLevel.cs')
-rw-r--r--crypto/src/crypto/tls/AlertLevel.cs18
1 files changed, 18 insertions, 0 deletions
diff --git a/crypto/src/crypto/tls/AlertLevel.cs b/crypto/src/crypto/tls/AlertLevel.cs
index d77251dfb..9461a0b58 100644
--- a/crypto/src/crypto/tls/AlertLevel.cs
+++ b/crypto/src/crypto/tls/AlertLevel.cs
@@ -7,5 +7,23 @@ namespace Org.BouncyCastle.Crypto.Tls
     {
         public const byte warning = 1;
         public const byte fatal = 2;
+
+        public static string GetName(byte alertDescription)
+        {
+            switch (alertDescription)
+            {
+            case warning:
+                return "warning";
+            case fatal:
+                return "fatal";
+            default:
+                return "UNKNOWN";
+            }
+        }
+
+        public static string GetText(byte alertDescription)
+        {
+            return GetName(alertDescription) + "(" + alertDescription + ")";
+        }
     }
 }