summary refs log tree commit diff
path: root/crypto/src/pkcs/Pkcs10CertificationRequestDelaySigned.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/pkcs/Pkcs10CertificationRequestDelaySigned.cs')
-rw-r--r--crypto/src/pkcs/Pkcs10CertificationRequestDelaySigned.cs18
1 files changed, 6 insertions, 12 deletions
diff --git a/crypto/src/pkcs/Pkcs10CertificationRequestDelaySigned.cs b/crypto/src/pkcs/Pkcs10CertificationRequestDelaySigned.cs
index e3a710f37..f95cf826c 100644
--- a/crypto/src/pkcs/Pkcs10CertificationRequestDelaySigned.cs
+++ b/crypto/src/pkcs/Pkcs10CertificationRequestDelaySigned.cs
@@ -95,18 +95,12 @@ namespace Org.BouncyCastle.Pkcs
 			if (publicKey.IsPrivate)
 				throw new ArgumentException("expected public key", "publicKey");
 
-			DerObjectIdentifier sigOid = CollectionUtilities.GetValueOrNull(m_algorithms, signatureAlgorithm);
-			if (sigOid == null)
-			{
-				try
-				{
-					sigOid = new DerObjectIdentifier(signatureAlgorithm);
-				}
-				catch (Exception e)
-				{
-					throw new ArgumentException("Unknown signature type requested", e);
-				}
-			}
+            if (!m_algorithms.TryGetValue(signatureAlgorithm, out var sigOid) &&
+                !DerObjectIdentifier.TryFromID(signatureAlgorithm, out sigOid))
+            {
+                throw new ArgumentException("Unknown signature type requested");
+            }
+
 			if (m_noParams.Contains(sigOid))
 			{
 				this.sigAlgId = new AlgorithmIdentifier(sigOid);