summary refs log tree commit diff
path: root/crypto/src/asn1/x509
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/x509')
-rw-r--r--crypto/src/asn1/x509/AttributeTable.cs39
-rw-r--r--crypto/src/asn1/x509/AuthorityInformationAccess.cs2
-rw-r--r--crypto/src/asn1/x509/AuthorityKeyIdentifier.cs2
-rw-r--r--crypto/src/asn1/x509/CertificateList.cs6
-rw-r--r--crypto/src/asn1/x509/DSAParameter.cs1
-rw-r--r--crypto/src/asn1/x509/DigestInfo.cs1
-rw-r--r--crypto/src/asn1/x509/ExtendedKeyUsage.cs30
-rw-r--r--crypto/src/asn1/x509/GeneralName.cs7
-rw-r--r--crypto/src/asn1/x509/IetfAttrSyntax.cs3
-rw-r--r--crypto/src/asn1/x509/NameConstraints.cs20
-rw-r--r--crypto/src/asn1/x509/NoticeReference.cs6
-rw-r--r--crypto/src/asn1/x509/PolicyMappings.cs18
-rw-r--r--crypto/src/asn1/x509/RSAPublicKeyStructure.cs2
-rw-r--r--crypto/src/asn1/x509/SubjectDirectoryAttributes.cs26
-rw-r--r--crypto/src/asn1/x509/SubjectPublicKeyInfo.cs1
-rw-r--r--crypto/src/asn1/x509/TBSCertList.cs46
-rw-r--r--crypto/src/asn1/x509/X509ExtensionsGenerator.cs19
-rw-r--r--crypto/src/asn1/x509/X509Name.cs215
-rw-r--r--crypto/src/asn1/x509/qualified/MonetaryValue.cs1
-rw-r--r--crypto/src/asn1/x509/qualified/SemanticsInformation.cs28
-rw-r--r--crypto/src/asn1/x509/sigi/NameOrPseudonym.cs1
-rw-r--r--crypto/src/asn1/x509/sigi/PersonalData.cs40
22 files changed, 202 insertions, 312 deletions
diff --git a/crypto/src/asn1/x509/AttributeTable.cs b/crypto/src/asn1/x509/AttributeTable.cs
index 71c42872e..eeee88fd7 100644
--- a/crypto/src/asn1/x509/AttributeTable.cs
+++ b/crypto/src/asn1/x509/AttributeTable.cs
@@ -1,55 +1,50 @@
-using System;
-using System.Collections;
+using System.Collections.Generic;
 
-using Org.BouncyCastle.Utilities;
+using Org.BouncyCastle.Utilities.Collections;
 
 namespace Org.BouncyCastle.Asn1.X509
 {
     public class AttributeTable
     {
-        private readonly IDictionary attributes;
+        private readonly IDictionary<DerObjectIdentifier, AttributeX509> m_attributes;
 
-        public AttributeTable(
-            IDictionary attrs)
+        public AttributeTable(IDictionary<DerObjectIdentifier, AttributeX509> attrs)
         {
-            this.attributes = Platform.CreateHashtable(attrs);
+            m_attributes = new Dictionary<DerObjectIdentifier, AttributeX509>(attrs);
         }
 
-		public AttributeTable(
-            Asn1EncodableVector v)
+		public AttributeTable(Asn1EncodableVector v)
         {
-            this.attributes = Platform.CreateHashtable(v.Count);
+            m_attributes = new Dictionary<DerObjectIdentifier, AttributeX509>(v.Count);
 
-			for (int i = 0; i != v.Count; i++)
+            for (int i = 0; i != v.Count; i++)
             {
                 AttributeX509 a = AttributeX509.GetInstance(v[i]);
 
-				attributes.Add(a.AttrType, a);
+				m_attributes.Add(a.AttrType, a);
             }
         }
 
-		public AttributeTable(
-            Asn1Set s)
+		public AttributeTable(Asn1Set s)
         {
-            this.attributes = Platform.CreateHashtable(s.Count);
+            m_attributes = new Dictionary<DerObjectIdentifier, AttributeX509>(s.Count);
 
-			for (int i = 0; i != s.Count; i++)
+            for (int i = 0; i != s.Count; i++)
             {
                 AttributeX509 a = AttributeX509.GetInstance(s[i]);
 
-				attributes.Add(a.AttrType, a);
+				m_attributes.Add(a.AttrType, a);
             }
         }
 
-		public AttributeX509 Get(
-            DerObjectIdentifier oid)
+		public AttributeX509 Get(DerObjectIdentifier oid)
         {
-            return (AttributeX509) attributes[oid];
+            return CollectionUtilities.GetValueOrNull(m_attributes, oid);
         }
 
-        public IDictionary ToDictionary()
+        public IDictionary<DerObjectIdentifier, AttributeX509> ToDictionary()
         {
-            return Platform.CreateHashtable(attributes);
+            return new Dictionary<DerObjectIdentifier, AttributeX509>(m_attributes);
         }
     }
 }
diff --git a/crypto/src/asn1/x509/AuthorityInformationAccess.cs b/crypto/src/asn1/x509/AuthorityInformationAccess.cs
index f4b694cf0..57868baea 100644
--- a/crypto/src/asn1/x509/AuthorityInformationAccess.cs
+++ b/crypto/src/asn1/x509/AuthorityInformationAccess.cs
@@ -1,8 +1,6 @@
 using System;
-using System.Collections;
 using System.Text;
 
-using Org.BouncyCastle.Asn1;
 using Org.BouncyCastle.Utilities;
 
 namespace Org.BouncyCastle.Asn1.X509
diff --git a/crypto/src/asn1/x509/AuthorityKeyIdentifier.cs b/crypto/src/asn1/x509/AuthorityKeyIdentifier.cs
index e7f12016a..64cfce214 100644
--- a/crypto/src/asn1/x509/AuthorityKeyIdentifier.cs
+++ b/crypto/src/asn1/x509/AuthorityKeyIdentifier.cs
@@ -1,10 +1,8 @@
 using System;
-using System.Collections;
 
 using Org.BouncyCastle.Crypto;
 using Org.BouncyCastle.Crypto.Digests;
 using Org.BouncyCastle.Math;
-using Org.BouncyCastle.Utilities;
 using Org.BouncyCastle.Utilities.Encoders;
 
 namespace Org.BouncyCastle.Asn1.X509
