summary refs log tree commit diff
path: root/crypto/src/operators/utilities/DefaultDigestAlgorithmFinder.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/operators/utilities/DefaultDigestAlgorithmFinder.cs')
-rw-r--r--crypto/src/operators/utilities/DefaultDigestAlgorithmFinder.cs12
1 files changed, 3 insertions, 9 deletions
diff --git a/crypto/src/operators/utilities/DefaultDigestAlgorithmFinder.cs b/crypto/src/operators/utilities/DefaultDigestAlgorithmFinder.cs
index 025b94622..4e71c8a94 100644
--- a/crypto/src/operators/utilities/DefaultDigestAlgorithmFinder.cs
+++ b/crypto/src/operators/utilities/DefaultDigestAlgorithmFinder.cs
@@ -308,16 +308,10 @@ namespace Org.BouncyCastle.Operators.Utilities
 
         public virtual AlgorithmIdentifier Find(string digestName)
         {
-            if (DigestNameToOids.TryGetValue(digestName, out var digestOid))
-                return Find(digestOid);
-
-            try
+            if (DigestNameToOids.TryGetValue(digestName, out var digestOid) ||
+                DerObjectIdentifier.TryFromID(digestName, out digestOid))
             {
-                return Find(new DerObjectIdentifier(digestName));
-            }
-            catch (Exception)
-            {
-                // ignore - tried it but it didn't work...
+                return Find(digestOid);
             }
 
             return null;