summary refs log tree commit diff
path: root/crypto/test
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-06-27 21:11:59 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-06-27 21:11:59 +0700
commit35cfd51633bbbbc92c2c17c76646e9a9dc945b11 (patch)
tree563cda15bf08c63de832198be2b9e0263bae5e60 /crypto/test
parentSplit up fast/slow tests (diff)
downloadBouncyCastle.NET-ed25519-35cfd51633bbbbc92c2c17c76646e9a9dc945b11.tar.xz
Generics migration in Asn1
Diffstat (limited to 'crypto/test')
-rw-r--r--crypto/test/src/asn1/test/AttributeTableUnitTest.cs2
-rw-r--r--crypto/test/src/asn1/test/ParseTest.cs2
-rw-r--r--crypto/test/src/asn1/test/X509NameTest.cs14
-rw-r--r--crypto/test/src/cmp/test/ProtectedMessageTest.cs7
-rw-r--r--crypto/test/src/cms/test/SignedDataStreamTest.cs5
-rw-r--r--crypto/test/src/pkcs/test/PKCS10Test.cs16
-rw-r--r--crypto/test/src/pkcs/test/PKCS12StoreTest.cs7
-rw-r--r--crypto/test/src/security/test/TestDotNetUtil.cs12
-rw-r--r--crypto/test/src/test/CertTest.cs20
-rw-r--r--crypto/test/src/test/PKCS10CertRequestTest.cs4
-rw-r--r--crypto/test/src/test/PkixPolicyMappingTest.cs22
-rw-r--r--crypto/test/src/tsp/test/NewTspTest.cs4
-rw-r--r--crypto/test/src/tsp/test/TSPTest.cs15
-rw-r--r--crypto/test/src/x509/test/TestCertificateGen.cs20
14 files changed, 72 insertions, 78 deletions
diff --git a/crypto/test/src/asn1/test/AttributeTableUnitTest.cs b/crypto/test/src/asn1/test/AttributeTableUnitTest.cs
index 4848c50fa..c6d69fa2b 100644
--- a/crypto/test/src/asn1/test/AttributeTableUnitTest.cs
+++ b/crypto/test/src/asn1/test/AttributeTableUnitTest.cs
@@ -74,7 +74,7 @@ namespace Org.BouncyCastle.Asn1.Tests
                 Fail("wrong vector size for single.");
             }
 
-            IDictionary t = table.ToDictionary();
+            var t = table.ToDictionary();
 
 			if (t.Count != 2)
             {
diff --git a/crypto/test/src/asn1/test/ParseTest.cs b/crypto/test/src/asn1/test/ParseTest.cs
index c649fdb8d..363e6d3d6 100644
--- a/crypto/test/src/asn1/test/ParseTest.cs
+++ b/crypto/test/src/asn1/test/ParseTest.cs
@@ -279,7 +279,7 @@ namespace Org.BouncyCastle.Asn1.Tests
 			Asn1StreamParser aIn = new Asn1StreamParser(longTagged);
 			Asn1TaggedObjectParser tagged = (Asn1TaggedObjectParser)aIn.ReadObject();
 
-			Assert.AreEqual(31, tagged.TagNo);
+            Assert.IsTrue(tagged.HasContextTag(31));
 		}
 
 		private void ParseEnveloped(
diff --git a/crypto/test/src/asn1/test/X509NameTest.cs b/crypto/test/src/asn1/test/X509NameTest.cs
index c6de1b1db..c344042a2 100644
--- a/crypto/test/src/asn1/test/X509NameTest.cs
+++ b/crypto/test/src/asn1/test/X509NameTest.cs
@@ -41,10 +41,10 @@ namespace Org.BouncyCastle.Asn1.Tests
             DerObjectIdentifier	oid,
             string				value)
         {
-            IDictionary attrs = new Hashtable();
+            var attrs = new Dictionary<DerObjectIdentifier, string>();
             attrs.Add(oid, value);
 
-            IList ord = new ArrayList();
+            var ord = new List<DerObjectIdentifier>();
             ord.Add(oid);
 
             X509Name name = new X509Name(ord, attrs);
@@ -60,10 +60,10 @@ namespace Org.BouncyCastle.Asn1.Tests
             DerObjectIdentifier	oid,
             string				val)
         {
-            IDictionary attrs = new Hashtable();
+            var attrs = new Dictionary<DerObjectIdentifier, string>();
             attrs.Add(oid, val);
 
-            IList ord = new ArrayList(attrs.Keys);
+            var ord = new List<DerObjectIdentifier>(attrs.Keys);
 
             X509Name name = new X509Name(new X509Name(ord, attrs).ToString());
 
@@ -127,14 +127,14 @@ namespace Org.BouncyCastle.Asn1.Tests
             //
             // composite
             //
-            IDictionary attrs = new Hashtable();
+            var attrs = new Dictionary<DerObjectIdentifier, string>();
             attrs.Add(X509Name.C, "AU");
             attrs.Add(X509Name.O, "The Legion of the Bouncy Castle");
             attrs.Add(X509Name.L, "Melbourne");
             attrs.Add(X509Name.ST, "Victoria");
             attrs.Add(X509Name.E, "feedback-crypto@bouncycastle.org");
 
-            IList order = new ArrayList();
+            var order = new List<DerObjectIdentifier>();
             order.Add(X509Name.C);
             order.Add(X509Name.O);
             order.Add(X509Name.L);
@@ -583,7 +583,7 @@ namespace Org.BouncyCastle.Asn1.Tests
                 Fail("Failed composite to string test got: " + n.ToString());
             }
 