diff --git a/crypto/src/asn1/x509/CertificateList.cs b/crypto/src/asn1/x509/CertificateList.cs
index 567cf132a..3d5d2e557 100644
--- a/crypto/src/asn1/x509/CertificateList.cs
+++ b/crypto/src/asn1/x509/CertificateList.cs
@@ -1,7 +1,5 @@
 using System;
-using System.Collections;
-
-using Org.BouncyCastle.Asn1;
+using System.Collections.Generic;
 
 namespace Org.BouncyCastle.Asn1.X509
 {
@@ -65,7 +63,7 @@ namespace Org.BouncyCastle.Asn1.X509
             return tbsCertList.GetRevokedCertificates();
         }
 
-		public IEnumerable GetRevokedCertificateEnumeration()
+		public IEnumerable<CrlEntry> GetRevokedCertificateEnumeration()
 		{
 			return tbsCertList.GetRevokedCertificateEnumeration();
 		}
diff --git a/crypto/src/asn1/x509/DSAParameter.cs b/crypto/src/asn1/x509/DSAParameter.cs
index 2eb65024b..166ed9d08 100644
--- a/crypto/src/asn1/x509/DSAParameter.cs
+++ b/crypto/src/asn1/x509/DSAParameter.cs
@@ -1,5 +1,4 @@
 using System;
-using System.Collections;
 
 using Org.BouncyCastle.Math;
 using Org.BouncyCastle.Utilities;
diff --git a/crypto/src/asn1/x509/DigestInfo.cs b/crypto/src/asn1/x509/DigestInfo.cs
index 3ac535e2e..d9fceda32 100644
--- a/crypto/src/asn1/x509/DigestInfo.cs
+++ b/crypto/src/asn1/x509/DigestInfo.cs
@@ -1,5 +1,4 @@
 using System;
-using System.Collections;
 
 using Org.BouncyCastle.Utilities;
 
diff --git a/crypto/src/asn1/x509/ExtendedKeyUsage.cs b/crypto/src/asn1/x509/ExtendedKeyUsage.cs
index 1e7d4d642..f812c308d 100644
--- a/crypto/src/asn1/x509/ExtendedKeyUsage.cs
+++ b/crypto/src/asn1/x509/ExtendedKeyUsage.cs
@@ -1,5 +1,5 @@
 using System;
-using System.Collections;
+using System.Collections.Generic;
 
 using Org.BouncyCastle.Utilities;
 
@@ -38,11 +38,10 @@ namespace Org.BouncyCastle.Asn1.X509
             return GetInstance(X509Extensions.GetExtensionParsedValue(extensions, X509Extensions.ExtendedKeyUsage));
         }
 
-        internal readonly IDictionary usageTable = Platform.CreateHashtable();
+        internal readonly ISet<DerObjectIdentifier> m_usageTable = new HashSet<DerObjectIdentifier>();
         internal readonly Asn1Sequence seq;
 
-        private ExtendedKeyUsage(
-            Asn1Sequence seq)
+        private ExtendedKeyUsage(Asn1Sequence seq)
         {
             this.seq = seq;
 
@@ -50,23 +49,21 @@ namespace Org.BouncyCastle.Asn1.X509
             {
                 DerObjectIdentifier oid = DerObjectIdentifier.GetInstance(element);
 
-                this.usageTable[oid] = oid;
+                m_usageTable.Add(oid);
             }
         }
 
-        public ExtendedKeyUsage(
-            params KeyPurposeID[] usages)
+        public ExtendedKeyUsage(params KeyPurposeID[] usages)
         {
             this.seq = new DerSequence(usages);
 
             foreach (KeyPurposeID usage in usages)
             {
-                this.usageTable[usage] = usage;
+                m_usageTable.Add(usage);
             }
         }
 
-        public ExtendedKeyUsage(
-            IEnumerable usages)
+        public ExtendedKeyUsage(IEnumerable<DerObjectIdentifier> usages)
         {
             Asn1EncodableVector v = new Asn1EncodableVector();
 
@@ -75,16 +72,15 @@ namespace Org.BouncyCastle.Asn1.X509
                 DerObjectIdentifier oid = DerObjectIdentifier.GetInstance(usage);
 
                 v.Add(oid);
-                this.usageTable[oid] = oid;
+                m_usageTable.Add(oid);
             }
 
             this.seq = new DerSequence(v);
         }
 
-        public bool HasKeyPurposeId(
-            KeyPurposeID keyPurposeId)
+        public bool HasKeyPurposeId(KeyPurposeID keyPurposeId)
         {
-            return usageTable.Contains(keyPurposeId);
+            return m_usageTable.Contains(keyPurposeId);
         }
 
         /**
@@ -92,14 +88,14 @@ namespace Org.BouncyCastle.Asn1.X509
          * The returned ArrayList contains DerObjectIdentifier instances.
          * @return An ArrayList with all key purposes.
          */
-        public IList GetAllUsages()
+        public IList<DerObjectIdentifier> GetAllUsages()
         {
-            return Platform.CreateArrayList(usageTable.Values);
+            return new List<DerObjectIdentifier>(m_usageTable);
         }
 
         public int Count
         {
-            get { return usageTable.Count; }
+            get { return m_usageTable.Count; }
         }
 
         public override Asn1Object ToAsn1Object()
diff --git a/crypto/src/asn1/x509/GeneralName.cs b/crypto/src/asn1/x509/GeneralName.cs
index 7b65e3239..c6c6e509e 100644
--- a/crypto/src/asn1/x509/GeneralName.cs
+++ b/crypto/src/asn1/x509/GeneralName.cs
@@ -1,5 +1,5 @@
 using System;
-using System.Collections;
+using System.Collections.Generic;
 using System.Globalization;
 using System.IO;
 using System.Text;
@@ -367,7 +367,8 @@ namespace Org.BouncyCastle.Asn1.X509
 				ip = ip.Substring(0, ip.Length - 1);
 			}
 
-			IEnumerator sEnum = ip.Split(':').GetEnumerator();
+			IEnumerable<string> split = ip.Split(':');
+			var sEnum = split.GetEnumerator();
 
 			int index = 0;
 			int[] val = new int[8];
