summary refs log tree commit diff
path: root/crypto/test
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-06-27 02:19:14 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-06-27 02:19:14 +0700
commit4ea1816cffd5c8663bc9ae1234df0a70ef23fcd6 (patch)
treeeb4fe294ef230435928a573fadef3047b4466e9b /crypto/test
parentImplement generic IEnumerable in ASN.1 classes (diff)
downloadBouncyCastle.NET-ed25519-4ea1816cffd5c8663bc9ae1234df0a70ef23fcd6.tar.xz
Generics migration work
Diffstat (limited to 'crypto/test')
-rw-r--r--crypto/test/src/asn1/test/GenerationTest.cs25
-rw-r--r--crypto/test/src/ocsp/test/OCSPTest.cs22
-rw-r--r--crypto/test/src/test/AttrCertTest.cs3
-rw-r--r--crypto/test/src/test/CertPathBuilderTest.cs4
-rw-r--r--crypto/test/src/test/CertPathTest.cs2
-rw-r--r--crypto/test/src/test/CertPathValidatorTest.cs9
-rw-r--r--crypto/test/src/test/CertTest.cs11
-rw-r--r--crypto/test/src/test/NistCertPathTest.cs31
-rw-r--r--crypto/test/src/test/PKCS10CertRequestTest.cs9
-rw-r--r--crypto/test/src/test/PkixPolicyMappingTest.cs22
-rw-r--r--crypto/test/src/test/TestUtilities.cs14
-rw-r--r--crypto/test/src/test/nist/NistCertPathTest.cs22
-rw-r--r--crypto/test/src/test/nist/NistCertPathTest2.cs10
-rw-r--r--crypto/test/src/x509/test/TestCertificateGen.cs3
14 files changed, 87 insertions, 100 deletions
diff --git a/crypto/test/src/asn1/test/GenerationTest.cs b/crypto/test/src/asn1/test/GenerationTest.cs