-            IDictionary symbols = X509Name.DefaultSymbols;
+            var symbols = X509Name.DefaultSymbols;
             if (!n.ToString(true, symbols).Equals("L=Melbourne+OU=Ascot Vale,O=The Legion of the Bouncy Castle,C=AU"))
             {
                 Fail("Failed composite to string test got: " + n.ToString(true, symbols));
diff --git a/crypto/test/src/cmp/test/ProtectedMessageTest.cs b/crypto/test/src/cmp/test/ProtectedMessageTest.cs
index 1b7d84eea..98bae77ee 100644
--- a/crypto/test/src/cmp/test/ProtectedMessageTest.cs
+++ b/crypto/test/src/cmp/test/ProtectedMessageTest.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Collections;
+using System.Collections.Generic;
 
 using NUnit.Framework;
 
@@ -321,8 +322,8 @@ namespace Org.BouncyCastle.Cmp.Tests
 
     public class TestCertBuilder
     {
-        IDictionary attrs = new Hashtable();
-        IList ord = new ArrayList();
+        IDictionary<DerObjectIdentifier, string> attrs = new Dictionary<DerObjectIdentifier, string>();
+        IList<DerObjectIdentifier> ord = new List<DerObjectIdentifier>();
         IList values = new ArrayList();
 
         private DateTime notBefore, notAfter;
@@ -366,7 +367,7 @@ namespace Org.BouncyCastle.Cmp.Tests
             set { this.subject = value; }
         }
 
-        public TestCertBuilder AddAttribute(DerObjectIdentifier name, object value)
+        public TestCertBuilder AddAttribute(DerObjectIdentifier name, string value)
         {
             attrs[name] = value;
             ord.Add(name);
diff --git a/crypto/test/src/cms/test/SignedDataStreamTest.cs b/crypto/test/src/cms/test/SignedDataStreamTest.cs
index 4ef6d9441..15924cc47 100644
--- a/crypto/test/src/cms/test/SignedDataStreamTest.cs
+++ b/crypto/test/src/cms/test/SignedDataStreamTest.cs
@@ -576,10 +576,9 @@ namespace Org.BouncyCastle.Cms.Tests
 		private class SignedGenAttributeTableGenerator
 			: DefaultSignedAttributeTableGenerator
 		{
-			public override AttributeTable GetAttributes(
-				IDictionary parameters)
+			public override AttributeTable GetAttributes(IDictionary parameters)
 			{
-				IDictionary table = createStandardAttributeTable(parameters);
+				var table = CreateStandardAttributeTable(parameters);
 
 				DerOctetString val = new DerOctetString((byte[])parameters[CmsAttributeTableParameter.Digest]);
 				Asn1.Cms.Attribute attr = new Asn1.Cms.Attribute(dummyOid1, new DerSet(val));
diff --git a/crypto/test/src/pkcs/test/PKCS10Test.cs b/crypto/test/src/pkcs/test/PKCS10Test.cs
index 9629bdd81..39b33e1b5 100644
--- a/crypto/test/src/pkcs/test/PKCS10Test.cs
+++ b/crypto/test/src/pkcs/test/PKCS10Test.cs
@@ -1,8 +1,5 @@
-#region Using directives
-
-using System;
 using System.Collections;
-using System.Text;
+using System.Collections.Generic;
 
 using NUnit.Framework;
 
@@ -12,12 +9,9 @@ using Org.BouncyCastle.Asn1;
 using Org.BouncyCastle.Asn1.X509;
 using Org.BouncyCastle.Asn1.Pkcs;
 using Org.BouncyCastle.Crypto;
-using Org.BouncyCastle.Crypto.Generators;
 using Org.BouncyCastle.Utilities.Test;
 using Org.BouncyCastle.Security;
 
-#endregion
-
 namespace Org.BouncyCastle.Pkcs.Tests
 {
     [TestFixture]
@@ -42,14 +36,14 @@ namespace Org.BouncyCastle.Pkcs.Tests
 
             AsymmetricCipherKeyPair kp = kpg.GenerateKeyPair();
 
-            IDictionary attrs = new Hashtable();
+            var attrs = new Dictionary<DerObjectIdentifier, string>();
             attrs.Add(X509Name.C, "AU");
             attrs.Add(X509Name.O, "The Legion of the Bouncy Castle");
             attrs.Add(X509Name.L, "Melbourne");
             attrs.Add(X509Name.ST, "Victoria");
             attrs.Add(X509Name.EmailAddress, "feedback-crypto@bouncycastle.org");
 
-            IList order = new ArrayList();
+            var order = new List<DerObjectIdentifier>();
             order.Add(X509Name.C);
             order.Add(X509Name.O);
             order.Add(X509Name.L);
@@ -140,7 +134,7 @@ namespace Org.BouncyCastle.Pkcs.Tests
 
             AsymmetricCipherKeyPair pair = pGen.GenerateKeyPair();
 
-            IDictionary attrs = new Hashtable();
+            var attrs = new Dictionary<DerObjectIdentifier, string>();
 
             attrs.Add(X509Name.C, "AU");
             attrs.Add(X509Name.O, "The Legion of the Bouncy Castle");
@@ -148,7 +142,7 @@ namespace Org.BouncyCastle.Pkcs.Tests
             attrs.Add(X509Name.ST, "Victoria");
             attrs.Add(X509Name.EmailAddress, "feedback-crypto@bouncycastle.org");
 
-            X509Name subject = new X509Name(new ArrayList(attrs.Keys), attrs);
+            X509Name subject = new X509Name(new List<DerObjectIdentifier>(attrs.Keys), attrs);
 
             Pkcs10CertificationRequest req1 = new Pkcs10CertificationRequest(
 				"SHA1withRSA",
diff --git a/crypto/test/src/pkcs/test/PKCS12StoreTest.cs b/crypto/test/src/pkcs/test/PKCS12StoreTest.cs
index 91233db46..a500e5e63 100644
--- a/crypto/test/src/pkcs/test/PKCS12StoreTest.cs
+++ b/crypto/test/src/pkcs/test/PKCS12StoreTest.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Collections;
+using System.Collections.Generic;
 using System.IO;
 
 using NUnit.Framework;
@@ -861,21 +862,21 @@ namespace Org.BouncyCastle.Pkcs.Tests
 			//
 			// distinguished name table.
 			//
-            IDictionary issuerAttrs = new Hashtable();
+            var issuerAttrs = new Dictionary<DerObjectIdentifier, string>();
 			issuerAttrs.Add(X509Name.C, "AU");
 			issuerAttrs.Add(X509Name.O, "The Legion of the Bouncy Castle");
 			issuerAttrs.Add(X509Name.L, "Melbourne");
 			issuerAttrs.Add(X509Name.ST, "Victoria");
 			issuerAttrs.Add(X509Name.EmailAddress, issuerEmail);
 
-			IDictionary subjectAttrs = new Hashtable();
+			var subjectAttrs = new Dictionary<DerObjectIdentifier, string>();
 			subjectAttrs.Add(X509Name.C, "AU");
 			subjectAttrs.Add(X509Name.O, "The Legion of the Bouncy Castle");
 			subjectAttrs.Add(X509Name.L, "Melbourne");
 			subjectAttrs.Add(X509Name.ST, "Victoria");
 			subjectAttrs.Add(X509Name.EmailAddress, subjectEmail);
 
-			IList order = new ArrayList();
+			var order = new List<DerObjectIdentifier>();
 			order.Add(X509Name.C);
 			order.Add(X509Name.O);
 			order.Add(X509Name.L);
diff --git a/crypto/test/src/security/test/TestDotNetUtil.cs b/crypto/test/src/security/test/TestDotNetUtil.cs
index 899af016c..e2bb783ef 100644
--- a/crypto/test/src/security/test/TestDotNetUtil.cs
+++ b/crypto/test/src/security/test/TestDotNetUtil.cs
@@ -1,12 +1,12 @@
-#if !PORTABLE
-
 using System;
+using System.Collections;
+using System.Collections.Generic;
 using System.Security.Cryptography;
 using SystemX509 = System.Security.Cryptography.X509Certificates;
-using System.Collections;
 
 using NUnit.Framework;
 
+using Org.BouncyCastle.Asn1;
 using Org.BouncyCastle.Asn1.X509;
 using Org.BouncyCastle.Crypto;
 using Org.BouncyCastle.Crypto.Operators;
@@ -49,14 +49,14 @@ namespace Org.BouncyCastle.Security.Tests
 			DsaPrivateKeyParameters dsaPriv = new DsaPrivateKeyParameters(DsaPrivateX, para);
 			DsaPublicKeyParameters dsaPub = new DsaPublicKeyParameters(DSAPublicY, para);
 
-			IDictionary attrs = new Hashtable();
+			var attrs = new Dictionary<DerObjectIdentifier, string>();
 			attrs[X509Name.C] = "AU";
 			attrs[X509Name.O] = "The Legion of the Bouncy Castle";
 			attrs[X509Name.L] = "Melbourne";
 			attrs[X509Name.ST] = "Victoria";
 			attrs[X509Name.E] = "feedback-crypto@bouncycastle.org";
 
-			IList ord = new ArrayList(attrs.Keys);
+			var ord = new List<DerObjectIdentifier>(attrs.Keys);
 
 			X509V3CertificateGenerator certGen = new X509V3CertificateGenerator();
 
@@ -84,5 +84,3 @@ namespace Org.BouncyCastle.Security.Tests
 		}
 	}
 }
-
-#endif
diff --git a/crypto/test/src/test/CertTest.cs b/crypto/test/src/test/CertTest.cs
index 0e1cf1d70..964b1a6bd 100644
--- a/crypto/test/src/test/CertTest.cs
+++ b/crypto/test/src/test/CertTest.cs
@@ -1144,7 +1144,7 @@ namespace Org.BouncyCastle.Tests
             ord.Add(X509Name.ST);
             ord.Add(X509Name.E);
 
-            IList values = new ArrayList();
+            var values = new List<string>();
             values.Add("AU");
             values.Add("The Legion of the Bouncy Castle");
             values.Add("Melbourne");
@@ -1298,7 +1298,7 @@ namespace Org.BouncyCastle.Tests
             ord.Add(X509Name.ST);
             ord.Add(X509Name.E);
 
-            IList values = new ArrayList();
+            var values = new List<string>();
             values.Add("AU");
             values.Add("The Legion of the Bouncy Castle");
             values.Add("Melbourne");
@@ -1423,8 +1423,8 @@ namespace Org.BouncyCastle.Tests
             //
             // distinguished name table.
             //
-            IDictionary attrs = new Hashtable();
-            IList order = new ArrayList();
+            var attrs = new Dictionary<DerObjectIdentifier, string>();
+            var order = new List<DerObjectIdentifier>();
 
             attrs.Add(X509Name.C, "AU");
             attrs.Add(X509Name.O, "The Legion of the Bouncy Castle");
@@ -1552,8 +1552,8 @@ namespace Org.BouncyCastle.Tests
             //
             // distinguished name table.
             //
-            IDictionary attrs = new Hashtable();
-            IList order = new ArrayList();
+            var attrs = new Dictionary<DerObjectIdentifier, string>();
+            var order = new List<DerObjectIdentifier>();
 
             attrs.Add(X509Name.C, "AU");
             attrs.Add(X509Name.O, "The Legion of the Bouncy Castle");
@@ -2001,14 +2001,14 @@ namespace Org.BouncyCastle.Tests
             //
             // distinguished name table.
             //
-            IDictionary attrs = new Hashtable();
+            var attrs = new Dictionary<DerObjectIdentifier, string>();
             attrs.Add(X509Name.C, "AU");
             attrs.Add(X509Name.O, "The Legion of the Bouncy Castle");
             attrs.Add(X509Name.L, "Melbourne");
             attrs.Add(X509Name.ST, "Victoria");
             attrs.Add(X509Name.E, "feedback-crypto@bouncycastle.org");
 
-            IList order = new ArrayList();
+            var order = new List<DerObjectIdentifier>();
             order.Add(X509Name.C);
             order.Add(X509Name.O);
             order.Add(X509Name.L);
@@ -2095,7 +2095,7 @@ namespace Org.BouncyCastle.Tests
             ord.Add(X509Name.ST);
             ord.Add(X509Name.E);
 
-            IList values = new ArrayList();
+            var values = new List<string>();
             values.Add("AU");
             values.Add("The Legion of the Bouncy Castle");
             values.Add("Melbourne");
@@ -2355,7 +2355,7 @@ namespace Org.BouncyCastle.Tests
             ord.Add(X509Name.ST);
             ord.Add(X509Name.E);
 
-            IList values = new ArrayList();
+            var values = new List<string>();
             values.Add("AU");
             values.Add("The Legion of the Bouncy Castle");
             values.Add("Melbourne");
diff --git a/crypto/test/src/test/PKCS10CertRequestTest.cs b/crypto/test/src/test/PKCS10CertRequestTest.cs
index 94a53f9cf..fb913d7de 100644
--- a/crypto/test/src/test/PKCS10CertRequestTest.cs
+++ b/crypto/test/src/test/PKCS10CertRequestTest.cs
@@ -81,14 +81,14 @@ namespace Org.BouncyCastle.Tests
 
             AsymmetricCipherKeyPair kp = kpg.GenerateKeyPair();
 
-            IDictionary attrs = new Hashtable();
+            var attrs = new Dictionary<DerObjectIdentifier, string>();
             attrs.Add(X509Name.C, "AU");
             attrs.Add(X509Name.O, "The Legion of the Bouncy Castle");
             attrs.Add(X509Name.L, "Melbourne");
             attrs.Add(X509Name.ST, "Victoria");
             attrs.Add(X509Name.EmailAddress, "feedback-crypto@bouncycastle.org");
 
-            IList order = new ArrayList();
+            var order = new List<DerObjectIdentifier>();
             order.Add(X509Name.C);
             order.Add(X509Name.O);
             order.Add(X509Name.L);
diff --git a/crypto/test/src/test/PkixPolicyMappingTest.cs b/crypto/test/src/test/PkixPolicyMappingTest.cs
index 097826907..5ca33bf6a 100644
--- a/crypto/test/src/test/PkixPolicyMappingTest.cs
+++ b/crypto/test/src/test/PkixPolicyMappingTest.cs
@@ -54,7 +54,7 @@ namespace Org.BouncyCastle.Tests
 			AsymmetricKeyParameter caPrivKey,
 			AsymmetricKeyParameter caPubKey,
 			Asn1EncodableVector policies,
-			Hashtable policyMap)
+			IDictionary<string, string> policyMap)
 		{
 			string issuer = "C=JP, O=policyMappingAdditionalTest, OU=trustAnchor";
 			string subject = "C=JP, O=policyMappingAdditionalTest, OU=intmedCA";
@@ -232,7 +232,7 @@ namespace Org.BouncyCastle.Tests
 
 			X509Certificate trustCert = CreateTrustCert(caPubKey, caPrivKeySpec);
 			Asn1EncodableVector intPolicies = null;
-			Hashtable map = null;
+			IDictionary<string, string> map = null;
 			Asn1EncodableVector policies = null;
 			ISet<string> requirePolicies = null;
 			X509Certificate intCert = null;
@@ -241,7 +241,7 @@ namespace Org.BouncyCastle.Tests
 			// valid test_00
 			intPolicies = new Asn1EncodableVector();
 			intPolicies.Add(new PolicyInformation(new DerObjectIdentifier("2.5.29.32.0")));
-			map = new Hashtable();
+			map = new Dictionary<string, string>();
 			map["2.16.840.1.101.3.2.1.48.1"] = "2.16.840.1.101.3.2.1.48.2";
 			intCert = CreateIntmedCert(intPubKey, caPrivKey, caPubKey, intPolicies, map);
 
@@ -256,7 +256,7 @@ namespace Org.BouncyCastle.Tests
 			// test_01
 			intPolicies = new Asn1EncodableVector();
 			intPolicies.Add(new PolicyInformation(new DerObjectIdentifier("2.5.29.32.0")));
-			map = new Hashtable();
+			map = new Dictionary<string, string>();
 			map["2.16.840.1.101.3.2.1.48.1"] = "2.16.840.1.101.3.2.1.48.2";
 			intCert = CreateIntmedCert(intPubKey, caPrivKey, caPubKey, intPolicies, map);
 
@@ -272,7 +272,7 @@ namespace Org.BouncyCastle.Tests
 			// test_02
 			intPolicies = new Asn1EncodableVector();
 			intPolicies.Add(new PolicyInformation(new DerObjectIdentifier("2.5.29.32.0")));
-			map = new Hashtable();
+			map = new Dictionary<string, string>();
 			map["2.16.840.1.101.3.2.1.48.1"] = "2.16.840.1.101.3.2.1.48.2";
 			intCert = CreateIntmedCert(intPubKey, caPrivKey, caPubKey, intPolicies, map);
 
@@ -289,7 +289,7 @@ namespace Org.BouncyCastle.Tests
 			intPolicies = new Asn1EncodableVector();
 			intPolicies.Add(new PolicyInformation(new DerObjectIdentifier("2.16.840.1.101.3.2.1.48.3")));
 			intPolicies.Add(new PolicyInformation(new DerObjectIdentifier("2.5.29.32.0")));
-			map = new Hashtable();
+			map = new Dictionary<string, string>();
 			map["2.16.840.1.101.3.2.1.48.1"] = "2.16.840.1.101.3.2.1.48.2";
 			intCert = CreateIntmedCert(intPubKey, caPrivKey, caPubKey, intPolicies, map);
 
@@ -306,7 +306,7 @@ namespace Org.BouncyCastle.Tests
 			intPolicies = new Asn1EncodableVector();
 			intPolicies.Add(new PolicyInformation(new DerObjectIdentifier("2.16.840.1.101.3.2.1.48.3")));
 			intPolicies.Add(new PolicyInformation(new DerObjectIdentifier("2.5.29.32.0")));
-			map = new Hashtable();
+			map = new Dictionary<string, string>();
 			map["2.16.840.1.101.3.2.1.48.1"] = "2.16.840.1.101.3.2.1.48.2";
 			intCert = CreateIntmedCert(intPubKey, caPrivKey, caPubKey, intPolicies, map);
 
@@ -322,7 +322,7 @@ namespace Org.BouncyCastle.Tests
 			// test_05
 			intPolicies = new Asn1EncodableVector();
 			intPolicies.Add(new PolicyInformation(new DerObjectIdentifier("2.5.29.32.0")));
-			map = new Hashtable();
+			map = new Dictionary<string, string>();
 			map["2.16.840.1.101.3.2.1.48.1"] = "2.16.840.1.101.3.2.1.48.2";
 			intCert = CreateIntmedCert(intPubKey, caPrivKey, caPubKey, intPolicies, map);
 
@@ -338,7 +338,7 @@ namespace Org.BouncyCastle.Tests
 			// test_06
 			intPolicies = new Asn1EncodableVector();
 			intPolicies.Add(new PolicyInformation(new DerObjectIdentifier("2.5.29.32.0")));
-			map = new Hashtable();
+			map = new Dictionary<string, string>();
 			map["2.16.840.1.101.3.2.1.48.1"] = "2.16.840.1.101.3.2.1.48.2";
 			intCert = CreateIntmedCert(intPubKey, caPrivKey, caPubKey, intPolicies, map);
 
@@ -354,7 +354,7 @@ namespace Org.BouncyCastle.Tests
 			// test_07
 			intPolicies = new Asn1EncodableVector();
 			intPolicies.Add(new PolicyInformation(new DerObjectIdentifier("2.5.29.32.0")));
-			map = new Hashtable();
+			map = new Dictionary<string, string>();
 			map["2.16.840.1.101.3.2.1.48.1"] = "2.16.840.1.101.3.2.1.48.2";
 			intCert = CreateIntmedCert(intPubKey, caPrivKey, caPubKey, intPolicies, map);
 
@@ -370,7 +370,7 @@ namespace Org.BouncyCastle.Tests
 			// test_08
 			intPolicies = new Asn1EncodableVector();
 			intPolicies.Add(new PolicyInformation(new DerObjectIdentifier("2.5.29.32.0")));
-			map = new Hashtable();
+			map = new Dictionary<string, string>();
 			map["2.16.840.1.101.3.2.1.48.1"] = "2.16.840.1.101.3.2.1.48.2";
 			intCert = CreateIntmedCert(intPubKey, caPrivKey, caPubKey, intPolicies, map);
 
diff --git a/crypto/test/src/tsp/test/NewTspTest.cs b/crypto/test/src/tsp/test/NewTspTest.cs
index 3bcc73aa5..34be0dadf 100644
--- a/crypto/test/src/tsp/test/NewTspTest.cs
+++ b/crypto/test/src/tsp/test/NewTspTest.cs
@@ -869,14 +869,14 @@ namespace Org.BouncyCastle.Tsp.Tests
 			//
 			// Add the ESSCertID attribute
 			//
-			IDictionary signedAttrs;
+			IDictionary<DerObjectIdentifier, object> signedAttrs;
 			if (signedAttr != null)
 			{
 				signedAttrs = signedAttr.ToDictionary();
 			}
 			else
 			{
-				signedAttrs = new Hashtable();
+				signedAttrs = new Dictionary<DerObjectIdentifier, object>();
 			}
 
             string digestName = TspTestUtil.GetDigestAlgName(digestOID);
diff --git a/crypto/test/src/tsp/test/TSPTest.cs b/crypto/test/src/tsp/test/TSPTest.cs
index 3f2eed10b..06c20e4bd 100644
--- a/crypto/test/src/tsp/test/TSPTest.cs
+++ b/crypto/test/src/tsp/test/TSPTest.cs
@@ -649,21 +649,21 @@ namespace Org.BouncyCastle.Tsp.Tests
 		}
 
         internal static SignerInfoGenerator MakeInfoGenerator(AsymmetricKeyParameter key, X509Certificate cert,
-			string digestOID, Asn1.Cms.AttributeTable signedAttr, Asn1.Cms.AttributeTable unsignedAttr)
+			string digestOID, AttributeTable signedAttr, AttributeTable unsignedAttr)
         {
             TspUtil.ValidateCertificate(cert);
 
 			//
 			// Add the ESSCertID attribute
 			//
-			IDictionary signedAttrs;
+			IDictionary<DerObjectIdentifier, object> signedAttrs;
 			if (signedAttr != null)
 			{
 				signedAttrs = signedAttr.ToDictionary();
 			}
 			else
 			{
-				signedAttrs = new Hashtable();
+				signedAttrs = new Dictionary<DerObjectIdentifier, object>();
 			}
 
 			string digestName = TspTestUtil.GetDigestAlgName(digestOID);
@@ -672,11 +672,10 @@ namespace Org.BouncyCastle.Tsp.Tests
 
 			Asn1SignatureFactory sigfact = new Asn1SignatureFactory(signatureName, key);
 			return new SignerInfoGeneratorBuilder()
-			 .WithSignedAttributeGenerator(
-				new DefaultSignedAttributeTableGenerator(
-					new Asn1.Cms.AttributeTable(signedAttrs)))
-			  .WithUnsignedAttributeGenerator(
-				new SimpleAttributeTableGenerator(unsignedAttr))
+				.WithSignedAttributeGenerator(
+					new DefaultSignedAttributeTableGenerator(new AttributeTable(signedAttrs)))
+				.WithUnsignedAttributeGenerator(
+					new SimpleAttributeTableGenerator(unsignedAttr))
 				.Build(sigfact, cert);
 		}
 	}
