summary refs log tree commit diff
path: root/crypto/src/tls/SignatureAlgorithm.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-05-10 17:15:55 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-05-10 17:15:55 +0700
commiteda54f7b1f46d4965eb483cb41d47358f7cea530 (patch)
tree9095d952bdb2e0cfb6a7b6b09a87a264cba9f4d5 /crypto/src/tls/SignatureAlgorithm.cs
parentImprove TLS handshake hash tracking (diff)
downloadBouncyCastle.NET-ed25519-eda54f7b1f46d4965eb483cb41d47358f7cea530.tar.xz
Minor SignatureAlgorithm additions
Diffstat (limited to 'crypto/src/tls/SignatureAlgorithm.cs')
-rw-r--r--crypto/src/tls/SignatureAlgorithm.cs43
1 files changed, 35 insertions, 8 deletions
diff --git a/crypto/src/tls/SignatureAlgorithm.cs b/crypto/src/tls/SignatureAlgorithm.cs
index 726504c52..baf5620e3 100644
--- a/crypto/src/tls/SignatureAlgorithm.cs
+++ b/crypto/src/tls/SignatureAlgorithm.cs
@@ -86,20 +86,16 @@ namespace Org.BouncyCastle.Tls
                 return "dsa";
             case ecdsa:
                 return "ecdsa";
-            case ed25519:
-                return "ed25519";
-            case ed448:
-                return "ed448";
-            case gostr34102012_256:
-                return "gostr34102012_256";
-            case gostr34102012_512:
-                return "gostr34102012_512";
             case rsa_pss_rsae_sha256:
                 return "rsa_pss_rsae_sha256";
             case rsa_pss_rsae_sha384:
                 return "rsa_pss_rsae_sha384";
             case rsa_pss_rsae_sha512:
                 return "rsa_pss_rsae_sha512";
+            case ed25519:
+                return "ed25519";
+            case ed448:
+                return "ed448";
             case rsa_pss_pss_sha256:
                 return "rsa_pss_pss_sha256";
             case rsa_pss_pss_sha384:
@@ -112,6 +108,10 @@ namespace Org.BouncyCastle.Tls
                 return "ecdsa_brainpoolP384r1tls13_sha384";
             case ecdsa_brainpoolP512r1tls13_sha512:
                 return "ecdsa_brainpoolP512r1tls13_sha512";
+            case gostr34102012_256:
+                return "gostr34102012_256";
+            case gostr34102012_512:
+                return "gostr34102012_512";
             default:
                 return "UNKNOWN";
             }
@@ -121,5 +121,32 @@ namespace Org.BouncyCastle.Tls
         {
             return GetName(signatureAlgorithm) + "(" + signatureAlgorithm + ")";
         }
+
+        public static bool IsRecognized(short signatureAlgorithm)
+        {
+            switch (signatureAlgorithm)
+            {
+            case anonymous:
+            case rsa:
+            case dsa:
+            case ecdsa:
+            case rsa_pss_rsae_sha256:
+            case rsa_pss_rsae_sha384:
+            case rsa_pss_rsae_sha512:
+            case ed25519:
+            case ed448:
+            case rsa_pss_pss_sha256:
+            case rsa_pss_pss_sha384:
+            case rsa_pss_pss_sha512:
+            case ecdsa_brainpoolP256r1tls13_sha256:
+            case ecdsa_brainpoolP384r1tls13_sha384:
+            case ecdsa_brainpoolP512r1tls13_sha512:
+            case gostr34102012_256:
+            case gostr34102012_512:
+                return true;
+            default:
+                return false;
+            }
+        }
     }
 }