@@ -376,7 +377,7 @@ namespace Org.BouncyCastle.Asn1.X509
 
 			while (sEnum.MoveNext())
 			{
-				string e = (string) sEnum.Current;
+				string e = sEnum.Current;
 
 				if (e.Length == 0)
 				{
diff --git a/crypto/src/asn1/x509/IetfAttrSyntax.cs b/crypto/src/asn1/x509/IetfAttrSyntax.cs
index 05313b1af..61fe78561 100644
--- a/crypto/src/asn1/x509/IetfAttrSyntax.cs
+++ b/crypto/src/asn1/x509/IetfAttrSyntax.cs
@@ -1,7 +1,4 @@
 using System;
-using System.Collections;
-
-using Org.BouncyCastle.Asn1;
 
 namespace Org.BouncyCastle.Asn1.X509
 {
diff --git a/crypto/src/asn1/x509/NameConstraints.cs b/crypto/src/asn1/x509/NameConstraints.cs
index 40178c126..9fe4fdd01 100644
--- a/crypto/src/asn1/x509/NameConstraints.cs
+++ b/crypto/src/asn1/x509/NameConstraints.cs
@@ -1,5 +1,5 @@
 using System;
-using System.Collections;
+using System.Collections.Generic;
 
 using Org.BouncyCastle.Utilities;
 
@@ -43,15 +43,6 @@ namespace Org.BouncyCastle.Asn1.X509
 			}
 		}
 
-#if !PORTABLE
-        public NameConstraints(
-            ArrayList permitted,
-            ArrayList excluded)
-            : this((IList)permitted, (IList)excluded)
-        {
-        }
-#endif
-
         /**
 		 * Constructor from a given details.
 		 *
@@ -61,8 +52,8 @@ namespace Org.BouncyCastle.Asn1.X509
 		 * @param excluded Excluded subtrees
 		 */
 		public NameConstraints(
-			IList   permitted,
-			IList   excluded)
+			IList<GeneralSubtree> permitted,
+			IList<GeneralSubtree> excluded)
 		{
 			if (permitted != null)
 			{
@@ -75,13 +66,12 @@ namespace Org.BouncyCastle.Asn1.X509
 			}
 		}
 
-		private DerSequence CreateSequence(
-			IList subtrees)
+		private DerSequence CreateSequence(IList<GeneralSubtree> subtrees)
 		{
             GeneralSubtree[] gsts = new GeneralSubtree[subtrees.Count];
             for (int i = 0; i < subtrees.Count; ++i)
             {
-                gsts[i] = (GeneralSubtree)subtrees[i];
+                gsts[i] = subtrees[i];
             }
             return new DerSequence(gsts);
 		}
diff --git a/crypto/src/asn1/x509/NoticeReference.cs b/crypto/src/asn1/x509/NoticeReference.cs
index f0d3a7b7f..98a64ec55 100644
--- a/crypto/src/asn1/x509/NoticeReference.cs
+++ b/crypto/src/asn1/x509/NoticeReference.cs
@@ -1,5 +1,5 @@
 using System;
-using System.Collections;
+using System.Collections.Generic;
 
 using Org.BouncyCastle.Math;
 
@@ -26,7 +26,7 @@ namespace Org.BouncyCastle.Asn1.X509
         private readonly DisplayText organization;
         private readonly Asn1Sequence noticeNumbers;
 