diff --git a/crypto/test/src/x509/test/TestCertificateGen.cs b/crypto/test/src/x509/test/TestCertificateGen.cs
index a4c548021..d1ac173bc 100644
--- a/crypto/test/src/x509/test/TestCertificateGen.cs
+++ b/crypto/test/src/x509/test/TestCertificateGen.cs
@@ -1,8 +1,10 @@
 using System;
 using System.Collections;
+using System.Collections.Generic;
 
 using NUnit.Framework;
 
+using Org.BouncyCastle.Asn1;
 using Org.BouncyCastle.Asn1.X509;
 using Org.BouncyCastle.Asn1.X9;
 using Org.BouncyCastle.Crypto.Digests;
@@ -73,21 +75,21 @@ namespace Org.BouncyCastle.X509.Tests
             RsaKeyParameters rsaPublic = new RsaKeyParameters(false, rsaPubMod, rsaPubExp);
 			RsaPrivateCrtKeyParameters rsaPrivate = new RsaPrivateCrtKeyParameters(rsaPrivMod, rsaPubExp, rsaPrivExp, rsaPrivP, rsaPrivQ, rsaPrivDP, rsaPrivDQ, rsaPrivQinv);
 
-			IDictionary attrs = new Hashtable();
+			var attrs = new Dictionary<DerObjectIdentifier, string>();
             attrs[X509Name.C] = "AU";
             attrs[X509Name.O] = "The Legion of the Bouncy Castle";
             attrs[X509Name.L] = "Melbourne";
             attrs[X509Name.ST] = "Victoria";
             attrs[X509Name.E] = "feedback-crypto@bouncycastle.org";
 
