diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2024-03-12 17:00:28 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2024-03-12 17:00:28 +0700 |
commit | b243cd4ff1d6e8049ee58ec971771c92139db70b (patch) | |
tree | 27ebad743538d7386c2aae94f0992c834e333a48 /crypto/src/operators/utilities | |
parent | ASN.1: Limit OID contents to 4096 bytes (diff) | |
download | BouncyCastle.NET-ed25519-b243cd4ff1d6e8049ee58ec971771c92139db70b.tar.xz |
Use TryFromID to check for OID string
Diffstat (limited to 'crypto/src/operators/utilities')
-rw-r--r-- | crypto/src/operators/utilities/DefaultDigestAlgorithmFinder.cs | 12 |
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; |