-        private static Asn1EncodableVector ConvertVector(IList numbers)
+        private static Asn1EncodableVector ConvertVector(IList<object> numbers)
         {
             Asn1EncodableVector av = new Asn1EncodableVector();
 
@@ -58,7 +58,7 @@ namespace Org.BouncyCastle.Asn1.X509
          * @param organization a <code>String</code> value
          * @param numbers a <code>Vector</code> value
          */
-        public NoticeReference(string organization, IList numbers)
+        public NoticeReference(string organization, IList<object> numbers)
             : this(organization, ConvertVector(numbers))
         {
         }
diff --git a/crypto/src/asn1/x509/PolicyMappings.cs b/crypto/src/asn1/x509/PolicyMappings.cs
index 8c9f97814..a077f2059 100644
--- a/crypto/src/asn1/x509/PolicyMappings.cs
+++ b/crypto/src/asn1/x509/PolicyMappings.cs
@@ -1,4 +1,4 @@
-using System.Collections;
+using System.Collections.Generic;
 
 namespace Org.BouncyCastle.Asn1.X509
 {
@@ -29,14 +29,6 @@ namespace Org.BouncyCastle.Asn1.X509
 			this.seq = seq;
 		}
 
-#if !PORTABLE
-        public PolicyMappings(
-            Hashtable mappings)
-            : this((IDictionary)mappings)
-        {
-        }
-#endif
-
         /**
 		 * Creates a new <code>PolicyMappings</code> instance.
 		 *
@@ -44,14 +36,14 @@ namespace Org.BouncyCastle.Asn1.X509
 		 * <code>string</code> oids
 		 * to other <code>string</code> oids.
 		 */
-		public PolicyMappings(
-			IDictionary mappings)
+		public PolicyMappings(IDictionary<string, string> mappings)
 		{
 			Asn1EncodableVector v = new Asn1EncodableVector();
 
-			foreach (string idp in mappings.Keys)
+			foreach (var entry in mappings)
 			{
-				string sdp = (string) mappings[idp];
+				string idp = entry.Key;
+				string sdp = entry.Value;
 
 				v.Add(
 					new DerSequence(
diff --git a/crypto/src/asn1/x509/RSAPublicKeyStructure.cs b/crypto/src/asn1/x509/RSAPublicKeyStructure.cs
index 20fdd96ac..cdb02946a 100644
--- a/crypto/src/asn1/x509/RSAPublicKeyStructure.cs
+++ b/crypto/src/asn1/x509/RSAPublicKeyStructure.cs
@@ -1,7 +1,5 @@
 using System;
-using System.Collections;
 
-using Org.BouncyCastle.Asn1;
 using Org.BouncyCastle.Math;
 using Org.BouncyCastle.Utilities;
 
diff --git a/crypto/src/asn1/x509/SubjectDirectoryAttributes.cs b/crypto/src/asn1/x509/SubjectDirectoryAttributes.cs
index 00db90042..6ebd35e21 100644
--- a/crypto/src/asn1/x509/SubjectDirectoryAttributes.cs
+++ b/crypto/src/asn1/x509/SubjectDirectoryAttributes.cs
@@ -1,5 +1,5 @@
 using System;
-using System.Collections;
+using System.Collections.Generic;
 
 using Org.BouncyCastle.Utilities;
 using Org.BouncyCastle.Utilities.Collections;
@@ -28,7 +28,7 @@ namespace Org.BouncyCastle.Asn1.X509
 	public class SubjectDirectoryAttributes
 		: Asn1Encodable
 	{
-		private readonly IList attributes;
+		private readonly IList<AttributeX509> m_attributes;
 
 		public static SubjectDirectoryAttributes GetInstance(
 			object obj)
@@ -70,11 +70,12 @@ namespace Org.BouncyCastle.Asn1.X509
 		private SubjectDirectoryAttributes(
 			Asn1Sequence seq)
 		{
-            this.attributes = Platform.CreateArrayList();
+            m_attributes = new List<AttributeX509>();
+
             foreach (object o in seq)
 			{
 				Asn1Sequence s = Asn1Sequence.GetInstance(o);
-				attributes.Add(AttributeX509.GetInstance(s));
+				m_attributes.Add(AttributeX509.GetInstance(s));
 			}
 		}
 
@@ -86,11 +87,10 @@ namespace Org.BouncyCastle.Asn1.X509
 		 * @param attributes The attributes.
 		 *
 		 */
-		public SubjectDirectoryAttributes(
-			IList attributes)
+		public SubjectDirectoryAttributes(IList<AttributeX509> attributes)
 		{
-            this.attributes = Platform.CreateArrayList(attributes);
-        }
+			m_attributes = new List<AttributeX509>(attributes);
+		}
 
 		/**
 		 * Produce an object suitable for an Asn1OutputStream.
@@ -114,10 +114,10 @@ namespace Org.BouncyCastle.Asn1.X509
 		 */
 		public override Asn1Object ToAsn1Object()
 		{
-            AttributeX509[] v = new AttributeX509[attributes.Count];
-            for (int i = 0; i < attributes.Count; ++i)
+            AttributeX509[] v = new AttributeX509[m_attributes.Count];
+            for (int i = 0; i < m_attributes.Count; ++i)
             {
-                v[i] = (AttributeX509)attributes[i];
+                v[i] = m_attributes[i];
             }
             return new DerSequence(v);
 		}
@@ -125,9 +125,9 @@ namespace Org.BouncyCastle.Asn1.X509
         /**
 		 * @return Returns the attributes.
 		 */
-		public IEnumerable Attributes
+		public IEnumerable<AttributeX509> Attributes
 		{
-			get { return new EnumerableProxy(attributes); }
+			get { return CollectionUtilities.Proxy(m_attributes); }
 		}
 	}
 }
diff --git a/crypto/src/asn1/x509/SubjectPublicKeyInfo.cs b/crypto/src/asn1/x509/SubjectPublicKeyInfo.cs
index 474493dcf..52f977e91 100644
--- a/crypto/src/asn1/x509/SubjectPublicKeyInfo.cs
+++ b/crypto/src/asn1/x509/SubjectPublicKeyInfo.cs
@@ -1,5 +1,4 @@
 using System;
-using System.Collections;
 using System.IO;
 
 namespace Org.BouncyCastle.Asn1.X509
diff --git a/crypto/src/asn1/x509/TBSCertList.cs b/crypto/src/asn1/x509/TBSCertList.cs
index a427ba2ba..aef41d440 100644
--- a/crypto/src/asn1/x509/TBSCertList.cs
+++ b/crypto/src/asn1/x509/TBSCertList.cs
@@ -1,8 +1,7 @@
 using System;
-using System.Collections;
+using System.Collections.Generic;
 
 using Org.BouncyCastle.Utilities;
-using Org.BouncyCastle.Utilities.Collections;
 
 namespace Org.BouncyCastle.Asn1.X509
 {
@@ -14,13 +13,10 @@ namespace Org.BouncyCastle.Asn1.X509
 		internal Time			revocationDate;
 		internal X509Extensions	crlEntryExtensions;
 
-		public CrlEntry(
-			Asn1Sequence seq)
+		public CrlEntry(Asn1Sequence seq)
 		{
 			if (seq.Count < 2 || seq.Count > 3)
-			{
 				throw new ArgumentException("Bad sequence size: " + seq.Count);
-			}
 
 			this.seq = seq;
 
@@ -82,32 +78,39 @@ namespace Org.BouncyCastle.Asn1.X509
         : Asn1Encodable
     {
 		private class RevokedCertificatesEnumeration
-			: IEnumerable
+			: IEnumerable<CrlEntry>
 		{
-			private readonly IEnumerable en;
+			private readonly IEnumerable<Asn1Encodable> en;
 
-			internal RevokedCertificatesEnumeration(
-				IEnumerable en)
+			internal RevokedCertificatesEnumeration(IEnumerable<Asn1Encodable> en)
 			{
 				this.en = en;
 			}
 
-			public IEnumerator GetEnumerator()
+			System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+            {
+				return GetEnumerator();
+            }
+
+			public IEnumerator<CrlEntry> GetEnumerator()
 			{
 				return new RevokedCertificatesEnumerator(en.GetEnumerator());
 			}
 
 			private class RevokedCertificatesEnumerator
-				: IEnumerator
+				: IEnumerator<CrlEntry>
 			{
-				private readonly IEnumerator e;
+				private readonly IEnumerator<Asn1Encodable> e;
 
-				internal RevokedCertificatesEnumerator(
-					IEnumerator e)
+				internal RevokedCertificatesEnumerator(IEnumerator<Asn1Encodable> e)
 				{
 					this.e = e;
 				}
 
+				public virtual void Dispose()
+				{
+				}
+
 				public bool MoveNext()
 				{
 					return e.MoveNext();
@@ -118,7 +121,12 @@ namespace Org.BouncyCastle.Asn1.X509
 					e.Reset();
 				}
 
-				public object Current
+				object System.Collections.IEnumerator.Current
+                {
+					get { return Current; }
+                }
+
+				public CrlEntry Current
 				{
 					get { return new CrlEntry(Asn1Sequence.GetInstance(e.Current)); }
 				}
@@ -252,11 +260,13 @@ namespace Org.BouncyCastle.Asn1.X509
 			return entries;
 		}
 
-		public IEnumerable GetRevokedCertificateEnumeration()
+		public IEnumerable<CrlEntry> GetRevokedCertificateEnumeration()
 		{
 			if (revokedCertificates == null)
 			{
-				return EmptyEnumerable.Instance;
+				// TODO
+				//return EmptyEnumerable.Instance;
+				return new List<CrlEntry>(0);
 			}
 
 			return new RevokedCertificatesEnumeration(revokedCertificates);
diff --git a/crypto/src/asn1/x509/X509ExtensionsGenerator.cs b/crypto/src/asn1/x509/X509ExtensionsGenerator.cs
index 438c507aa..53d18ecff 100644
--- a/crypto/src/asn1/x509/X509ExtensionsGenerator.cs
+++ b/crypto/src/asn1/x509/X509ExtensionsGenerator.cs
@@ -1,9 +1,6 @@
 using System;
-using System.Collections;
 using System.Collections.Generic;
 
-using Org.BouncyCastle.Utilities;
-
 namespace Org.BouncyCastle.Asn1.X509
 {
     /// <remarks>Generator for X.509 extensions</remarks>
@@ -13,15 +10,13 @@ namespace Org.BouncyCastle.Asn1.X509
             new Dictionary<DerObjectIdentifier, X509Extension>();
         private List<DerObjectIdentifier> m_ordering = new List<DerObjectIdentifier>();
 
-        private static readonly IDictionary dupsAllowed = Platform.CreateHashtable();
-
-        static X509ExtensionsGenerator()
+        private static readonly ISet<DerObjectIdentifier> m_dupsAllowed = new HashSet<DerObjectIdentifier>()
         {
-            dupsAllowed.Add(X509Extensions.SubjectAlternativeName, true);
-            dupsAllowed.Add(X509Extensions.IssuerAlternativeName, true);
-            dupsAllowed.Add(X509Extensions.SubjectDirectoryAttributes, true);
-            dupsAllowed.Add(X509Extensions.CertificateIssuer, true);
-        }
+            X509Extensions.SubjectAlternativeName,
+            X509Extensions.IssuerAlternativeName,
+            X509Extensions.SubjectDirectoryAttributes,
+            X509Extensions.CertificateIssuer
+        };
 
         /// <summary>Reset the generator</summary>
         public void Reset()
@@ -63,7 +58,7 @@ namespace Org.BouncyCastle.Asn1.X509
         {
             if (m_extensions.TryGetValue(oid, out X509Extension existingExtension))
             {
-                if (!dupsAllowed.Contains(oid))
+                if (!m_dupsAllowed.Contains(oid))
                     throw new ArgumentException("extension " + oid + " already added");
 
                 Asn1Sequence seq1 = Asn1Sequence.GetInstance(
diff --git a/crypto/src/asn1/x509/X509Name.cs b/crypto/src/asn1/x509/X509Name.cs
index 0683b380c..7c9797e56 100644
--- a/crypto/src/asn1/x509/X509Name.cs
+++ b/crypto/src/asn1/x509/X509Name.cs
@@ -1,11 +1,9 @@
 using System;
-using System.Collections;
 using System.Collections.Generic;
 using System.IO;
 using System.Text;
 
 using Org.BouncyCastle.Asn1.Pkcs;
-using Org.BouncyCastle.Utilities;
 using Org.BouncyCastle.Utilities.Encoders;
 
 namespace Org.BouncyCastle.Asn1.X509
@@ -205,51 +203,31 @@ namespace Org.BouncyCastle.Asn1.X509
 
         private static readonly bool[] defaultReverse = { false };
 
-#if PORTABLE
         /**
         * default look up table translating OID values into their common symbols following
         * the convention in RFC 2253 with a few extras
         */
-        public static readonly IDictionary DefaultSymbols = Platform.CreateHashtable();
+        public static readonly IDictionary<DerObjectIdentifier, string> DefaultSymbols =
+            new Dictionary<DerObjectIdentifier, string>();
 
         /**
          * look up table translating OID values into their common symbols following the convention in RFC 2253
          */
-        public static readonly IDictionary RFC2253Symbols = Platform.CreateHashtable();
+        public static readonly IDictionary<DerObjectIdentifier, string> RFC2253Symbols =
+            new Dictionary<DerObjectIdentifier, string>();
 
         /**
          * look up table translating OID values into their common symbols following the convention in RFC 1779
          *
          */
-        public static readonly IDictionary RFC1779Symbols = Platform.CreateHashtable();
+        public static readonly IDictionary<DerObjectIdentifier, string> RFC1779Symbols =
+            new Dictionary<DerObjectIdentifier, string>();
 
         /**
         * look up table translating common symbols into their OIDS.
         */
-        public static readonly IDictionary DefaultLookup = Platform.CreateHashtable();
-#else
-        /**
-        * default look up table translating OID values into their common symbols following
-        * the convention in RFC 2253 with a few extras
-        */
-        public static readonly Hashtable DefaultSymbols = new Hashtable();
-
-        /**
-         * look up table translating OID values into their common symbols following the convention in RFC 2253
-         */
-        public static readonly Hashtable RFC2253Symbols = new Hashtable();
-
-        /**
-         * look up table translating OID values into their common symbols following the convention in RFC 1779
-         *
-         */
-        public static readonly Hashtable RFC1779Symbols = new Hashtable();
-
-        /**
-        * look up table translating common symbols into their OIDS.
-        */
-        public static readonly Hashtable DefaultLookup = new Hashtable();
-#endif
+        public static readonly IDictionary<string, DerObjectIdentifier> DefaultLookup =
+            new Dictionary<string, DerObjectIdentifier>(StringComparer.OrdinalIgnoreCase);
 
         static X509Name()
         {
@@ -340,9 +318,9 @@ namespace Org.BouncyCastle.Asn1.X509
         private readonly List<DerObjectIdentifier> ordering = new List<DerObjectIdentifier>();
         private readonly X509NameEntryConverter converter;
 
-        private IList		    values = Platform.CreateArrayList();
-        private IList           added = Platform.CreateArrayList();
-        private Asn1Sequence	seq;
+        private IList<string> values = new List<string>();
+        private IList<bool> added = new List<bool>();
+        private Asn1Sequence seq;
 
         /**
         * Return a X509Name based on the passed in tagged object.
@@ -377,8 +355,7 @@ namespace Org.BouncyCastle.Asn1.X509
         *
         * the principal will be a list of constructed sets, each containing an (OID, string) pair.
         */
-        protected X509Name(
-            Asn1Sequence seq)
+        protected X509Name(Asn1Sequence seq)
         {
             this.seq = seq;
 
@@ -399,7 +376,7 @@ namespace Org.BouncyCastle.Asn1.X509
                     if (derValue is IAsn1String && !(derValue is DerUniversalString))
                     {
                         string v = ((IAsn1String)derValue).GetString();
-                        if (Platform.StartsWith(v, "#"))
+                        if (v.StartsWith("#"))
                         {
                             v = "\\" + v;
                         }
@@ -425,8 +402,8 @@ namespace Org.BouncyCastle.Asn1.X509
         * in the order they are meant to be encoded or printed in ToString.</p>
         */
         public X509Name(
-            IList       ordering,
-            IDictionary attributes)
+            IList<DerObjectIdentifier> ordering,
+            IDictionary<DerObjectIdentifier, string> attributes)
             : this(ordering, attributes, new X509DefaultEntryConverter())
         {
         }
@@ -443,19 +420,22 @@ namespace Org.BouncyCastle.Asn1.X509
         * ASN.1 counterparts.</p>
         */
         public X509Name(
-            IList                   ordering,
-            IDictionary             attributes,
+            IList<DerObjectIdentifier> ordering,
+            IDictionary<DerObjectIdentifier, string> attributes,
             X509NameEntryConverter	converter)
         {
             this.converter = converter;
 
             foreach (DerObjectIdentifier oid in ordering)
             {
-                object attribute = attributes[oid];
-                if (attribute == null)
-                {
+                if (!attributes.TryGetValue(oid, out var attribute))
                     throw new ArgumentException("No attribute for object id - " + oid + " - passed to distinguished name");
-                }
+
+                //object attribute = attributes[oid];
+                //if (attribute == null)
+                //{
+                //    throw new ArgumentException("No attribute for object id - " + oid + " - passed to distinguished name");
+                //}
 
                 this.ordering.Add(oid);
                 this.added.Add(false);
@@ -466,7 +446,7 @@ namespace Org.BouncyCastle.Asn1.X509
         /**
         * Takes two vectors one of the oids and the other of the values.
         */
-        public X509Name(IList<DerObjectIdentifier> oids, IList values)
+        public X509Name(IList<DerObjectIdentifier> oids, IList<string> values)
             : this(oids, values, new X509DefaultEntryConverter())
         {
         }
@@ -477,14 +457,12 @@ namespace Org.BouncyCastle.Asn1.X509
         * The passed in converter will be used to convert the strings into their
         * ASN.1 counterparts.</p>
         */
-        public X509Name(IList<DerObjectIdentifier> oids, IList values, X509NameEntryConverter converter)
+        public X509Name(IList<DerObjectIdentifier> oids, IList<string> values, X509NameEntryConverter converter)
         {
             this.converter = converter;
 
             if (oids.Count != values.Count)
-            {
                 throw new ArgumentException("'oids' must be same length as 'values'.");
-            }
 
             for (int i = 0; i < oids.Count; i++)
             {
@@ -499,7 +477,7 @@ namespace Org.BouncyCastle.Asn1.X509
         * some such, converting it into an ordered set of name attributes.
         */
         public X509Name(string dirName)
-            : this(DefaultReverse, (IDictionary)DefaultLookup, dirName)
+            : this(DefaultReverse, DefaultLookup, dirName)
         {
         }
 
@@ -509,9 +487,7 @@ namespace Org.BouncyCastle.Asn1.X509
         * string value being converted to its associated ASN.1 type using the passed
         * in converter.
         */
-        public X509Name(
-            string					dirName,
-            X509NameEntryConverter	converter)
+        public X509Name(string dirName, X509NameEntryConverter converter)
             : this(DefaultReverse, DefaultLookup, dirName, converter)
         {
         }
@@ -522,10 +498,8 @@ namespace Org.BouncyCastle.Asn1.X509
         * is true, create the encoded version of the sequence starting from the
         * last element in the string.
         */
-        public X509Name(
-            bool	reverse,
-            string	dirName)
-            : this(reverse, (IDictionary)DefaultLookup, dirName)
+        public X509Name(bool reverse, string dirName)
+            : this(reverse, DefaultLookup, dirName)
         {
         }
 
@@ -536,10 +510,7 @@ namespace Org.BouncyCastle.Asn1.X509
         * in converter. If reverse is true the ASN.1 sequence representing the DN will
         * be built by starting at the end of the string, rather than the start.
         */
-        public X509Name(
-            bool					reverse,
-            string					dirName,
-            X509NameEntryConverter	converter)
+        public X509Name(bool reverse, string dirName, X509NameEntryConverter converter)
             : this(reverse, DefaultLookup, dirName, converter)
         {
         }
@@ -557,34 +528,23 @@ namespace Org.BouncyCastle.Asn1.X509
         * @param lookUp table of names and their oids.
         * @param dirName the X.500 string to be parsed.
         */
-        public X509Name(
-            bool		reverse,
-            IDictionary lookUp,
-            string		dirName)
-            : this(reverse, lookUp, dirName, new X509DefaultEntryConverter())
+        public X509Name(bool reverse, IDictionary<string, DerObjectIdentifier> lookup, string dirName)
+            : this(reverse, lookup, dirName, new X509DefaultEntryConverter())
         {
         }
 
-        private DerObjectIdentifier DecodeOid(
-            string		name,
-            IDictionary lookUp)
+        private DerObjectIdentifier DecodeOid(string name, IDictionary<string, DerObjectIdentifier> lookup)
         {
-            if (Platform.StartsWith(Platform.ToUpperInvariant(name), "OID."))
-            {
-                return new DerObjectIdentifier(name.Substring(4));
-            }
-            else if (name[0] >= '0' && name[0] <= '9')
-            {
+            if (name.StartsWith("OID.", StringComparison.OrdinalIgnoreCase))
+                return new DerObjectIdentifier(name.Substring("OID.".Length));
+
+            if (name[0] >= '0' && name[0] <= '9')
                 return new DerObjectIdentifier(name);
-            }
 
-            DerObjectIdentifier oid = (DerObjectIdentifier)lookUp[Platform.ToLowerInvariant(name)];
-            if (oid == null)
-            {
-                throw new ArgumentException("Unknown object id - " + name + " - passed to distinguished name");
-            }
+            if (lookup.TryGetValue(name, out var oid))
+                return oid;
 
-            return oid;
+            throw new ArgumentException("Unknown object id - " + name + " - passed to distinguished name");
         }
 
         /**
@@ -600,11 +560,8 @@ namespace Org.BouncyCastle.Asn1.X509
         * @param dirName the string dirName
         * @param converter the converter to convert string values into their ASN.1 equivalents
         */
-        public X509Name(
-            bool					reverse,
-            IDictionary				lookUp,
-            string					dirName,
-            X509NameEntryConverter	converter)
+        public X509Name(bool reverse, IDictionary<string, DerObjectIdentifier> lookup, string dirName,
+            X509NameEntryConverter converter)
         {
             this.converter = converter;
             X509NameTokenizer nTok = new X509NameTokenizer(dirName);
@@ -615,13 +572,11 @@ namespace Org.BouncyCastle.Asn1.X509
                 int index = token.IndexOf('=');
 
                 if (index == -1)
-                {
                     throw new ArgumentException("badly formated directory string");
-                }
 
                 string name = token.Substring(0, index);
                 string value = token.Substring(index + 1);
-                DerObjectIdentifier	oid = DecodeOid(name, lookUp);
+                DerObjectIdentifier	oid = DecodeOid(name, lookup);
 
                 if (value.IndexOf('+') > 0)
                 {
@@ -639,7 +594,7 @@ namespace Org.BouncyCastle.Asn1.X509
 
                         string nm = sv.Substring(0, ndx);
                         string vl = sv.Substring(ndx + 1);
-                        this.ordering.Add(DecodeOid(nm, lookUp));
+                        this.ordering.Add(DecodeOid(nm, lookup));
                         this.values.Add(vl);
                         this.added.Add(true);
                     }
@@ -658,8 +613,8 @@ namespace Org.BouncyCastle.Asn1.X509
 //				this.values.Reverse();
 //				this.added.Reverse();
                 var o = new List<DerObjectIdentifier>();
-                IList v = Platform.CreateArrayList();
-                IList a = Platform.CreateArrayList();
+                var v = new List<string>();
+                var a = new List<bool>();
                 int count = 1;
 
                 for (int i = 0; i < this.ordering.Count; i++)
@@ -711,8 +666,7 @@ namespace Org.BouncyCastle.Asn1.X509
                 if (null == oid || oid.Equals(ordering[i]))
                 {
                     string val = (string)values[i];
-
-                    if (Platform.StartsWith(val, "\\#"))
+                    if (val.StartsWith("\\#"))
                     {
                         val = val.Substring(1);
                     }
@@ -794,7 +748,7 @@ namespace Org.BouncyCastle.Asn1.X509
                 string val = (string) values[i];
                 string oVal = (string) other.values[i];
 
-                if (!equivalentStrings(val, oVal))
+                if (!EquivalentStrings(val, oVal))
                     return false;
             }
 
@@ -855,7 +809,7 @@ namespace Org.BouncyCastle.Asn1.X509
                     {
                         string oValue = (string)other.values[j];
 
-                        if (equivalentStrings(value, oValue))
+                        if (EquivalentStrings(value, oValue))
                         {
                             indexes[j] = true;
                             found      = true;
@@ -873,47 +827,40 @@ namespace Org.BouncyCastle.Asn1.X509
             return true;
         }
 
-        private static bool equivalentStrings(
-            string	s1,
-            string	s2)
+        private static bool EquivalentStrings(string s1, string s2)
         {
-            string v1 = canonicalize(s1);
-            string v2 = canonicalize(s2);
+            string v1 = Canonicalize(s1);
+            string v2 = Canonicalize(s2);
 
             if (!v1.Equals(v2))
             {
-                v1 = stripInternalSpaces(v1);
-                v2 = stripInternalSpaces(v2);
+                v1 = StripInternalSpaces(v1);
+                v2 = StripInternalSpaces(v2);
 
                 if (!v1.Equals(v2))
-                {
                     return false;
-                }
             }
 
             return true;
         }
 
-        private static string canonicalize(
-            string s)
+        private static string Canonicalize(string s)
         {
-            string v = Platform.ToLowerInvariant(s).Trim();
+            string v = s.ToLowerInvariant().Trim();
 
-            if (Platform.StartsWith(v, "#"))
+            if (v.StartsWith("#"))
             {
-                Asn1Object obj = decodeObject(v);
-
-                if (obj is IAsn1String)
+                Asn1Object obj = DecodeObject(v);
+                if (obj is IAsn1String str)
                 {
-                    v = Platform.ToLowerInvariant(((IAsn1String)obj).GetString()).Trim();
+                    v = str.GetString().ToLowerInvariant().Trim();
                 }
             }
 
             return v;
         }
 
-        private static Asn1Object decodeObject(
-            string v)
+        private static Asn1Object DecodeObject(string v)
         {
             try
             {
@@ -925,8 +872,7 @@ namespace Org.BouncyCastle.Asn1.X509
             }
         }
 
-        private static string stripInternalSpaces(
-            string str)
+        private static string StripInternalSpaces(string str)
         {
             StringBuilder res = new StringBuilder();
 
@@ -950,15 +896,10 @@ namespace Org.BouncyCastle.Asn1.X509
             return res.ToString();
         }
 
-        private void AppendValue(
-            StringBuilder		buf,
-            IDictionary         oidSymbols,
-            DerObjectIdentifier	oid,
-            string				val)
+        private void AppendValue(StringBuilder buf, IDictionary<DerObjectIdentifier, string> oidSymbols,
+            DerObjectIdentifier oid, string val)
         {
-            string sym = (string)oidSymbols[oid];
-
-            if (sym != null)
+            if (oidSymbols.TryGetValue(oid, out var sym))
             {
                 buf.Append(sym);
             }
@@ -975,7 +916,7 @@ namespace Org.BouncyCastle.Asn1.X509
 
             int end = buf.Length;
 
-            if (Platform.StartsWith(val, "\\#"))
+            if (val.StartsWith("\\#"))
             {
                 index += 2;
             }
@@ -1011,33 +952,23 @@ namespace Org.BouncyCastle.Asn1.X509
         * @param reverse if true start at the end of the sequence and work back.
         * @param oidSymbols look up table strings for oids.
         */
-        public string ToString(
-            bool		reverse,
-            IDictionary oidSymbols)
+        public string ToString(bool reverse, IDictionary<DerObjectIdentifier, string> oidSymbols)
         {
-#if PORTABLE
-            List<object> components = new List<object>();
-#else
-            ArrayList components = new ArrayList();
-#endif
+            var components = new List<StringBuilder>();
 
             StringBuilder ava = null;
 
             for (int i = 0; i < ordering.Count; i++)
             {
-                if ((bool) added[i])
+                if (added[i])
                 {
                     ava.Append('+');
-                    AppendValue(ava, oidSymbols,
-                        (DerObjectIdentifier)ordering[i],
-                        (string)values[i]);
+                    AppendValue(ava, oidSymbols, ordering[i], values[i]);
                 }
                 else
                 {
                     ava = new StringBuilder();
-                    AppendValue(ava, oidSymbols,
-                        (DerObjectIdentifier)ordering[i],
-                        (string)values[i]);
+                    AppendValue(ava, oidSymbols, ordering[i], values[i]);
                     components.Add(ava);
                 }
             }
@@ -1065,7 +996,7 @@ namespace Org.BouncyCastle.Asn1.X509
 
         public override string ToString()
         {
-            return ToString(DefaultReverse, (IDictionary)DefaultSymbols);
+            return ToString(DefaultReverse, DefaultSymbols);
         }
     }
 }
diff --git a/crypto/src/asn1/x509/qualified/MonetaryValue.cs b/crypto/src/asn1/x509/qualified/MonetaryValue.cs
index d703de943..be4cd1142 100644
--- a/crypto/src/asn1/x509/qualified/MonetaryValue.cs
+++ b/crypto/src/asn1/x509/qualified/MonetaryValue.cs
@@ -1,5 +1,4 @@
 using System;
-using System.Collections;
 
 using Org.BouncyCastle.Math;
 using Org.BouncyCastle.Utilities;
diff --git a/crypto/src/asn1/x509/qualified/SemanticsInformation.cs b/crypto/src/asn1/x509/qualified/SemanticsInformation.cs
index 379e6d1d1..23818e916 100644
--- a/crypto/src/asn1/x509/qualified/SemanticsInformation.cs
+++ b/crypto/src/asn1/x509/qualified/SemanticsInformation.cs
@@ -1,7 +1,5 @@
 using System;
-using System.Collections;
 
-using Org.BouncyCastle.Asn1.X509;
 using Org.BouncyCastle.Utilities;
 
 namespace Org.BouncyCastle.Asn1.X509.Qualified
@@ -42,33 +40,30 @@ namespace Org.BouncyCastle.Asn1.X509.Qualified
 			throw new ArgumentException("unknown object in GetInstance: " + Platform.GetTypeName(obj), "obj");
 		}
 
-		public SemanticsInformation(
-			Asn1Sequence seq)
+		public SemanticsInformation(Asn1Sequence seq)
         {
             if (seq.Count < 1)
-            {
                 throw new ArgumentException("no objects in SemanticsInformation");
-            }
 
-			IEnumerator e = seq.GetEnumerator();
+			var e = seq.GetEnumerator();
 			e.MoveNext();
-            object obj = e.Current;
-            if (obj is DerObjectIdentifier)
+            var obj = e.Current;
+            if (obj is DerObjectIdentifier oid)
             {
-                semanticsIdentifier = DerObjectIdentifier.GetInstance(obj);
+                semanticsIdentifier = oid;
                 if (e.MoveNext())
                 {
-                    obj  = e.Current;
+                    obj = e.Current;
                 }
                 else
                 {
-                    obj  = null;
+                    obj = null;
                 }
             }
 
-			if (obj  != null)
+			if (obj != null)
             {
-                Asn1Sequence generalNameSeq = Asn1Sequence.GetInstance(obj );
+                Asn1Sequence generalNameSeq = Asn1Sequence.GetInstance(obj);
                 nameRegistrationAuthorities = new GeneralName[generalNameSeq.Count];
                 for (int i= 0; i < generalNameSeq.Count; i++)
                 {
@@ -97,7 +92,10 @@ namespace Org.BouncyCastle.Asn1.X509.Qualified
             this.nameRegistrationAuthorities = generalNames;
         }
 
-		public DerObjectIdentifier SemanticsIdentifier { get { return semanticsIdentifier; } }
+		public DerObjectIdentifier SemanticsIdentifier 
+        {
+            get { return semanticsIdentifier; }
+        }
 
 		public GeneralName[] GetNameRegistrationAuthorities()
         {
diff --git a/crypto/src/asn1/x509/sigi/NameOrPseudonym.cs b/crypto/src/asn1/x509/sigi/NameOrPseudonym.cs
index 2402e3832..c801002d1 100644
--- a/crypto/src/asn1/x509/sigi/NameOrPseudonym.cs
+++ b/crypto/src/asn1/x509/sigi/NameOrPseudonym.cs
@@ -1,5 +1,4 @@
 using System;
-using System.Collections;
 
 using Org.BouncyCastle.Asn1.X500;
 using Org.BouncyCastle.Utilities;
diff --git a/crypto/src/asn1/x509/sigi/PersonalData.cs b/crypto/src/asn1/x509/sigi/PersonalData.cs
index 0e0bb5365..439039888 100644
--- a/crypto/src/asn1/x509/sigi/PersonalData.cs
+++ b/crypto/src/asn1/x509/sigi/PersonalData.cs
@@ -1,5 +1,4 @@
 using System;
-using System.Collections;
 
 using Org.BouncyCastle.Asn1.X500;
 using Org.BouncyCastle.Math;
@@ -69,13 +68,12 @@ namespace Org.BouncyCastle.Asn1.X509.SigI
 		*
 		* @param seq The ASN.1 sequence.
 		*/
-		private PersonalData(
-			Asn1Sequence seq)
+		private PersonalData(Asn1Sequence seq)
 		{
 			if (seq.Count < 1)
 				throw new ArgumentException("Bad sequence size: " + seq.Count);
 
-			IEnumerator e = seq.GetEnumerator();
+			var e = seq.GetEnumerator();
 			e.MoveNext();
 
 			nameOrPseudonym = NameOrPseudonym.GetInstance(e.Current);
@@ -86,23 +84,23 @@ namespace Org.BouncyCastle.Asn1.X509.SigI
 				int tag = o.TagNo;
 				switch (tag)
 				{
-					case 0:
-						nameDistinguisher = DerInteger.GetInstance(o, false).Value;
-						break;
-					case 1:
-						dateOfBirth = DerGeneralizedTime.GetInstance(o, false);
-						break;
-					case 2:
-						placeOfBirth = DirectoryString.GetInstance(o, true);
-						break;
-					case 3:
-						gender = DerPrintableString.GetInstance(o, false).GetString();
-						break;
-					case 4:
-						postalAddress = DirectoryString.GetInstance(o, true);
-						break;
-					default:
-						throw new ArgumentException("Bad tag number: " + o.TagNo);
+				case 0:
+					nameDistinguisher = DerInteger.GetInstance(o, false).Value;
+					break;
+				case 1:
+					dateOfBirth = DerGeneralizedTime.GetInstance(o, false);
+					break;
+				case 2:
+					placeOfBirth = DirectoryString.GetInstance(o, true);
+					break;
+				case 3:
+					gender = DerPrintableString.GetInstance(o, false).GetString();
+					break;
+				case 4:
+					postalAddress = DirectoryString.GetInstance(o, true);
+					break;
+				default:
+					throw new ArgumentException("Bad tag number: " + o.TagNo);
 				}
 			}
 		}