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.cs23
1 files changed, 7 insertions, 16 deletions
diff --git a/crypto/src/pkcs/Pkcs10CertificationRequestDelaySigned.cs b/crypto/src/pkcs/Pkcs10CertificationRequestDelaySigned.cs
index ecbb4ab62..e3a710f37 100644
--- a/crypto/src/pkcs/Pkcs10CertificationRequestDelaySigned.cs
+++ b/crypto/src/pkcs/Pkcs10CertificationRequestDelaySigned.cs
@@ -1,19 +1,10 @@
 using System;
-using System.Collections;
-using System.Globalization;
 using System.IO;
 
 using Org.BouncyCastle.Asn1;
-using Org.BouncyCastle.Asn1.CryptoPro;
-using Org.BouncyCastle.Asn1.Nist;
-using Org.BouncyCastle.Asn1.Oiw;
 using Org.BouncyCastle.Asn1.Pkcs;
-using Org.BouncyCastle.Asn1.TeleTrust;
 using Org.BouncyCastle.Asn1.X509;
-using Org.BouncyCastle.Asn1.X9;
 using Org.BouncyCastle.Crypto;
-using Org.BouncyCastle.Security;
-using Org.BouncyCastle.Utilities;
 using Org.BouncyCastle.Utilities.Collections;
 using Org.BouncyCastle.X509;
 
@@ -103,27 +94,26 @@ namespace Org.BouncyCastle.Pkcs
 				throw new ArgumentNullException("publicKey");
 			if (publicKey.IsPrivate)
 				throw new ArgumentException("expected public key", "publicKey");
-//			DerObjectIdentifier sigOid = SignerUtilities.GetObjectIdentifier(signatureAlgorithm);
-			string algorithmName = Platform.ToUpperInvariant(signatureAlgorithm);
-			DerObjectIdentifier sigOid = (DerObjectIdentifier) algorithms[algorithmName];
+
+			DerObjectIdentifier sigOid = CollectionUtilities.GetValueOrNull(m_algorithms, signatureAlgorithm);
 			if (sigOid == null)
 			{
 				try
 				{
-					sigOid = new DerObjectIdentifier(algorithmName);
+					sigOid = new DerObjectIdentifier(signatureAlgorithm);
 				}
 				catch (Exception e)
 				{
 					throw new ArgumentException("Unknown signature type requested", e);
 				}
 			}
-			if (noParams.Contains(sigOid))
+			if (m_noParams.Contains(sigOid))
 			{
 				this.sigAlgId = new AlgorithmIdentifier(sigOid);
 			}
-			else if (exParams.Contains(algorithmName))
+			else if (m_exParams.TryGetValue(signatureAlgorithm, out var explicitParameters))
 			{
-				this.sigAlgId = new AlgorithmIdentifier(sigOid, (Asn1Encodable) exParams[algorithmName]);
+				this.sigAlgId = new AlgorithmIdentifier(sigOid, explicitParameters);
 			}
 			else
 			{
@@ -132,6 +122,7 @@ namespace Org.BouncyCastle.Pkcs
 			SubjectPublicKeyInfo pubInfo = SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(publicKey);
 			this.reqInfo = new CertificationRequestInfo(subject, pubInfo, attributes);
 		}
+
 		public byte[] GetDataToSign()
 		{
 			return reqInfo.GetDerEncoded();