index 76077712a..3a0fae8e7 100644 --- a/crypto/test/src/asn1/test/GenerationTest.cs +++ b/crypto/test/src/asn1/test/GenerationTest.cs
@@ -1,7 +1,5 @@ using System; -using System.Collections; -using System.IO; -using System.Text; +using System.Collections.Generic; using NUnit.Framework; @@ -130,8 +128,8 @@ namespace Org.BouncyCastle.Asn1.Tests // // add extensions // - IList order = new ArrayList(); - IDictionary extensions = new Hashtable(); + var order = new List<DerObjectIdentifier>(); + var extensions = new Dictionary<DerObjectIdentifier, X509Extension>(); order.Add(X509Extensions.AuthorityKeyIdentifier); order.Add(X509Extensions.SubjectKeyIdentifier); @@ -201,8 +199,8 @@ namespace Org.BouncyCastle.Asn1.Tests // // add extensions // - IList order = new ArrayList(); - IDictionary extensions = new Hashtable(); + var order = new List<DerObjectIdentifier>(); + var extensions = new Dictionary<DerObjectIdentifier, X509Extension>(); order.Add(X509Extensions.SubjectAlternativeName); @@ -251,12 +249,13 @@ namespace Org.BouncyCastle.Asn1.Tests gen.SetSignature(new AlgorithmIdentifier(PkcsObjectIdentifiers.Sha1WithRsaEncryption, DerNull.Instance)); - // - // extensions - // - IList order = new ArrayList(); - IDictionary extensions = new Hashtable(); - SubjectPublicKeyInfo info = new SubjectPublicKeyInfo( + // + // extensions + // + var order = new List<DerObjectIdentifier>(); + var extensions = new Dictionary<DerObjectIdentifier, X509Extension>(); + + SubjectPublicKeyInfo info = new SubjectPublicKeyInfo( new AlgorithmIdentifier( OiwObjectIdentifiers.ElGamalAlgorithm, new ElGamalParameter(BigInteger.One, BigInteger.Two)), diff --git a/crypto/test/src/ocsp/test/OCSPTest.cs b/crypto/test/src/ocsp/test/OCSPTest.cs
index 1630e29b1..73e2ff9f7 100644 --- a/crypto/test/src/ocsp/test/OCSPTest.cs +++ b/crypto/test/src/ocsp/test/OCSPTest.cs
@@ -1,6 +1,5 @@ using System; -using System.Collections; -using System.IO; +using System.Collections.Generic; using NUnit.Framework; @@ -9,7 +8,6 @@ using Org.BouncyCastle.Asn1.Ocsp; using Org.BouncyCastle.Asn1.X509; using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Math; -using Org.BouncyCastle.Utilities.Collections; using Org.BouncyCastle.Utilities.Encoders; using Org.BouncyCastle.Utilities.Test; using Org.BouncyCastle.X509; @@ -316,8 +314,8 @@ namespace Org.BouncyCastle.Ocsp.Tests gen = new OcspReqGenerator(); - IList oids = new ArrayList(); - IList values = new ArrayList(); + var oids = new List<DerObjectIdentifier>(); + var values = new List<X509Extension>(); byte[] sampleNonce = new byte[16]; Random rand = new Random(); @@ -349,7 +347,7 @@ namespace Org.BouncyCastle.Ocsp.Tests // // extension check. // - ISet extOids = req.GetCriticalExtensionOids(); + var extOids = req.GetCriticalExtensionOids(); if (extOids.Count != 0) { @@ -504,8 +502,8 @@ namespace Org.BouncyCastle.Ocsp.Tests gen = new OcspReqGenerator(); - IList oids = new ArrayList(); - IList values = new ArrayList(); + var oids = new List<DerObjectIdentifier>(); + var values = new List<X509Extension>(); byte[] sampleNonce = new byte[16]; Random rand = new Random(); @@ -538,7 +536,7 @@ namespace Org.BouncyCastle.Ocsp.Tests // // extension check. // - ISet extOids = req.GetCriticalExtensionOids(); + var extOids = req.GetCriticalExtensionOids(); if (extOids.Count != 0) { @@ -706,8 +704,8 @@ namespace Org.BouncyCastle.Ocsp.Tests gen = new OcspReqGenerator(); - IList oids = new ArrayList(); - IList values = new ArrayList(); + var oids = new List<DerObjectIdentifier>(); + var values = new List<X509Extension>(); byte[] sampleNonce = new byte[16]; Random rand = new Random(); @@ -740,7 +738,7 @@ namespace Org.BouncyCastle.Ocsp.Tests // // extension check. // - ISet extOids = req.GetCriticalExtensionOids(); + var extOids = req.GetCriticalExtensionOids(); if (extOids.Count != 0) { diff --git a/crypto/test/src/test/AttrCertTest.cs b/crypto/test/src/test/AttrCertTest.cs
index 055a6b456..e315b8c6a 100644 --- a/crypto/test/src/test/AttrCertTest.cs +++ b/crypto/test/src/test/AttrCertTest.cs
@@ -1,5 +1,4 @@ using System; -using System.Collections; using System.Collections.Generic; using NUnit.Framework; @@ -566,7 +565,7 @@ namespace Org.BouncyCastle.Tests aCert = gen.Generate(new Asn1SignatureFactory("SHA1WithRSAEncryption", privKey, null)); - ISet exts = aCert.GetCriticalExtensionOids(); + var exts = aCert.GetCriticalExtensionOids(); if (exts.Count != 1 || !exts.Contains("1.1")) { diff --git a/crypto/test/src/test/CertPathBuilderTest.cs b/crypto/test/src/test/CertPathBuilderTest.cs
index dac45748a..305832ff3 100644 --- a/crypto/test/src/test/CertPathBuilderTest.cs +++ b/crypto/test/src/test/CertPathBuilderTest.cs
@@ -48,7 +48,7 @@ namespace Org.BouncyCastle.Tests DateTime validDate = new DateTime(2008, 9, 4, 5, 49, 10); //Searching for rootCert by subjectDN without CRL - ISet trust = new HashSet(); + var trust = new HashSet<TrustAnchor>(); trust.Add(new TrustAnchor(rootCert, null)); PkixCertPathBuilder cpb = new PkixCertPathBuilder(); @@ -95,7 +95,7 @@ namespace Org.BouncyCastle.Tests IStore<X509Certificate> x509CertStore = CollectionUtilities.CreateStore(certList); IStore<X509Crl> x509CrlStore = CollectionUtilities.CreateStore(crlList); - ISet trust = new HashSet(); + var trust = new HashSet<TrustAnchor>(); trust.Add(new TrustAnchor(rootCert, null)); // build the path diff --git a/crypto/test/src/test/CertPathTest.cs b/crypto/test/src/test/CertPathTest.cs
index a763e2dcc..e254e0c41 100644 --- a/crypto/test/src/test/CertPathTest.cs +++ b/crypto/test/src/test/CertPathTest.cs
@@ -143,7 +143,7 @@ namespace Org.BouncyCastle.Tests X509CertStoreSelector select = new X509CertStoreSelector(); select.Subject = ((X509Certificate)certCol[0]).SubjectDN; - ISet trustanchors = new HashSet(); + var trustanchors = new HashSet<TrustAnchor>(); trustanchors.Add(new TrustAnchor(cf.ReadCertificate(rootCertBin), null)); // CertStore certStore = CertStore.getInstance("Collection", new CollectionCertStoreParameters(certCol)); diff --git a/crypto/test/src/test/CertPathValidatorTest.cs b/crypto/test/src/test/CertPathValidatorTest.cs
index 42625d1ec..b4d5d7773 100644 --- a/crypto/test/src/test/CertPathValidatorTest.cs +++ b/crypto/test/src/test/CertPathValidatorTest.cs
@@ -1,7 +1,6 @@ using System; using System.Collections; using System.Collections.Generic; -using System.IO; using NUnit.Framework; @@ -161,7 +160,7 @@ namespace Org.BouncyCastle.Tests // CertPath cp = CertificateFactory.GetInstance("X.509").GenerateCertPath(certchain); PkixCertPath cp = new PkixCertPath(certchain); - ISet trust = new HashSet(); + var trust = new HashSet<TrustAnchor>(); trust.Add(new TrustAnchor(rootCert, null)); // CertPathValidator cpv = CertPathValidator.GetInstance("PKIX"); @@ -237,7 +236,7 @@ namespace Org.BouncyCastle.Tests // cp = CertificateFactory.GetInstance("X.509").GenerateCertPath(certchain); cp = new PkixCertPath(certchain); - trust = new HashSet(); + trust = new HashSet<TrustAnchor>(); trust.Add(new TrustAnchor(rootCert, null)); // cpv = CertPathValidator.GetInstance("PKIX"); @@ -291,12 +290,12 @@ namespace Org.BouncyCastle.Tests return true; } - public override ISet GetSupportedExtensions() + public override ISet<string> GetSupportedExtensions() { return null; } - public override void Check(X509Certificate cert, ISet unresolvedCritExts) + public override void Check(X509Certificate cert, ISet<string> unresolvedCritExts) { count++; } diff --git a/crypto/test/src/test/CertTest.cs b/crypto/test/src/test/CertTest.cs
index eb1c62ae1..5fc23d861 100644 --- a/crypto/test/src/test/CertTest.cs +++ b/crypto/test/src/test/CertTest.cs
@@ -1,5 +1,6 @@ using System; using System.Collections; +using System.Collections.Generic; using System.IO; using System.Text; @@ -1172,7 +1173,7 @@ namespace Org.BouncyCastle.Tests cert.Verify(pubKey); - ISet dummySet = cert.GetNonCriticalExtensionOids(); + var dummySet = cert.GetNonCriticalExtensionOids(); if (dummySet != null) { Fail("non-critical oid set should be null"); @@ -1737,8 +1738,8 @@ namespace Org.BouncyCastle.Tests crlGen.SetThisUpdate(now); crlGen.SetNextUpdate(now.AddSeconds(100)); - IList extOids = new ArrayList(); - IList extValues = new ArrayList(); + var extOids = new List<DerObjectIdentifier>(); + var extValues = new List<X509Extension>(); CrlReason crlReason = new CrlReason(CrlReason.PrivilegeWithdrawn); @@ -1824,8 +1825,8 @@ namespace Org.BouncyCastle.Tests crlGen.SetThisUpdate(now); crlGen.SetNextUpdate(now.AddSeconds(100)); - IList extOids = new ArrayList(); - IList extValues = new ArrayList(); + var extOids = new List<DerObjectIdentifier>(); + var extValues = new List<X509Extension>(); CrlReason crlReason = new CrlReason(CrlReason.PrivilegeWithdrawn); diff --git a/crypto/test/src/test/NistCertPathTest.cs b/crypto/test/src/test/NistCertPathTest.cs
index f033f0b06..42f9895e8 100644 --- a/crypto/test/src/test/NistCertPathTest.cs +++ b/crypto/test/src/test/NistCertPathTest.cs
@@ -1,7 +1,6 @@ using System; using System.Collections; using System.Collections.Generic; -using System.IO; using System.Text; using NUnit.Framework; @@ -35,30 +34,30 @@ namespace Org.BouncyCastle.Tests private const string TEST_POLICY_4 = "2.16.840.1.101.3.1.48.4"; private const string TEST_POLICY_5 = "2.16.840.1.101.3.1.48.5"; - private static ISet ANY; - private static ISet TP1; - private static ISet TP2; - private static ISet TP3; - private static ISet TP4; - private static ISet TP1_TP2; + private static ISet<string> ANY; + private static ISet<string> TP1; + private static ISet<string> TP2; + private static ISet<string> TP3; + private static ISet<string> TP4; + private static ISet<string> TP1_TP2; static NistCertPathTest() { - ANY = new HashSet(); + ANY = new HashSet<string>(); - TP1 = new HashSet(); + TP1 = new HashSet<string>(); TP1.Add(TEST_POLICY_1); - TP2 = new HashSet(); + TP2 = new HashSet<string>(); TP2.Add(TEST_POLICY_2); - TP3 = new HashSet(); + TP3 = new HashSet<string>(); TP3.Add(TEST_POLICY_3); - TP4 = new HashSet(); + TP4 = new HashSet<string>(); TP4.Add(TEST_POLICY_4); - TP1_TP2 = new HashSet(); + TP1_TP2 = new HashSet<string>(); TP1_TP2.Add(TEST_POLICY_1); TP1_TP2.Add(TEST_POLICY_2); } @@ -71,7 +70,7 @@ namespace Org.BouncyCastle.Tests private X509Certificate trustedCert; private X509Crl trustedCRL; - private ISet trustedSet; + private ISet<TrustAnchor> trustedSet; private int testCount; private IList testFail; private StringBuilder resultBuf; @@ -258,7 +257,7 @@ namespace Org.BouncyCastle.Tests { trustedCert = certParser.ReadCertificate(Base64.Decode(Trust_Anchor_CP_01_01_crt)); trustedCRL = crlParser.ReadCrl(Base64.Decode(Trust_Anchor_CRL_CP_01_01_crl)); - trustedSet = new HashSet(); + trustedSet = new HashSet<TrustAnchor>(); byte[] _ncBytes = null; Asn1OctetString _oct = trustedCert.GetExtensionValue(X509Extensions.NameConstraints); @@ -335,7 +334,7 @@ namespace Org.BouncyCastle.Tests Test(_name, _data, null, _explicit, _accept, _debug); } - private void Test(string _name, string[] _data, ISet _ipolset, + private void Test(string _name, string[] _data, ISet<string> _ipolset, bool _explicit, bool _accept, bool _debug) { testCount++; diff --git a/crypto/test/src/test/PKCS10CertRequestTest.cs b/crypto/test/src/test/PKCS10CertRequestTest.cs
index b9ac59e66..94a53f9cf 100644 --- a/crypto/test/src/test/PKCS10CertRequestTest.cs +++ b/crypto/test/src/test/PKCS10CertRequestTest.cs
@@ -1,12 +1,11 @@ using System; using System.Collections; -using System.IO; +using System.Collections.Generic; using NUnit.Framework; using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.CryptoPro; using Org.BouncyCastle.Asn1.Pkcs; -using Org.BouncyCastle.Asn1.Utilities; using Org.BouncyCastle.Asn1.X509; using Org.BouncyCastle.Asn1.X9; using Org.BouncyCastle.Crypto; @@ -16,9 +15,7 @@ using Org.BouncyCastle.Math.EC; using Org.BouncyCastle.Pkcs; using Org.BouncyCastle.Security; using Org.BouncyCastle.Utilities.Encoders; -using Org.BouncyCastle.Utilities.IO.Pem; using Org.BouncyCastle.Utilities.Test; -using Org.BouncyCastle.X509; using Org.BouncyCastle.X509.Extension; namespace Org.BouncyCastle.Tests @@ -335,8 +332,8 @@ namespace Org.BouncyCastle.Tests AsymmetricCipherKeyPair pair = keyGen.GenerateKeyPair(); - IList oids = new ArrayList(); - IList values = new ArrayList(); + var oids = new List<DerObjectIdentifier>(); + var values = new List<X509Extension>(); oids.Add(X509Extensions.BasicConstraints); values.Add(new X509Extension(true, new DerOctetString(new BasicConstraints(true)))); oids.Add(X509Extensions.KeyUsage); diff --git a/crypto/test/src/test/PkixPolicyMappingTest.cs b/crypto/test/src/test/PkixPolicyMappingTest.cs
index d67492b83..097826907 100644 --- a/crypto/test/src/test/PkixPolicyMappingTest.cs +++ b/crypto/test/src/test/PkixPolicyMappingTest.cs
@@ -98,10 +98,10 @@ namespace Org.BouncyCastle.Tests X509Certificate trustCert, X509Certificate intCert, X509Certificate endCert, - ISet requirePolicies, + ISet<string> requirePolicies, bool okay) { - ISet trust = new HashSet(); + var trust = new HashSet<TrustAnchor>(); trust.Add(new TrustAnchor(trustCert, null)); X509CertStoreSelector targetConstraintsCert = new X509CertStoreSelector(); targetConstraintsCert.Subject = endCert.SubjectDN; @@ -234,7 +234,7 @@ namespace Org.BouncyCastle.Tests Asn1EncodableVector intPolicies = null; Hashtable map = null; Asn1EncodableVector policies = null; - ISet requirePolicies = null; + ISet<string> requirePolicies = null; X509Certificate intCert = null; X509Certificate endCert = null; @@ -264,7 +264,7 @@ namespace Org.BouncyCastle.Tests policies.Add(new PolicyInformation(new DerObjectIdentifier("2.16.840.1.101.3.2.1.48.2"))); endCert = CreateEndEntityCert(pubKey, intPrivKey, intPubKey, policies); - requirePolicies = new HashSet(); + requirePolicies = new HashSet<string>(); requirePolicies.Add("2.16.840.1.101.3.2.1.48.1"); msg = TestPolicies(1, trustCert, intCert, endCert, requirePolicies, true); CheckMessage(1, msg, ""); @@ -280,7 +280,7 @@ namespace Org.BouncyCastle.Tests policies.Add(new PolicyInformation(new DerObjectIdentifier("2.16.840.1.101.3.2.1.48.2"))); endCert = CreateEndEntityCert(pubKey, intPrivKey, intPubKey, policies); - requirePolicies = new HashSet(); + requirePolicies = new HashSet<string>(); requirePolicies.Add("2.5.29.32.0"); msg = TestPolicies(2, trustCert, intCert, endCert, requirePolicies, true); CheckMessage(2, msg, ""); @@ -297,7 +297,7 @@ namespace Org.BouncyCastle.Tests policies.Add(new PolicyInformation(new DerObjectIdentifier("2.16.840.1.101.3.2.1.48.2"))); endCert = CreateEndEntityCert(pubKey, intPrivKey, intPubKey, policies); - requirePolicies = new HashSet(); + requirePolicies = new HashSet<string>(); requirePolicies.Add("2.16.840.1.101.3.2.1.48.1"); msg = TestPolicies(3, trustCert, intCert, endCert, requirePolicies, true); CheckMessage(3, msg, ""); @@ -314,7 +314,7 @@ namespace Org.BouncyCastle.Tests policies.Add(new PolicyInformation(new DerObjectIdentifier("2.16.840.1.101.3.2.1.48.3"))); endCert = CreateEndEntityCert(pubKey, intPrivKey, intPubKey, policies); - requirePolicies = new HashSet(); + requirePolicies = new HashSet<string>(); requirePolicies.Add("2.16.840.1.101.3.2.1.48.3"); msg = TestPolicies(4, trustCert, intCert, endCert, requirePolicies, true); CheckMessage(4, msg, ""); @@ -330,7 +330,7 @@ namespace Org.BouncyCastle.Tests policies.Add(new PolicyInformation(new DerObjectIdentifier("2.16.840.1.101.3.2.1.48.2"))); endCert = CreateEndEntityCert(pubKey, intPrivKey, intPubKey, policies); - requirePolicies = new HashSet(); + requirePolicies = new HashSet<string>(); requirePolicies.Add("2.16.840.1.101.3.2.1.48.2"); msg = TestPolicies(5, trustCert, intCert, endCert, requirePolicies, false); CheckMessage(5, msg, "Path processing failed on policy."); @@ -346,7 +346,7 @@ namespace Org.BouncyCastle.Tests policies.Add(new PolicyInformation(new DerObjectIdentifier("2.16.840.1.101.3.2.1.48.1"))); endCert = CreateEndEntityCert(pubKey, intPrivKey, intPubKey, policies); - requirePolicies = new HashSet(); + requirePolicies = new HashSet<string>(); requirePolicies.Add("2.16.840.1.101.3.2.1.48.1"); msg = TestPolicies(6, trustCert, intCert, endCert, requirePolicies, true); CheckMessage(6, msg, ""); @@ -362,7 +362,7 @@ namespace Org.BouncyCastle.Tests policies.Add(new PolicyInformation(new DerObjectIdentifier("2.16.840.1.101.3.2.1.48.2"))); endCert = CreateEndEntityCert(pubKey, intPrivKey, intPubKey, policies); - requirePolicies = new HashSet(); + requirePolicies = new HashSet<string>(); requirePolicies.Add("2.16.840.1.101.3.2.1.48.3"); msg = TestPolicies(7, trustCert, intCert, endCert, requirePolicies, false); CheckMessage(7, msg, "Path processing failed on policy."); @@ -378,7 +378,7 @@ namespace Org.BouncyCastle.Tests policies.Add(new PolicyInformation(new DerObjectIdentifier("2.16.840.1.101.3.2.1.48.3"))); endCert = CreateEndEntityCert(pubKey, intPrivKey, intPubKey, policies); - requirePolicies = new HashSet(); + requirePolicies = new HashSet<string>(); requirePolicies.Add("2.16.840.1.101.3.2.1.48.1"); msg = TestPolicies(8, trustCert, intCert, endCert, requirePolicies, false); CheckMessage(8, msg, "Path processing failed on policy."); diff --git a/crypto/test/src/test/TestUtilities.cs b/crypto/test/src/test/TestUtilities.cs
index 63ca87873..5835784e9 100644 --- a/crypto/test/src/test/TestUtilities.cs +++ b/crypto/test/src/test/TestUtilities.cs
@@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.X509; @@ -7,7 +8,6 @@ using Org.BouncyCastle.Crypto.Operators; using Org.BouncyCastle.Math; using Org.BouncyCastle.Security; using Org.BouncyCastle.Security.Certificates; -using Org.BouncyCastle.Utilities.Collections; using Org.BouncyCastle.X509; using Org.BouncyCastle.X509.Extension; @@ -216,15 +216,12 @@ namespace Org.BouncyCastle.Tests public override byte[] GetEncoded() { if (_exceptionOnEncode) - { throw new CertificateEncodingException(); - } return new byte[0]; } - public override void Verify( - AsymmetricKeyParameter key) + public override void Verify(AsymmetricKeyParameter key) { throw new CertificateException(); } @@ -239,18 +236,17 @@ namespace Org.BouncyCastle.Tests return null; } - public override ISet GetCriticalExtensionOids() + public override ISet<string> GetCriticalExtensionOids() { return null; } - public override ISet GetNonCriticalExtensionOids() + public override ISet<string> GetNonCriticalExtensionOids() { return null; } - public override Asn1OctetString GetExtensionValue( - DerObjectIdentifier oid) + public override Asn1OctetString GetExtensionValue(DerObjectIdentifier oid) { return null; } diff --git a/crypto/test/src/test/nist/NistCertPathTest.cs b/crypto/test/src/test/nist/NistCertPathTest.cs
index 1a6f75a43..89565217c 100644 --- a/crypto/test/src/test/nist/NistCertPathTest.cs +++ b/crypto/test/src/test/nist/NistCertPathTest.cs
@@ -38,12 +38,12 @@ namespace Org.BouncyCastle.Tests.Nist private static readonly IDictionary certs = new Hashtable(); private static readonly IDictionary crls = new Hashtable(); - private static readonly ISet noPolicies = new HashSet(); - private static readonly ISet anyPolicy = new HashSet(); - private static readonly ISet nistTestPolicy1 = new HashSet(); - private static readonly ISet nistTestPolicy2 = new HashSet(); - private static readonly ISet nistTestPolicy3 = new HashSet(); - private static readonly ISet nistTestPolicy1And2 = new HashSet(); + private static readonly HashSet<string> noPolicies = new HashSet<string>(); + private static readonly HashSet<string> anyPolicy = new HashSet<string>(); + private static readonly HashSet<string> nistTestPolicy1 = new HashSet<string>(); + private static readonly HashSet<string> nistTestPolicy2 = new HashSet<string>(); + private static readonly HashSet<string> nistTestPolicy3 = new HashSet<string>(); + private static readonly HashSet<string> nistTestPolicy1And2 = new HashSet<string>(); static NistCertPathTest() { @@ -592,7 +592,7 @@ namespace Org.BouncyCastle.Tests.Nist string trustAnchor, string[] certs, string[] crls, - ISet policies, + ISet<string> policies, int index, string message) { @@ -643,9 +643,9 @@ namespace Org.BouncyCastle.Tests.Nist string trustAnchor, string[] certs, string[] crls, - ISet policies) + ISet<string> policies) { - ISet trustedSet = new HashSet(); + var trustedSet = new HashSet<TrustAnchor>(); trustedSet.Add(GetTrustAnchor(trustAnchor)); var x509Certs = new List<X509Certificate>(); @@ -692,11 +692,11 @@ namespace Org.BouncyCastle.Tests.Nist string trustAnchor, string[] certs, string[] crls, - ISet initialPolicies, + ISet<string> initialPolicies, bool policyMappingInhibited, bool anyPolicyInhibited) { - ISet trustedSet = new HashSet(); + var trustedSet = new HashSet<TrustAnchor>(); trustedSet.Add(GetTrustAnchor(trustAnchor)); var x509Certs = new List<X509Certificate>(); diff --git a/crypto/test/src/test/nist/NistCertPathTest2.cs b/crypto/test/src/test/nist/NistCertPathTest2.cs
index ffdad62e3..244f9f9c5 100644 --- a/crypto/test/src/test/nist/NistCertPathTest2.cs +++ b/crypto/test/src/test/nist/NistCertPathTest2.cs
@@ -259,7 +259,7 @@ namespace Org.BouncyCastle.Tests.Nist string trustAnchor, string[] certs, string[] crls, - ISet policies, + ISet<string> policies, int index, string message) { @@ -310,9 +310,9 @@ namespace Org.BouncyCastle.Tests.Nist string trustAnchor, string[] certs, string[] crls, - ISet policies) + ISet<string> policies) { - ISet trustedSet = new HashSet(); + var trustedSet = new HashSet<TrustAnchor>(); trustedSet.Add(GetTrustAnchor(trustAnchor)); var x509Certs = new List<X509Certificate>(); @@ -359,11 +359,11 @@ namespace Org.BouncyCastle.Tests.Nist string trustAnchor, string[] certs, string[] crls, - ISet initialPolicies, + ISet<string> initialPolicies, bool policyMappingInhibited, bool anyPolicyInhibited) { - ISet trustedSet = new HashSet(); + var trustedSet = new HashSet<TrustAnchor>(); trustedSet.Add(GetTrustAnchor(trustAnchor)); var x509Certs = new List<X509Certificate>(); diff --git a/crypto/test/src/x509/test/TestCertificateGen.cs b/crypto/test/src/x509/test/TestCertificateGen.cs
index 2a6b91d94..a4c548021 100644 --- a/crypto/test/src/x509/test/TestCertificateGen.cs +++ b/crypto/test/src/x509/test/TestCertificateGen.cs
@@ -11,7 +11,6 @@ using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Crypto.Signers; using Org.BouncyCastle.Math; using Org.BouncyCastle.Math.EC; -using Org.BouncyCastle.Utilities.Collections; using Org.BouncyCastle.Utilities.Encoders; using Org.BouncyCastle.Utilities.Test; @@ -269,7 +268,7 @@ namespace Org.BouncyCastle.X509.Tests cert.CheckValidity(); cert.Verify(ecPub); - ISet extOidSet = cert.GetCriticalExtensionOids(); + var extOidSet = cert.GetCriticalExtensionOids(); if (extOidSet.Count != 1) {