diff options
-rw-r--r-- | crypto/src/crypto/tls/HashAlgorithm.cs | 16 | ||||
-rw-r--r-- | crypto/src/crypto/tls/TlsUtilities.cs | 7 |
2 files changed, 21 insertions, 2 deletions
diff --git a/crypto/src/crypto/tls/HashAlgorithm.cs b/crypto/src/crypto/tls/HashAlgorithm.cs index 0f38e2d7c..a6b42d4ed 100644 --- a/crypto/src/crypto/tls/HashAlgorithm.cs +++ b/crypto/src/crypto/tls/HashAlgorithm.cs @@ -45,5 +45,21 @@ namespace Org.BouncyCastle.Crypto.Tls { return 224 <= hashAlgorithm && hashAlgorithm <= 255; } + + public static bool IsRecognized(byte hashAlgorithm) + { + switch (hashAlgorithm) + { + case md5: + case sha1: + case sha224: + case sha256: + case sha384: + case sha512: + return true; + default: + return false; + } + } } } diff --git a/crypto/src/crypto/tls/TlsUtilities.cs b/crypto/src/crypto/tls/TlsUtilities.cs index 48eb9d375..698bf6da6 100644 --- a/crypto/src/crypto/tls/TlsUtilities.cs +++ b/crypto/src/crypto/tls/TlsUtilities.cs @@ -1199,11 +1199,14 @@ namespace Org.BouncyCastle.Crypto.Tls { byte hashAlgorithm = signatureAndHashAlgorithm.Hash; - // TODO Support values in the "Reserved for Private Use" range - if (!HashAlgorithm.IsPrivate(hashAlgorithm)) + if (HashAlgorithm.IsRecognized(hashAlgorithm)) { handshakeHash.TrackHashAlgorithm(hashAlgorithm); } + else //if (HashAlgorithm.IsPrivate(hashAlgorithm)) + { + // TODO Support values in the "Reserved for Private Use" range + } } } } |