-            IList ord = new ArrayList();
+            var ord = new List<DerObjectIdentifier>();
             ord.Add(X509Name.C);
             ord.Add(X509Name.O);
             ord.Add(X509Name.L);
             ord.Add(X509Name.ST);
             ord.Add(X509Name.E);
 
-			IList values = new ArrayList();
+			var values = new List<string>();
 			values.Add("AU");
             values.Add("The Legion of the Bouncy Castle");
             values.Add("Melbourne");
@@ -149,21 +151,21 @@ namespace Org.BouncyCastle.X509.Tests
             DsaPrivateKeyParameters dsaPriv = new DsaPrivateKeyParameters(DsaPrivateX, para);
             DsaPublicKeyParameters dsaPub = new DsaPublicKeyParameters(DSAPublicY, para);
 
-            IDictionary attrs = new Hashtable();
+            var attrs = new Dictionary<DerObjectIdentifier, string>();
             attrs[X509Name.C] = "AU";
             attrs[X509Name.O] = "The Legion of the Bouncy Castle";
             attrs[X509Name.L] = "Melbourne";
             attrs[X509Name.ST] = "Victoria";
             attrs[X509Name.E] = "feedback-crypto@bouncycastle.org";
 
-            IList ord = new ArrayList();
+            var ord = new List<DerObjectIdentifier>();
             ord.Add(X509Name.C);
             ord.Add(X509Name.O);
             ord.Add(X509Name.L);
             ord.Add(X509Name.ST);
             ord.Add(X509Name.E);
 
