diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-27 12:36:37 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-27 12:36:37 +0700 |
commit | 3176c087b90511375c9bbd90cc5a4b5ed7857c35 (patch) | |
tree | 8bbe7bb81547c2e9afc719f6fdbcf258698c226c /crypto/src/pkcs/Pkcs10CertificationRequestDelaySigned.cs | |
parent | Generics migration work (diff) | |
download | BouncyCastle.NET-ed25519-3176c087b90511375c9bbd90cc5a4b5ed7857c35.tar.xz |
Generics migration in Pkcs
Diffstat (limited to 'crypto/src/pkcs/Pkcs10CertificationRequestDelaySigned.cs')
-rw-r--r-- | crypto/src/pkcs/Pkcs10CertificationRequestDelaySigned.cs | 23 |
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(); |