-            IList values = new ArrayList();
+            var values = new List<string>();
 			values.Add("AU");
             values.Add("The Legion of the Bouncy Castle");
             values.Add("Melbourne");
@@ -229,21 +231,21 @@ namespace Org.BouncyCastle.X509.Tests
                 curve.ValidatePoint(ECPubQX, ECPubQY), ecDomain);
             ECPrivateKeyParameters ecPriv = new ECPrivateKeyParameters("ECDSA", ECPrivD, ecDomain);
 
-            IDictionary attrs = new Hashtable();
+            var attrs = new Dictionary<DerObjectIdentifier, string>();
 			attrs[X509Name.C] = "AU";
             attrs[X509Name.O] = "The Legion of the Bouncy Castle";
             attrs[X509Name.L] = "Melbourne";
             attrs[X509Name.ST] = "Victoria";
             attrs[X509Name.E] = "feedback-crypto@bouncycastle.org";
 
-            IList ord = new ArrayList();
+            var ord = new List<DerObjectIdentifier>();
             ord.Add(X509Name.C);
             ord.Add(X509Name.O);
             ord.Add(X509Name.L);
             ord.Add(X509Name.ST);
             ord.Add(X509Name.E);
 
-			IList values = new ArrayList();
+			var values = new List<string>();
 			values.Add("AU");
             values.Add("The Legion of the Bouncy Castle");
             values.Add("Melbourne");