summary refs log tree commit diff
path: root/crypto/src/security
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-06-29 14:15:10 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-06-29 14:15:10 +0700
commit435210f10fd927653ce8fbc04ec537ae5d8966b6 (patch)
tree27b6ed1c029db271c3429ac57629d7f0156c5fed /crypto/src/security
parentRefactoring around Platform (diff)
downloadBouncyCastle.NET-ed25519-435210f10fd927653ce8fbc04ec537ae5d8966b6.tar.xz
Generics migration complete
Diffstat (limited to 'crypto/src/security')
-rw-r--r--crypto/src/security/AgreementUtilities.cs41
-rw-r--r--crypto/src/security/CipherUtilities.cs838
-rw-r--r--crypto/src/security/DigestUtilities.cs373
-rw-r--r--crypto/src/security/DotNetUtilities.cs6
-rw-r--r--crypto/src/security/GeneratorUtilities.cs85
-rw-r--r--crypto/src/security/MacUtilities.cs158
-rw-r--r--crypto/src/security/ParameterUtilities.cs53
-rw-r--r--crypto/src/security/PbeUtilities.cs421
-rw-r--r--crypto/src/security/PrivateKeyFactory.cs2
-rw-r--r--crypto/src/security/PublicKeyFactory.cs4
-rw-r--r--crypto/src/security/SecureRandom.cs11
-rw-r--r--crypto/src/security/SignerUtilities.cs889
-rw-r--r--crypto/src/security/WrapperUtilities.cs68
13 files changed, 1383 insertions, 1566 deletions
diff --git a/crypto/src/security/AgreementUtilities.cs b/crypto/src/security/AgreementUtilities.cs
index 26d1628cc..0b7fc2a2b 100644
--- a/crypto/src/security/AgreementUtilities.cs
+++ b/crypto/src/security/AgreementUtilities.cs
@@ -1,4 +1,5 @@
-using System.Collections;
+using System;
+using System.Collections.Generic;
 
 using Org.BouncyCastle.Asn1;
 using Org.BouncyCastle.Asn1.EdEC;
@@ -7,30 +8,26 @@ using Org.BouncyCastle.Crypto;
 using Org.BouncyCastle.Crypto.Agreement;
 using Org.BouncyCastle.Crypto.Agreement.Kdf;
 using Org.BouncyCastle.Crypto.Digests;
-using Org.BouncyCastle.Utilities;
+using Org.BouncyCastle.Utilities.Collections;
 
 namespace Org.BouncyCastle.Security
 {
 	/// <remarks>
 	///  Utility class for creating IBasicAgreement objects from their names/Oids
 	/// </remarks>
-	public sealed class AgreementUtilities
+	public static class AgreementUtilities
 	{
-		private AgreementUtilities()
-		{
-		}
-
-		private static readonly IDictionary algorithms = Platform.CreateHashtable();
-        //private static readonly IDictionary oids = Platform.CreateHashtable();
+		private static readonly IDictionary<string, string> Algorithms =
+			new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
 
         static AgreementUtilities()
 		{
-            algorithms[X9ObjectIdentifiers.DHSinglePassCofactorDHSha1KdfScheme.Id] = "ECCDHWITHSHA1KDF";
-			algorithms[X9ObjectIdentifiers.DHSinglePassStdDHSha1KdfScheme.Id] = "ECDHWITHSHA1KDF";
-			algorithms[X9ObjectIdentifiers.MqvSinglePassSha1KdfScheme.Id] = "ECMQVWITHSHA1KDF";
+            Algorithms[X9ObjectIdentifiers.DHSinglePassCofactorDHSha1KdfScheme.Id] = "ECCDHWITHSHA1KDF";
+			Algorithms[X9ObjectIdentifiers.DHSinglePassStdDHSha1KdfScheme.Id] = "ECDHWITHSHA1KDF";
+			Algorithms[X9ObjectIdentifiers.MqvSinglePassSha1KdfScheme.Id] = "ECMQVWITHSHA1KDF";
 
-            algorithms[EdECObjectIdentifiers.id_X25519.Id] = "X25519";
-            algorithms[EdECObjectIdentifiers.id_X448.Id] = "X448";
+            Algorithms[EdECObjectIdentifiers.id_X25519.Id] = "X25519";
+            Algorithms[EdECObjectIdentifiers.id_X448.Id] = "X448";
         }
 
         public static IBasicAgreement GetBasicAgreement(
@@ -94,8 +91,7 @@ namespace Org.BouncyCastle.Security
             return GetRawAgreement(oid.Id);
         }
 
-        public static IRawAgreement GetRawAgreement(
-            string algorithm)
+        public static IRawAgreement GetRawAgreement(string algorithm)
         {
             string mechanism = GetMechanism(algorithm);
 
@@ -108,17 +104,16 @@ namespace Org.BouncyCastle.Security
             throw new SecurityUtilityException("Raw Agreement " + algorithm + " not recognised.");
         }
 
-		public static string GetAlgorithmName(
-			DerObjectIdentifier oid)
+		public static string GetAlgorithmName(DerObjectIdentifier oid)
 		{
-			return (string)algorithms[oid.Id];
+			return CollectionUtilities.GetValueOrNull(Algorithms, oid.Id);
 		}
 
-        private static string GetMechanism(string algorithm)
+		private static string GetMechanism(string algorithm)
         {
-            string upper = Platform.ToUpperInvariant(algorithm);
-            string mechanism = (string)algorithms[upper];
-            return mechanism == null ? upper : mechanism;
+			var mechanism = CollectionUtilities.GetValueOrKey(Algorithms, algorithm);
+
+			return mechanism.ToUpperInvariant();
         }
 	}
 }
diff --git a/crypto/src/security/CipherUtilities.cs b/crypto/src/security/CipherUtilities.cs
index 3b92add00..a6849c102 100644
--- a/crypto/src/security/CipherUtilities.cs
+++ b/crypto/src/security/CipherUtilities.cs
@@ -1,5 +1,5 @@
 using System;
-using System.Collections;
+using System.Collections.Generic;
 
 using Org.BouncyCastle.Asn1;
 using Org.BouncyCastle.Asn1.CryptoPro;
@@ -19,13 +19,14 @@ using Org.BouncyCastle.Crypto.Macs;
 using Org.BouncyCastle.Crypto.Modes;
 using Org.BouncyCastle.Crypto.Paddings;
 using Org.BouncyCastle.Utilities;
+using Org.BouncyCastle.Utilities.Collections;
 
 namespace Org.BouncyCastle.Security
 {
     /// <remarks>
     ///  Cipher Utility class contains methods that can not be specifically grouped into other classes.
     /// </remarks>
-    public sealed class CipherUtilities
+    public static class CipherUtilities
     {
         private enum CipherAlgorithm {
             AES,
@@ -111,8 +112,8 @@ namespace Org.BouncyCastle.Security
             ZEROBYTEPADDING,
         };
 
-        private static readonly IDictionary algorithms = Platform.CreateHashtable();
-        private static readonly IDictionary oids = Platform.CreateHashtable();
+        private static readonly Dictionary<string, string> Algorithms =
+            new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
 
         static CipherUtilities()
         {
@@ -123,172 +124,142 @@ namespace Org.BouncyCastle.Security
 
             // TODO Flesh out the list of aliases
 
-            algorithms[NistObjectIdentifiers.IdAes128Cbc.Id] = "AES/CBC/PKCS7PADDING";
-            algorithms[NistObjectIdentifiers.IdAes192Cbc.Id] = "AES/CBC/PKCS7PADDING";
-            algorithms[NistObjectIdentifiers.IdAes256Cbc.Id] = "AES/CBC/PKCS7PADDING";
-
-            algorithms[NistObjectIdentifiers.IdAes128Ccm.Id] = "AES/CCM/NOPADDING";
-            algorithms[NistObjectIdentifiers.IdAes192Ccm.Id] = "AES/CCM/NOPADDING";
-            algorithms[NistObjectIdentifiers.IdAes256Ccm.Id] = "AES/CCM/NOPADDING";
-
-            algorithms[NistObjectIdentifiers.IdAes128Cfb.Id] = "AES/CFB/NOPADDING";
-            algorithms[NistObjectIdentifiers.IdAes192Cfb.Id] = "AES/CFB/NOPADDING";
-            algorithms[NistObjectIdentifiers.IdAes256Cfb.Id] = "AES/CFB/NOPADDING";
-
-            algorithms[NistObjectIdentifiers.IdAes128Ecb.Id] = "AES/ECB/PKCS7PADDING";
-            algorithms[NistObjectIdentifiers.IdAes192Ecb.Id] = "AES/ECB/PKCS7PADDING";
-            algorithms[NistObjectIdentifiers.IdAes256Ecb.Id] = "AES/ECB/PKCS7PADDING";
-            algorithms["AES//PKCS7"] = "AES/ECB/PKCS7PADDING";
-            algorithms["AES//PKCS7PADDING"] = "AES/ECB/PKCS7PADDING";
-            algorithms["AES//PKCS5"] = "AES/ECB/PKCS7PADDING";
-            algorithms["AES//PKCS5PADDING"] = "AES/ECB/PKCS7PADDING";
+            Algorithms[NistObjectIdentifiers.IdAes128Cbc.Id] = "AES/CBC/PKCS7PADDING";
+            Algorithms[NistObjectIdentifiers.IdAes192Cbc.Id] = "AES/CBC/PKCS7PADDING";
+            Algorithms[NistObjectIdentifiers.IdAes256Cbc.Id] = "AES/CBC/PKCS7PADDING";
+
+            Algorithms[NistObjectIdentifiers.IdAes128Ccm.Id] = "AES/CCM/NOPADDING";
+            Algorithms[NistObjectIdentifiers.IdAes192Ccm.Id] = "AES/CCM/NOPADDING";
+            Algorithms[NistObjectIdentifiers.IdAes256Ccm.Id] = "AES/CCM/NOPADDING";
+
+            Algorithms[NistObjectIdentifiers.IdAes128Cfb.Id] = "AES/CFB/NOPADDING";
+            Algorithms[NistObjectIdentifiers.IdAes192Cfb.Id] = "AES/CFB/NOPADDING";
+            Algorithms[NistObjectIdentifiers.IdAes256Cfb.Id] = "AES/CFB/NOPADDING";
+
+            Algorithms[NistObjectIdentifiers.IdAes128Ecb.Id] = "AES/ECB/PKCS7PADDING";
+            Algorithms[NistObjectIdentifiers.IdAes192Ecb.Id] = "AES/ECB/PKCS7PADDING";
+            Algorithms[NistObjectIdentifiers.IdAes256Ecb.Id] = "AES/ECB/PKCS7PADDING";
+            Algorithms["AES//PKCS7"] = "AES/ECB/PKCS7PADDING";
+            Algorithms["AES//PKCS7PADDING"] = "AES/ECB/PKCS7PADDING";
+            Algorithms["AES//PKCS5"] = "AES/ECB/PKCS7PADDING";
+            Algorithms["AES//PKCS5PADDING"] = "AES/ECB/PKCS7PADDING";
 
-            algorithms[NistObjectIdentifiers.IdAes128Gcm.Id] = "AES/GCM/NOPADDING";
-            algorithms[NistObjectIdentifiers.IdAes192Gcm.Id] = "AES/GCM/NOPADDING";
-            algorithms[NistObjectIdentifiers.IdAes256Gcm.Id] = "AES/GCM/NOPADDING";
+            Algorithms[NistObjectIdentifiers.IdAes128Gcm.Id] = "AES/GCM/NOPADDING";
+            Algorithms[NistObjectIdentifiers.IdAes192Gcm.Id] = "AES/GCM/NOPADDING";
+            Algorithms[NistObjectIdentifiers.IdAes256Gcm.Id] = "AES/GCM/NOPADDING";
 
-            algorithms[NistObjectIdentifiers.IdAes128Ofb.Id] = "AES/OFB/NOPADDING";
-            algorithms[NistObjectIdentifiers.IdAes192Ofb.Id] = "AES/OFB/NOPADDING";
-            algorithms[NistObjectIdentifiers.IdAes256Ofb.Id] = "AES/OFB/NOPADDING";
+            Algorithms[NistObjectIdentifiers.IdAes128Ofb.Id] = "AES/OFB/NOPADDING";
+            Algorithms[NistObjectIdentifiers.IdAes192Ofb.Id] = "AES/OFB/NOPADDING";
+            Algorithms[NistObjectIdentifiers.IdAes256Ofb.Id] = "AES/OFB/NOPADDING";
 
-            algorithms[NsriObjectIdentifiers.id_aria128_cbc.Id] = "ARIA/CBC/PKCS7PADDING";
-            algorithms[NsriObjectIdentifiers.id_aria192_cbc.Id] = "ARIA/CBC/PKCS7PADDING";
-            algorithms[NsriObjectIdentifiers.id_aria256_cbc.Id] = "ARIA/CBC/PKCS7PADDING";
+            Algorithms[NsriObjectIdentifiers.id_aria128_cbc.Id] = "ARIA/CBC/PKCS7PADDING";
+            Algorithms[NsriObjectIdentifiers.id_aria192_cbc.Id] = "ARIA/CBC/PKCS7PADDING";
+            Algorithms[NsriObjectIdentifiers.id_aria256_cbc.Id] = "ARIA/CBC/PKCS7PADDING";
 
-            algorithms[NsriObjectIdentifiers.id_aria128_ccm.Id] = "ARIA/CCM/NOPADDING";
-            algorithms[NsriObjectIdentifiers.id_aria192_ccm.Id] = "ARIA/CCM/NOPADDING";
-            algorithms[NsriObjectIdentifiers.id_aria256_ccm.Id] = "ARIA/CCM/NOPADDING";
+            Algorithms[NsriObjectIdentifiers.id_aria128_ccm.Id] = "ARIA/CCM/NOPADDING";
+            Algorithms[NsriObjectIdentifiers.id_aria192_ccm.Id] = "ARIA/CCM/NOPADDING";
+            Algorithms[NsriObjectIdentifiers.id_aria256_ccm.Id] = "ARIA/CCM/NOPADDING";
 
-            algorithms[NsriObjectIdentifiers.id_aria128_cfb.Id] = "ARIA/CFB/NOPADDING";
-            algorithms[NsriObjectIdentifiers.id_aria192_cfb.Id] = "ARIA/CFB/NOPADDING";
-            algorithms[NsriObjectIdentifiers.id_aria256_cfb.Id] = "ARIA/CFB/NOPADDING";
+            Algorithms[NsriObjectIdentifiers.id_aria128_cfb.Id] = "ARIA/CFB/NOPADDING";
+            Algorithms[NsriObjectIdentifiers.id_aria192_cfb.Id] = "ARIA/CFB/NOPADDING";
+            Algorithms[NsriObjectIdentifiers.id_aria256_cfb.Id] = "ARIA/CFB/NOPADDING";
 
-            algorithms[NsriObjectIdentifiers.id_aria128_ctr.Id] = "ARIA/CTR/NOPADDING";
-            algorithms[NsriObjectIdentifiers.id_aria192_ctr.Id] = "ARIA/CTR/NOPADDING";
-            algorithms[NsriObjectIdentifiers.id_aria256_ctr.Id] = "ARIA/CTR/NOPADDING";
+            Algorithms[NsriObjectIdentifiers.id_aria128_ctr.Id] = "ARIA/CTR/NOPADDING";
+            Algorithms[NsriObjectIdentifiers.id_aria192_ctr.Id] = "ARIA/CTR/NOPADDING";
+            Algorithms[NsriObjectIdentifiers.id_aria256_ctr.Id] = "ARIA/CTR/NOPADDING";
 
-            algorithms[NsriObjectIdentifiers.id_aria128_ecb.Id] = "ARIA/ECB/PKCS7PADDING";
-            algorithms[NsriObjectIdentifiers.id_aria192_ecb.Id] = "ARIA/ECB/PKCS7PADDING";
-            algorithms[NsriObjectIdentifiers.id_aria256_ecb.Id] = "ARIA/ECB/PKCS7PADDING";
-            algorithms["ARIA//PKCS7"] = "ARIA/ECB/PKCS7PADDING";
-            algorithms["ARIA//PKCS7PADDING"] = "ARIA/ECB/PKCS7PADDING";
-            algorithms["ARIA//PKCS5"] = "ARIA/ECB/PKCS7PADDING";
-            algorithms["ARIA//PKCS5PADDING"] = "ARIA/ECB/PKCS7PADDING";
+            Algorithms[NsriObjectIdentifiers.id_aria128_ecb.Id] = "ARIA/ECB/PKCS7PADDING";
+            Algorithms[NsriObjectIdentifiers.id_aria192_ecb.Id] = "ARIA/ECB/PKCS7PADDING";
+            Algorithms[NsriObjectIdentifiers.id_aria256_ecb.Id] = "ARIA/ECB/PKCS7PADDING";
+            Algorithms["ARIA//PKCS7"] = "ARIA/ECB/PKCS7PADDING";
+            Algorithms["ARIA//PKCS7PADDING"] = "ARIA/ECB/PKCS7PADDING";
+            Algorithms["ARIA//PKCS5"] = "ARIA/ECB/PKCS7PADDING";
+            Algorithms["ARIA//PKCS5PADDING"] = "ARIA/ECB/PKCS7PADDING";
 
-            algorithms[NsriObjectIdentifiers.id_aria128_gcm.Id] = "ARIA/GCM/NOPADDING";
-            algorithms[NsriObjectIdentifiers.id_aria192_gcm.Id] = "ARIA/GCM/NOPADDING";
-            algorithms[NsriObjectIdentifiers.id_aria256_gcm.Id] = "ARIA/GCM/NOPADDING";
+            Algorithms[NsriObjectIdentifiers.id_aria128_gcm.Id] = "ARIA/GCM/NOPADDING";
+            Algorithms[NsriObjectIdentifiers.id_aria192_gcm.Id] = "ARIA/GCM/NOPADDING";
+            Algorithms[NsriObjectIdentifiers.id_aria256_gcm.Id] = "ARIA/GCM/NOPADDING";
 
-            algorithms[NsriObjectIdentifiers.id_aria128_ofb.Id] = "ARIA/OFB/NOPADDING";
-            algorithms[NsriObjectIdentifiers.id_aria192_ofb.Id] = "ARIA/OFB/NOPADDING";
-            algorithms[NsriObjectIdentifiers.id_aria256_ofb.Id] = "ARIA/OFB/NOPADDING";
+            Algorithms[NsriObjectIdentifiers.id_aria128_ofb.Id] = "ARIA/OFB/NOPADDING";
+            Algorithms[NsriObjectIdentifiers.id_aria192_ofb.Id] = "ARIA/OFB/NOPADDING";
+            Algorithms[NsriObjectIdentifiers.id_aria256_ofb.Id] = "ARIA/OFB/NOPADDING";
 
-            algorithms["RSA/ECB/PKCS1"] = "RSA//PKCS1PADDING";
-            algorithms["RSA/ECB/PKCS1PADDING"] = "RSA//PKCS1PADDING";
-            algorithms[PkcsObjectIdentifiers.RsaEncryption.Id] = "RSA//PKCS1PADDING";
-            algorithms[PkcsObjectIdentifiers.IdRsaesOaep.Id] = "RSA//OAEPPADDING";
+            Algorithms["RSA/ECB/PKCS1"] = "RSA//PKCS1PADDING";
+            Algorithms["RSA/ECB/PKCS1PADDING"] = "RSA//PKCS1PADDING";
+            Algorithms[PkcsObjectIdentifiers.RsaEncryption.Id] = "RSA//PKCS1PADDING";
+            Algorithms[PkcsObjectIdentifiers.IdRsaesOaep.Id] = "RSA//OAEPPADDING";
 
-            algorithms[OiwObjectIdentifiers.DesCbc.Id] = "DES/CBC";
-            algorithms[OiwObjectIdentifiers.DesCfb.Id] = "DES/CFB";
-            algorithms[OiwObjectIdentifiers.DesEcb.Id] = "DES/ECB";
-            algorithms[OiwObjectIdentifiers.DesOfb.Id] = "DES/OFB";
-            algorithms[OiwObjectIdentifiers.DesEde.Id] = "DESEDE";
-            algorithms["TDEA"] = "DESEDE";
-            algorithms[PkcsObjectIdentifiers.DesEde3Cbc.Id] = "DESEDE/CBC";
-            algorithms[PkcsObjectIdentifiers.RC2Cbc.Id] = "RC2/CBC";
-            algorithms["1.3.6.1.4.1.188.7.1.1.2"] = "IDEA/CBC";
-            algorithms["1.2.840.113533.7.66.10"] = "CAST5/CBC";
+            Algorithms[OiwObjectIdentifiers.DesCbc.Id] = "DES/CBC";
+            Algorithms[OiwObjectIdentifiers.DesCfb.Id] = "DES/CFB";
+            Algorithms[OiwObjectIdentifiers.DesEcb.Id] = "DES/ECB";
+            Algorithms[OiwObjectIdentifiers.DesOfb.Id] = "DES/OFB";
+            Algorithms[OiwObjectIdentifiers.DesEde.Id] = "DESEDE";
+            Algorithms["TDEA"] = "DESEDE";
+            Algorithms[PkcsObjectIdentifiers.DesEde3Cbc.Id] = "DESEDE/CBC";
+            Algorithms[PkcsObjectIdentifiers.RC2Cbc.Id] = "RC2/CBC";
+            Algorithms["1.3.6.1.4.1.188.7.1.1.2"] = "IDEA/CBC";
+            Algorithms["1.2.840.113533.7.66.10"] = "CAST5/CBC";
 
-            algorithms["RC4"] = "ARC4";
-            algorithms["ARCFOUR"] = "ARC4";
-            algorithms["1.2.840.113549.3.4"] = "ARC4";
+            Algorithms["RC4"] = "ARC4";
+            Algorithms["ARCFOUR"] = "ARC4";
+            Algorithms["1.2.840.113549.3.4"] = "ARC4";
 
 
 
-            algorithms["PBEWITHSHA1AND128BITRC4"] = "PBEWITHSHAAND128BITRC4";
-            algorithms[PkcsObjectIdentifiers.PbeWithShaAnd128BitRC4.Id] = "PBEWITHSHAAND128BITRC4";
-            algorithms["PBEWITHSHA1AND40BITRC4"] = "PBEWITHSHAAND40BITRC4";
-            algorithms[PkcsObjectIdentifiers.PbeWithShaAnd40BitRC4.Id] = "PBEWITHSHAAND40BITRC4";
+            Algorithms["PBEWITHSHA1AND128BITRC4"] = "PBEWITHSHAAND128BITRC4";
+            Algorithms[PkcsObjectIdentifiers.PbeWithShaAnd128BitRC4.Id] = "PBEWITHSHAAND128BITRC4";
+            Algorithms["PBEWITHSHA1AND40BITRC4"] = "PBEWITHSHAAND40BITRC4";
+            Algorithms[PkcsObjectIdentifiers.PbeWithShaAnd40BitRC4.Id] = "PBEWITHSHAAND40BITRC4";
 
-            algorithms["PBEWITHSHA1ANDDES"] = "PBEWITHSHA1ANDDES-CBC";
-            algorithms[PkcsObjectIdentifiers.PbeWithSha1AndDesCbc.Id] = "PBEWITHSHA1ANDDES-CBC";
-            algorithms["PBEWITHSHA1ANDRC2"] = "PBEWITHSHA1ANDRC2-CBC";
-            algorithms[PkcsObjectIdentifiers.PbeWithSha1AndRC2Cbc.Id] = "PBEWITHSHA1ANDRC2-CBC";
+            Algorithms["PBEWITHSHA1ANDDES"] = "PBEWITHSHA1ANDDES-CBC";
+            Algorithms[PkcsObjectIdentifiers.PbeWithSha1AndDesCbc.Id] = "PBEWITHSHA1ANDDES-CBC";
+            Algorithms["PBEWITHSHA1ANDRC2"] = "PBEWITHSHA1ANDRC2-CBC";
+            Algorithms[PkcsObjectIdentifiers.PbeWithSha1AndRC2Cbc.Id] = "PBEWITHSHA1ANDRC2-CBC";
 
-            algorithms["PBEWITHSHA1AND3-KEYTRIPLEDES-CBC"] = "PBEWITHSHAAND3-KEYTRIPLEDES-CBC";
-            algorithms["PBEWITHSHAAND3KEYTRIPLEDES"] = "PBEWITHSHAAND3-KEYTRIPLEDES-CBC";
-            algorithms[PkcsObjectIdentifiers.PbeWithShaAnd3KeyTripleDesCbc.Id] = "PBEWITHSHAAND3-KEYTRIPLEDES-CBC";
-            algorithms["PBEWITHSHA1ANDDESEDE"] = "PBEWITHSHAAND3-KEYTRIPLEDES-CBC";
+            Algorithms["PBEWITHSHA1AND3-KEYTRIPLEDES-CBC"] = "PBEWITHSHAAND3-KEYTRIPLEDES-CBC";
+            Algorithms["PBEWITHSHAAND3KEYTRIPLEDES"] = "PBEWITHSHAAND3-KEYTRIPLEDES-CBC";
+            Algorithms[PkcsObjectIdentifiers.PbeWithShaAnd3KeyTripleDesCbc.Id] = "PBEWITHSHAAND3-KEYTRIPLEDES-CBC";
+            Algorithms["PBEWITHSHA1ANDDESEDE"] = "PBEWITHSHAAND3-KEYTRIPLEDES-CBC";
 
-            algorithms["PBEWITHSHA1AND2-KEYTRIPLEDES-CBC"] = "PBEWITHSHAAND2-KEYTRIPLEDES-CBC";
-            algorithms[PkcsObjectIdentifiers.PbeWithShaAnd2KeyTripleDesCbc.Id] = "PBEWITHSHAAND2-KEYTRIPLEDES-CBC";
+            Algorithms["PBEWITHSHA1AND2-KEYTRIPLEDES-CBC"] = "PBEWITHSHAAND2-KEYTRIPLEDES-CBC";
+            Algorithms[PkcsObjectIdentifiers.PbeWithShaAnd2KeyTripleDesCbc.Id] = "PBEWITHSHAAND2-KEYTRIPLEDES-CBC";
 
-            algorithms["PBEWITHSHA1AND128BITRC2-CBC"] = "PBEWITHSHAAND128BITRC2-CBC";
-            algorithms[PkcsObjectIdentifiers.PbeWithShaAnd128BitRC2Cbc.Id] = "PBEWITHSHAAND128BITRC2-CBC";
+            Algorithms["PBEWITHSHA1AND128BITRC2-CBC"] = "PBEWITHSHAAND128BITRC2-CBC";
+            Algorithms[PkcsObjectIdentifiers.PbeWithShaAnd128BitRC2Cbc.Id] = "PBEWITHSHAAND128BITRC2-CBC";
 
-            algorithms["PBEWITHSHA1AND40BITRC2-CBC"] = "PBEWITHSHAAND40BITRC2-CBC";
-            algorithms[PkcsObjectIdentifiers.PbewithShaAnd40BitRC2Cbc.Id] = "PBEWITHSHAAND40BITRC2-CBC";
+            Algorithms["PBEWITHSHA1AND40BITRC2-CBC"] = "PBEWITHSHAAND40BITRC2-CBC";
+            Algorithms[PkcsObjectIdentifiers.PbewithShaAnd40BitRC2Cbc.Id] = "PBEWITHSHAAND40BITRC2-CBC";
 
-            algorithms["PBEWITHSHA1AND128BITAES-CBC-BC"] = "PBEWITHSHAAND128BITAES-CBC-BC";
-            algorithms["PBEWITHSHA-1AND128BITAES-CBC-BC"] = "PBEWITHSHAAND128BITAES-CBC-BC";
+            Algorithms["PBEWITHSHA1AND128BITAES-CBC-BC"] = "PBEWITHSHAAND128BITAES-CBC-BC";
+            Algorithms["PBEWITHSHA-1AND128BITAES-CBC-BC"] = "PBEWITHSHAAND128BITAES-CBC-BC";
 
-            algorithms["PBEWITHSHA1AND192BITAES-CBC-BC"] = "PBEWITHSHAAND192BITAES-CBC-BC";
-            algorithms["PBEWITHSHA-1AND192BITAES-CBC-BC"] = "PBEWITHSHAAND192BITAES-CBC-BC";
+            Algorithms["PBEWITHSHA1AND192BITAES-CBC-BC"] = "PBEWITHSHAAND192BITAES-CBC-BC";
+            Algorithms["PBEWITHSHA-1AND192BITAES-CBC-BC"] = "PBEWITHSHAAND192BITAES-CBC-BC";
 
-            algorithms["PBEWITHSHA1AND256BITAES-CBC-BC"] = "PBEWITHSHAAND256BITAES-CBC-BC";
-            algorithms["PBEWITHSHA-1AND256BITAES-CBC-BC"] = "PBEWITHSHAAND256BITAES-CBC-BC";
+            Algorithms["PBEWITHSHA1AND256BITAES-CBC-BC"] = "PBEWITHSHAAND256BITAES-CBC-BC";
+            Algorithms["PBEWITHSHA-1AND256BITAES-CBC-BC"] = "PBEWITHSHAAND256BITAES-CBC-BC";
 
-            algorithms["PBEWITHSHA-256AND128BITAES-CBC-BC"] = "PBEWITHSHA256AND128BITAES-CBC-BC";
-            algorithms["PBEWITHSHA-256AND192BITAES-CBC-BC"] = "PBEWITHSHA256AND192BITAES-CBC-BC";
-            algorithms["PBEWITHSHA-256AND256BITAES-CBC-BC"] = "PBEWITHSHA256AND256BITAES-CBC-BC";
+            Algorithms["PBEWITHSHA-256AND128BITAES-CBC-BC"] = "PBEWITHSHA256AND128BITAES-CBC-BC";
+            Algorithms["PBEWITHSHA-256AND192BITAES-CBC-BC"] = "PBEWITHSHA256AND192BITAES-CBC-BC";
+            Algorithms["PBEWITHSHA-256AND256BITAES-CBC-BC"] = "PBEWITHSHA256AND256BITAES-CBC-BC";
 
 
-            algorithms["GOST"] = "GOST28147";
-            algorithms["GOST-28147"] = "GOST28147";
-            algorithms[CryptoProObjectIdentifiers.GostR28147Cbc.Id] = "GOST28147/CBC/PKCS7PADDING";
+            Algorithms["GOST"] = "GOST28147";
+            Algorithms["GOST-28147"] = "GOST28147";
+            Algorithms[CryptoProObjectIdentifiers.GostR28147Cbc.Id] = "GOST28147/CBC/PKCS7PADDING";
 
-            algorithms["RC5-32"] = "RC5";
+            Algorithms["RC5-32"] = "RC5";
 
-            algorithms[NttObjectIdentifiers.IdCamellia128Cbc.Id] = "CAMELLIA/CBC/PKCS7PADDING";
-            algorithms[NttObjectIdentifiers.IdCamellia192Cbc.Id] = "CAMELLIA/CBC/PKCS7PADDING";
-            algorithms[NttObjectIdentifiers.IdCamellia256Cbc.Id] = "CAMELLIA/CBC/PKCS7PADDING";
+            Algorithms[NttObjectIdentifiers.IdCamellia128Cbc.Id] = "CAMELLIA/CBC/PKCS7PADDING";
+            Algorithms[NttObjectIdentifiers.IdCamellia192Cbc.Id] = "CAMELLIA/CBC/PKCS7PADDING";
+            Algorithms[NttObjectIdentifiers.IdCamellia256Cbc.Id] = "CAMELLIA/CBC/PKCS7PADDING";
 
-            algorithms[KisaObjectIdentifiers.IdSeedCbc.Id] = "SEED/CBC/PKCS7PADDING";
+            Algorithms[KisaObjectIdentifiers.IdSeedCbc.Id] = "SEED/CBC/PKCS7PADDING";
 
-            algorithms["1.3.6.1.4.1.3029.1.2"] = "BLOWFISH/CBC";
+            Algorithms["1.3.6.1.4.1.3029.1.2"] = "BLOWFISH/CBC";
 
-            algorithms["CHACHA20"] = "CHACHA7539";
-            algorithms[PkcsObjectIdentifiers.IdAlgAeadChaCha20Poly1305.Id] = "CHACHA20-POLY1305";
-        }
-
-        private CipherUtilities()
-        {
-        }
-
-        /// <summary>
-        /// Returns a ObjectIdentifier for a give encoding.
-        /// </summary>
-        /// <param name="mechanism">A string representation of the encoding.</param>
-        /// <returns>A DerObjectIdentifier, null if the Oid is not available.</returns>
-        // TODO Don't really want to support this
-        public static DerObjectIdentifier GetObjectIdentifier(
-            string mechanism)
-        {
-            if (mechanism == null)
-                throw new ArgumentNullException("mechanism");
-
-            mechanism = Platform.ToUpperInvariant(mechanism);
-            string aliased = (string) algorithms[mechanism];
-
-            if (aliased != null)
-                mechanism = aliased;
-
-            return (DerObjectIdentifier) oids[mechanism];
-        }
-
-        public static ICollection Algorithms
-        {
-            get { return oids.Keys; }
+            Algorithms["CHACHA20"] = "CHACHA7539";
+            Algorithms[PkcsObjectIdentifiers.IdAlgAeadChaCha20Poly1305.Id] = "CHACHA20-POLY1305";
         }
 
         public static IBufferedCipher GetCipher(
@@ -297,20 +268,12 @@ namespace Org.BouncyCastle.Security
             return GetCipher(oid.Id);
         }
 
-        public static IBufferedCipher GetCipher(
-            string algorithm)
+        public static IBufferedCipher GetCipher(string algorithm)
         {
             if (algorithm == null)
-                throw new ArgumentNullException("algorithm");
+                throw new ArgumentNullException(nameof(algorithm));
 
-            algorithm = Platform.ToUpperInvariant(algorithm);
-
-            {
-                string aliased = (string) algorithms[algorithm];
-
-                if (aliased != null)
-                    algorithm = aliased;
-            }
+            algorithm = CollectionUtilities.GetValueOrKey(Algorithms, algorithm).ToUpperInvariant();
 
             IBasicAgreement iesAgreement = null;
             if (algorithm == "IES")
@@ -390,14 +353,7 @@ namespace Org.BouncyCastle.Security
             IAsymmetricBlockCipher asymBlockCipher = null;
             IStreamCipher streamCipher = null;
 
-            string algorithmName = parts[0];
-
-            {
-                string aliased = (string)algorithms[algorithmName];
-
-                if (aliased != null)
-                    algorithmName = aliased;
-            }
+            string algorithmName = CollectionUtilities.GetValueOrKey(Algorithms, parts[0]).ToUpperInvariant();
 
             CipherAlgorithm cipherAlgorithm;
             try
@@ -411,126 +367,126 @@ namespace Org.BouncyCastle.Security
 
             switch (cipherAlgorithm)
             {
-                case CipherAlgorithm.AES:
-                    blockCipher = new AesEngine();
-                    break;
-                case CipherAlgorithm.ARC4:
-                    streamCipher = new RC4Engine();
-                    break;
-                case CipherAlgorithm.ARIA:
-                    blockCipher = new AriaEngine();
-                    break;
-                case CipherAlgorithm.BLOWFISH:
-                    blockCipher = new BlowfishEngine();
-                    break;
-                case CipherAlgorithm.CAMELLIA:
-                    blockCipher = new CamelliaEngine();
-                    break;
-                case CipherAlgorithm.CAST5:
-                    blockCipher = new Cast5Engine();
-                    break;
-                case CipherAlgorithm.CAST6:
-                    blockCipher = new Cast6Engine();
-                    break;
-                case CipherAlgorithm.CHACHA:
-                    streamCipher = new ChaChaEngine();
-                    break;
-                case CipherAlgorithm.CHACHA20_POLY1305:
-                    aeadCipher = new ChaCha20Poly1305();
-                    break;
-                case CipherAlgorithm.CHACHA7539:
-                    streamCipher = new ChaCha7539Engine();
-                    break;
-                case CipherAlgorithm.DES:
-                    blockCipher = new DesEngine();
-                    break;
-                case CipherAlgorithm.DESEDE:
-                    blockCipher = new DesEdeEngine();
-                    break;
-                case CipherAlgorithm.ELGAMAL:
-                    asymBlockCipher = new ElGamalEngine();
-                    break;
-                case CipherAlgorithm.GOST28147:
-                    blockCipher = new Gost28147Engine();
-                    break;
-                case CipherAlgorithm.HC128:
-                    streamCipher = new HC128Engine();
-                    break;
-                case CipherAlgorithm.HC256:
-                    streamCipher = new HC256Engine();
-                    break;
-                case CipherAlgorithm.IDEA:
-                    blockCipher = new IdeaEngine();
-                    break;
-                case CipherAlgorithm.NOEKEON:
-                    blockCipher = new NoekeonEngine();
-                    break;
-                case CipherAlgorithm.PBEWITHSHAAND128BITRC4:
-                case CipherAlgorithm.PBEWITHSHAAND40BITRC4:
-                    streamCipher = new RC4Engine();
-                    break;
-                case CipherAlgorithm.RC2:
-                    blockCipher = new RC2Engine();
-                    break;
-                case CipherAlgorithm.RC5:
-                    blockCipher = new RC532Engine();
-                    break;
-                case CipherAlgorithm.RC5_64:
-                    blockCipher = new RC564Engine();
-                    break;
-                case CipherAlgorithm.RC6:
-                    blockCipher = new RC6Engine();
-                    break;
-                case CipherAlgorithm.RIJNDAEL:
-                    blockCipher = new RijndaelEngine();
-                    break;
-                case CipherAlgorithm.RSA:
-                    asymBlockCipher = new RsaBlindedEngine();
-                    break;
-                case CipherAlgorithm.SALSA20:
-                    streamCipher = new Salsa20Engine();
-                    break;
-                case CipherAlgorithm.SEED:
-                    blockCipher = new SeedEngine();
-                    break;
-                case CipherAlgorithm.SERPENT:
-                    blockCipher = new SerpentEngine();
-                    break;
-                case CipherAlgorithm.SKIPJACK:
-                    blockCipher = new SkipjackEngine();
-                    break;
-                case CipherAlgorithm.SM4:
-                    blockCipher = new SM4Engine();
-                    break;
-                case CipherAlgorithm.TEA:
-                    blockCipher = new TeaEngine();
-                    break;
-                case CipherAlgorithm.THREEFISH_256:
-                    blockCipher = new ThreefishEngine(ThreefishEngine.BLOCKSIZE_256);
-                    break;
-                case CipherAlgorithm.THREEFISH_512:
-                    blockCipher = new ThreefishEngine(ThreefishEngine.BLOCKSIZE_512);
-                    break;
-                case CipherAlgorithm.THREEFISH_1024:
-                    blockCipher = new ThreefishEngine(ThreefishEngine.BLOCKSIZE_1024);
-                    break;
-                case CipherAlgorithm.TNEPRES:
-                    blockCipher = new TnepresEngine();
-                    break;
-                case CipherAlgorithm.TWOFISH:
-                    blockCipher = new TwofishEngine();
-                    break;
-                case CipherAlgorithm.VMPC:
-                    streamCipher = new VmpcEngine();
-                    break;
-                case CipherAlgorithm.VMPC_KSA3:
-                    streamCipher = new VmpcKsa3Engine();
-                    break;
-                case CipherAlgorithm.XTEA:
-                    blockCipher = new XteaEngine();
-                    break;
-                default:
-                    throw new SecurityUtilityException("Cipher " + algorithm + " not recognised.");
+            case CipherAlgorithm.AES:
+                blockCipher = new AesEngine();
+                break;
+            case CipherAlgorithm.ARC4:
+                streamCipher = new RC4Engine();
+                break;
+            case CipherAlgorithm.ARIA:
+                blockCipher = new AriaEngine();
+                break;
+            case CipherAlgorithm.BLOWFISH:
+                blockCipher = new BlowfishEngine();
+                break;
+            case CipherAlgorithm.CAMELLIA:
+                blockCipher = new CamelliaEngine();
+                break;
+            case CipherAlgorithm.CAST5:
+                blockCipher = new Cast5Engine();
+                break;
+            case CipherAlgorithm.CAST6:
+                blockCipher = new Cast6Engine();
+                break;
+            case CipherAlgorithm.CHACHA:
+                streamCipher = new ChaChaEngine();
+                break;
+            case CipherAlgorithm.CHACHA20_POLY1305:
+                aeadCipher = new ChaCha20Poly1305();
+                break;
+            case CipherAlgorithm.CHACHA7539:
+                streamCipher = new ChaCha7539Engine();
+                break;
+            case CipherAlgorithm.DES:
+                blockCipher = new DesEngine();
+                break;
+            case CipherAlgorithm.DESEDE:
+                blockCipher = new DesEdeEngine();
+                break;
+            case CipherAlgorithm.ELGAMAL:
+                asymBlockCipher = new ElGamalEngine();
+                break;
+            case CipherAlgorithm.GOST28147:
+                blockCipher = new Gost28147Engine();
+                break;
+            case CipherAlgorithm.HC128:
+                streamCipher = new HC128Engine();
+                break;
+            case CipherAlgorithm.HC256:
+                streamCipher = new HC256Engine();
+                break;
+            case CipherAlgorithm.IDEA:
+                blockCipher = new IdeaEngine();
+                break;
+            case CipherAlgorithm.NOEKEON:
+                blockCipher = new NoekeonEngine();
+                break;
+            case CipherAlgorithm.PBEWITHSHAAND128BITRC4:
+            case CipherAlgorithm.PBEWITHSHAAND40BITRC4:
+                streamCipher = new RC4Engine();
+                break;
+            case CipherAlgorithm.RC2:
+                blockCipher = new RC2Engine();
+                break;
+            case CipherAlgorithm.RC5:
+                blockCipher = new RC532Engine();
+                break;
+            case CipherAlgorithm.RC5_64:
+                blockCipher = new RC564Engine();
+                break;
+            case CipherAlgorithm.RC6:
+                blockCipher = new RC6Engine();
+                break;
+            case CipherAlgorithm.RIJNDAEL:
+                blockCipher = new RijndaelEngine();
+                break;
+            case CipherAlgorithm.RSA:
+                asymBlockCipher = new RsaBlindedEngine();
+                break;
+            case CipherAlgorithm.SALSA20:
+                streamCipher = new Salsa20Engine();
+                break;
+            case CipherAlgorithm.SEED:
+                blockCipher = new SeedEngine();
+                break;
+            case CipherAlgorithm.SERPENT:
+                blockCipher = new SerpentEngine();
+                break;
+            case CipherAlgorithm.SKIPJACK:
+                blockCipher = new SkipjackEngine();
+                break;
+            case CipherAlgorithm.SM4:
+                blockCipher = new SM4Engine();
+                break;
+            case CipherAlgorithm.TEA:
+                blockCipher = new TeaEngine();
+                break;
+            case CipherAlgorithm.THREEFISH_256:
+                blockCipher = new ThreefishEngine(ThreefishEngine.BLOCKSIZE_256);
+                break;
+            case CipherAlgorithm.THREEFISH_512:
+                blockCipher = new ThreefishEngine(ThreefishEngine.BLOCKSIZE_512);
+                break;
+            case CipherAlgorithm.THREEFISH_1024:
+                blockCipher = new ThreefishEngine(ThreefishEngine.BLOCKSIZE_1024);
+                break;
+            case CipherAlgorithm.TNEPRES:
+                blockCipher = new TnepresEngine();
+                break;
+            case CipherAlgorithm.TWOFISH:
+                blockCipher = new TwofishEngine();
+                break;
+            case CipherAlgorithm.VMPC:
+                streamCipher = new VmpcEngine();
+                break;
+            case CipherAlgorithm.VMPC_KSA3:
+                streamCipher = new VmpcKsa3Engine();
+                break;
+            case CipherAlgorithm.XTEA:
+                blockCipher = new XteaEngine();
+                break;
+            default:
+                throw new SecurityUtilityException("Cipher " + algorithm + " not recognised.");
             }
 
             if (aeadCipher != null)
@@ -585,81 +541,81 @@ namespace Org.BouncyCastle.Security
 
                 switch (cipherPadding)
                 {
-                    case CipherPadding.NOPADDING:
-                        padded = false;
-                        break;
-                    case CipherPadding.RAW:
-                        break;
-                    case CipherPadding.ISO10126PADDING:
-                    case CipherPadding.ISO10126D2PADDING:
-                    case CipherPadding.ISO10126_2PADDING:
-                        padding = new ISO10126d2Padding();
-                        break;
-                    case CipherPadding.ISO7816_4PADDING:
-                    case CipherPadding.ISO9797_1PADDING:
-                        padding = new ISO7816d4Padding();
-                        break;
-                    case CipherPadding.ISO9796_1:
-                    case CipherPadding.ISO9796_1PADDING:
-                        asymBlockCipher = new ISO9796d1Encoding(asymBlockCipher);
-                        break;
-                    case CipherPadding.OAEP:
-                    case CipherPadding.OAEPPADDING:
-                        asymBlockCipher = new OaepEncoding(asymBlockCipher);
-                        break;
-                    case CipherPadding.OAEPWITHMD5ANDMGF1PADDING:
-                        asymBlockCipher = new OaepEncoding(asymBlockCipher, new MD5Digest());
-                        break;
-                    case CipherPadding.OAEPWITHSHA1ANDMGF1PADDING:
-                    case CipherPadding.OAEPWITHSHA_1ANDMGF1PADDING:
-                        asymBlockCipher = new OaepEncoding(asymBlockCipher, new Sha1Digest());
-                        break;
-                    case CipherPadding.OAEPWITHSHA224ANDMGF1PADDING:
-                    case CipherPadding.OAEPWITHSHA_224ANDMGF1PADDING:
-                        asymBlockCipher = new OaepEncoding(asymBlockCipher, new Sha224Digest());
-                        break;
-                    case CipherPadding.OAEPWITHSHA256ANDMGF1PADDING:
-                    case CipherPadding.OAEPWITHSHA_256ANDMGF1PADDING:
-                    case CipherPadding.OAEPWITHSHA256ANDMGF1WITHSHA256PADDING:
-                    case CipherPadding.OAEPWITHSHA_256ANDMGF1WITHSHA_256PADDING:
-                        asymBlockCipher = new OaepEncoding(asymBlockCipher, new Sha256Digest());
-                        break;
-                    case CipherPadding.OAEPWITHSHA256ANDMGF1WITHSHA1PADDING:
-                    case CipherPadding.OAEPWITHSHA_256ANDMGF1WITHSHA_1PADDING:
-                        asymBlockCipher = new OaepEncoding(asymBlockCipher, new Sha256Digest(), new Sha1Digest(), null);
-                        break;
-                    case CipherPadding.OAEPWITHSHA384ANDMGF1PADDING:
-                    case CipherPadding.OAEPWITHSHA_384ANDMGF1PADDING:
-                        asymBlockCipher = new OaepEncoding(asymBlockCipher, new Sha384Digest());
-                        break;
-                    case CipherPadding.OAEPWITHSHA512ANDMGF1PADDING:
-                    case CipherPadding.OAEPWITHSHA_512ANDMGF1PADDING:
-                        asymBlockCipher = new OaepEncoding(asymBlockCipher, new Sha512Digest());
-                        break;
-                    case CipherPadding.PKCS1:
-                    case CipherPadding.PKCS1PADDING:
-                        asymBlockCipher = new Pkcs1Encoding(asymBlockCipher);
-                        break;
-                    case CipherPadding.PKCS5:
-                    case CipherPadding.PKCS5PADDING:
-                    case CipherPadding.PKCS7:
-                    case CipherPadding.PKCS7PADDING:
-                        padding = new Pkcs7Padding();
-                        break;
-                    case CipherPadding.TBCPADDING:
-                        padding = new TbcPadding();
-                        break;
-                    case CipherPadding.WITHCTS:
-                        cts = true;
-                        break;
-                    case CipherPadding.X923PADDING:
-                        padding = new X923Padding();
-                        break;
-                    case CipherPadding.ZEROBYTEPADDING:
-                        padding = new ZeroBytePadding();
-                        break;
-                    default:
-                        throw new SecurityUtilityException("Cipher " + algorithm + " not recognised.");
+                case CipherPadding.NOPADDING:
+                    padded = false;
+                    break;
+                case CipherPadding.RAW:
+                    break;
+                case CipherPadding.ISO10126PADDING:
+                case CipherPadding.ISO10126D2PADDING:
+                case CipherPadding.ISO10126_2PADDING:
+                    padding = new ISO10126d2Padding();
+                    break;
+                case CipherPadding.ISO7816_4PADDING:
+                case CipherPadding.ISO9797_1PADDING:
+                    padding = new ISO7816d4Padding();
+                    break;
+                case CipherPadding.ISO9796_1:
+                case CipherPadding.ISO9796_1PADDING:
+                    asymBlockCipher = new ISO9796d1Encoding(asymBlockCipher);
+                    break;
+                case CipherPadding.OAEP:
+                case CipherPadding.OAEPPADDING:
+                    asymBlockCipher = new OaepEncoding(asymBlockCipher);
+                    break;
+                case CipherPadding.OAEPWITHMD5ANDMGF1PADDING:
+                    asymBlockCipher = new OaepEncoding(asymBlockCipher, new MD5Digest());
+                    break;
+                case CipherPadding.OAEPWITHSHA1ANDMGF1PADDING:
+                case CipherPadding.OAEPWITHSHA_1ANDMGF1PADDING:
+                    asymBlockCipher = new OaepEncoding(asymBlockCipher, new Sha1Digest());
+                    break;
+                case CipherPadding.OAEPWITHSHA224ANDMGF1PADDING:
+                case CipherPadding.OAEPWITHSHA_224ANDMGF1PADDING:
+                    asymBlockCipher = new OaepEncoding(asymBlockCipher, new Sha224Digest());
+                    break;
+                case CipherPadding.OAEPWITHSHA256ANDMGF1PADDING:
+                case CipherPadding.OAEPWITHSHA_256ANDMGF1PADDING:
+                case CipherPadding.OAEPWITHSHA256ANDMGF1WITHSHA256PADDING:
+                case CipherPadding.OAEPWITHSHA_256ANDMGF1WITHSHA_256PADDING:
+                    asymBlockCipher = new OaepEncoding(asymBlockCipher, new Sha256Digest());
+                    break;
+                case CipherPadding.OAEPWITHSHA256ANDMGF1WITHSHA1PADDING:
+                case CipherPadding.OAEPWITHSHA_256ANDMGF1WITHSHA_1PADDING:
+                    asymBlockCipher = new OaepEncoding(asymBlockCipher, new Sha256Digest(), new Sha1Digest(), null);
+                    break;
+                case CipherPadding.OAEPWITHSHA384ANDMGF1PADDING:
+                case CipherPadding.OAEPWITHSHA_384ANDMGF1PADDING:
+                    asymBlockCipher = new OaepEncoding(asymBlockCipher, new Sha384Digest());
+                    break;
+                case CipherPadding.OAEPWITHSHA512ANDMGF1PADDING:
+                case CipherPadding.OAEPWITHSHA_512ANDMGF1PADDING:
+                    asymBlockCipher = new OaepEncoding(asymBlockCipher, new Sha512Digest());
+                    break;
+                case CipherPadding.PKCS1:
+                case CipherPadding.PKCS1PADDING:
+                    asymBlockCipher = new Pkcs1Encoding(asymBlockCipher);
+                    break;
+                case CipherPadding.PKCS5:
+                case CipherPadding.PKCS5PADDING:
+                case CipherPadding.PKCS7:
+                case CipherPadding.PKCS7PADDING:
+                    padding = new Pkcs7Padding();
+                    break;
+                case CipherPadding.TBCPADDING:
+                    padding = new TbcPadding();
+                    break;
+                case CipherPadding.WITHCTS:
+                    cts = true;
+                    break;
+                case CipherPadding.X923PADDING:
+                    padding = new X923Padding();
+                    break;
+                case CipherPadding.ZEROBYTEPADDING:
+                    padding = new ZeroBytePadding();
+                    break;
+                default:
+                    throw new SecurityUtilityException("Cipher " + algorithm + " not recognised.");
                 }
             }
 
@@ -679,64 +635,64 @@ namespace Org.BouncyCastle.Security
 
                     switch (cipherMode)
                     {
-                        case CipherMode.ECB:
-                        case CipherMode.NONE:
-                            break;
-                        case CipherMode.CBC:
-                            blockCipher = new CbcBlockCipher(blockCipher);
-                            break;
-                        case CipherMode.CCM:
-                            aeadBlockCipher = new CcmBlockCipher(blockCipher);
-                            break;
-                        case CipherMode.CFB:
-                        {
-                            int bits = (di < 0)
-                                ?	8 * blockCipher.GetBlockSize()
-                                :	int.Parse(mode.Substring(di));
+                    case CipherMode.ECB:
+                    case CipherMode.NONE:
+                        break;
+                    case CipherMode.CBC:
+                        blockCipher = new CbcBlockCipher(blockCipher);
+                        break;
+                    case CipherMode.CCM:
+                        aeadBlockCipher = new CcmBlockCipher(blockCipher);
+                        break;
+                    case CipherMode.CFB:
+                    {
+                        int bits = (di < 0)
+                            ?	8 * blockCipher.GetBlockSize()
+                            :	int.Parse(mode.Substring(di));
     
-                            blockCipher = new CfbBlockCipher(blockCipher, bits);
-                            break;
-                        }
-                        case CipherMode.CTR:
-                            blockCipher = new SicBlockCipher(blockCipher);
-                            break;
-                        case CipherMode.CTS:
-                            cts = true;
-                            blockCipher = new CbcBlockCipher(blockCipher);
-                            break;
-                        case CipherMode.EAX:
-                            aeadBlockCipher = new EaxBlockCipher(blockCipher);
-                            break;
-                        case CipherMode.GCM:
-                            aeadBlockCipher = new GcmBlockCipher(blockCipher);
-                            break;
-                        case CipherMode.GOFB:
-                            blockCipher = new GOfbBlockCipher(blockCipher);
-                            break;
-                        case CipherMode.OCB:
-                            aeadBlockCipher = new OcbBlockCipher(blockCipher, CreateBlockCipher(cipherAlgorithm));
-                            break;
-                        case CipherMode.OFB:
-                        {
-                            int bits = (di < 0)
-                                ?	8 * blockCipher.GetBlockSize()
-                                :	int.Parse(mode.Substring(di));
+                        blockCipher = new CfbBlockCipher(blockCipher, bits);
+                        break;
+                    }
+                    case CipherMode.CTR:
+                        blockCipher = new SicBlockCipher(blockCipher);
+                        break;
+                    case CipherMode.CTS:
+                        cts = true;
+                        blockCipher = new CbcBlockCipher(blockCipher);
+                        break;
+                    case CipherMode.EAX:
+                        aeadBlockCipher = new EaxBlockCipher(blockCipher);
+                        break;
+                    case CipherMode.GCM:
+                        aeadBlockCipher = new GcmBlockCipher(blockCipher);
+                        break;
+                    case CipherMode.GOFB:
+                        blockCipher = new GOfbBlockCipher(blockCipher);
+                        break;
+                    case CipherMode.OCB:
+                        aeadBlockCipher = new OcbBlockCipher(blockCipher, CreateBlockCipher(cipherAlgorithm));
+                        break;
+                    case CipherMode.OFB:
+                    {
+                        int bits = (di < 0)
+                            ?	8 * blockCipher.GetBlockSize()
+                            :	int.Parse(mode.Substring(di));
     
-                            blockCipher = new OfbBlockCipher(blockCipher, bits);
-                            break;
+                        blockCipher = new OfbBlockCipher(blockCipher, bits);
+                        break;
+                    }
+                    case CipherMode.OPENPGPCFB:
+                        blockCipher = new OpenPgpCfbBlockCipher(blockCipher);
+                        break;
+                    case CipherMode.SIC:
+                        if (blockCipher.GetBlockSize() < 16)
+                        {
+                            throw new ArgumentException("Warning: SIC-Mode can become a twotime-pad if the blocksize of the cipher is too small. Use a cipher with a block size of at least 128 bits (e.g. AES)");
                         }
-                        case CipherMode.OPENPGPCFB:
-                            blockCipher = new OpenPgpCfbBlockCipher(blockCipher);
-                            break;
-                        case CipherMode.SIC:
-                            if (blockCipher.GetBlockSize() < 16)
-                            {
-                                throw new ArgumentException("Warning: SIC-Mode can become a twotime-pad if the blocksize of the cipher is too small. Use a cipher with a block size of at least 128 bits (e.g. AES)");
-                            }
-                            blockCipher = new SicBlockCipher(blockCipher);
-                            break;
-                        default:
-                            throw new SecurityUtilityException("Cipher " + algorithm + " not recognised.");
+                        blockCipher = new SicBlockCipher(blockCipher);
+                        break;
+                    default:
+                        throw new SecurityUtilityException("Cipher " + algorithm + " not recognised.");
                     }
                 }
                 catch (ArgumentException)
@@ -783,14 +739,12 @@ namespace Org.BouncyCastle.Security
             throw new SecurityUtilityException("Cipher " + algorithm + " not recognised.");
         }
 
-        public static string GetAlgorithmName(
-            DerObjectIdentifier oid)
+        public static string GetAlgorithmName(DerObjectIdentifier oid)
         {
-            return (string) algorithms[oid.Id];
+            return CollectionUtilities.GetValueOrNull(Algorithms, oid.Id);
         }
 
-        private static int GetDigitIndex(
-            string s)
+        private static int GetDigitIndex(string s)
         {
             for (int i = 0; i < s.Length; ++i)
             {
@@ -805,35 +759,35 @@ namespace Org.BouncyCastle.Security
         {
             switch (cipherAlgorithm)
             {
-                case CipherAlgorithm.AES: return new AesEngine();
-                case CipherAlgorithm.ARIA: return new AriaEngine();
-                case CipherAlgorithm.BLOWFISH: return new BlowfishEngine();
-                case CipherAlgorithm.CAMELLIA: return new CamelliaEngine();
-                case CipherAlgorithm.CAST5: return new Cast5Engine();
-                case CipherAlgorithm.CAST6: return new Cast6Engine();
-                case CipherAlgorithm.DES: return new DesEngine();
-                case CipherAlgorithm.DESEDE: return new DesEdeEngine();
-                case CipherAlgorithm.GOST28147: return new Gost28147Engine();
-                case CipherAlgorithm.IDEA: return new IdeaEngine();
-                case CipherAlgorithm.NOEKEON: return new NoekeonEngine();
-                case CipherAlgorithm.RC2: return new RC2Engine();
-                case CipherAlgorithm.RC5: return new RC532Engine();
-                case CipherAlgorithm.RC5_64: return new RC564Engine();
-                case CipherAlgorithm.RC6: return new RC6Engine();
-                case CipherAlgorithm.RIJNDAEL: return new RijndaelEngine();
-                case CipherAlgorithm.SEED: return new SeedEngine();
-                case CipherAlgorithm.SERPENT: return new SerpentEngine();
-                case CipherAlgorithm.SKIPJACK: return new SkipjackEngine();
-                case CipherAlgorithm.SM4: return new SM4Engine();
-                case CipherAlgorithm.TEA: return new TeaEngine();
-                case CipherAlgorithm.THREEFISH_256: return new ThreefishEngine(ThreefishEngine.BLOCKSIZE_256);
-                case CipherAlgorithm.THREEFISH_512: return new ThreefishEngine(ThreefishEngine.BLOCKSIZE_512);
-                case CipherAlgorithm.THREEFISH_1024: return new ThreefishEngine(ThreefishEngine.BLOCKSIZE_1024);
-                case CipherAlgorithm.TNEPRES: return new TnepresEngine();
-                case CipherAlgorithm.TWOFISH: return new TwofishEngine();
-                case CipherAlgorithm.XTEA: return new XteaEngine();
-                default:
-                    throw new SecurityUtilityException("Cipher " + cipherAlgorithm + " not recognised or not a block cipher");
+            case CipherAlgorithm.AES: return new AesEngine();
+            case CipherAlgorithm.ARIA: return new AriaEngine();
+            case CipherAlgorithm.BLOWFISH: return new BlowfishEngine();
+            case CipherAlgorithm.CAMELLIA: return new CamelliaEngine();
+            case CipherAlgorithm.CAST5: return new Cast5Engine();
+            case CipherAlgorithm.CAST6: return new Cast6Engine();
+            case CipherAlgorithm.DES: return new DesEngine();
+            case CipherAlgorithm.DESEDE: return new DesEdeEngine();
+            case CipherAlgorithm.GOST28147: return new Gost28147Engine();
+            case CipherAlgorithm.IDEA: return new IdeaEngine();
+            case CipherAlgorithm.NOEKEON: return new NoekeonEngine();
+            case CipherAlgorithm.RC2: return new RC2Engine();
+            case CipherAlgorithm.RC5: return new RC532Engine();
+            case CipherAlgorithm.RC5_64: return new RC564Engine();
+            case CipherAlgorithm.RC6: return new RC6Engine();
+            case CipherAlgorithm.RIJNDAEL: return new RijndaelEngine();
+            case CipherAlgorithm.SEED: return new SeedEngine();
+            case CipherAlgorithm.SERPENT: return new SerpentEngine();
+            case CipherAlgorithm.SKIPJACK: return new SkipjackEngine();
+            case CipherAlgorithm.SM4: return new SM4Engine();
+            case CipherAlgorithm.TEA: return new TeaEngine();
+            case CipherAlgorithm.THREEFISH_256: return new ThreefishEngine(ThreefishEngine.BLOCKSIZE_256);
+            case CipherAlgorithm.THREEFISH_512: return new ThreefishEngine(ThreefishEngine.BLOCKSIZE_512);
+            case CipherAlgorithm.THREEFISH_1024: return new ThreefishEngine(ThreefishEngine.BLOCKSIZE_1024);
+            case CipherAlgorithm.TNEPRES: return new TnepresEngine();
+            case CipherAlgorithm.TWOFISH: return new TwofishEngine();
+            case CipherAlgorithm.XTEA: return new XteaEngine();
+            default:
+                throw new SecurityUtilityException("Cipher " + cipherAlgorithm + " not recognised or not a block cipher");
             }
         }
     }
diff --git a/crypto/src/security/DigestUtilities.cs b/crypto/src/security/DigestUtilities.cs
index c67dd8b72..2c9e89277 100644
--- a/crypto/src/security/DigestUtilities.cs
+++ b/crypto/src/security/DigestUtilities.cs
@@ -1,5 +1,5 @@
 using System;
-using System.Collections;
+using System.Collections.Generic;
 
 using Org.BouncyCastle.Asn1;
 using Org.BouncyCastle.Asn1.CryptoPro;
@@ -11,17 +11,17 @@ using Org.BouncyCastle.Asn1.Oiw;
 using Org.BouncyCastle.Asn1.Rosstandart;
 using Org.BouncyCastle.Asn1.TeleTrust;
 using Org.BouncyCastle.Asn1.UA;
-using Org.BouncyCastle.Security;
-using Org.BouncyCastle.Crypto.Digests;
 using Org.BouncyCastle.Crypto;
+using Org.BouncyCastle.Crypto.Digests;
 using Org.BouncyCastle.Utilities;
+using Org.BouncyCastle.Utilities.Collections;
 
 namespace Org.BouncyCastle.Security
 {
     /// <remarks>
     ///  Utility class for creating IDigest objects from their names/Oids
     /// </remarks>
-    public sealed class DigestUtilities
+    public static class DigestUtilities
     {
         private enum DigestAlgorithm {
             BLAKE2B_160, BLAKE2B_256, BLAKE2B_384, BLAKE2B_512,
@@ -42,130 +42,128 @@ namespace Org.BouncyCastle.Security
             WHIRLPOOL,
         };
 
-        private DigestUtilities()
-        {
-        }
-
-        private static readonly IDictionary algorithms = Platform.CreateHashtable();
-        private static readonly IDictionary oids = Platform.CreateHashtable();
+        private static readonly IDictionary<string, string> Aliases =
+            new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
+        private static readonly IDictionary<string, DerObjectIdentifier> Oids =
+            new Dictionary<string, DerObjectIdentifier>(StringComparer.OrdinalIgnoreCase);
 
         static DigestUtilities()
         {
             // Signal to obfuscation tools not to change enum constants
             ((DigestAlgorithm)Enums.GetArbitraryValue(typeof(DigestAlgorithm))).ToString();
 
-            algorithms[PkcsObjectIdentifiers.MD2.Id] = "MD2";
-            algorithms[PkcsObjectIdentifiers.MD4.Id] = "MD4";
-            algorithms[PkcsObjectIdentifiers.MD5.Id] = "MD5";
-
-            algorithms["SHA1"] = "SHA-1";
-            algorithms[OiwObjectIdentifiers.IdSha1.Id] = "SHA-1";
-            algorithms[PkcsObjectIdentifiers.IdHmacWithSha1.Id] = "SHA-1";
-            algorithms[MiscObjectIdentifiers.HMAC_SHA1.Id] = "SHA-1";
-            algorithms["SHA224"] = "SHA-224";
-            algorithms[NistObjectIdentifiers.IdSha224.Id] = "SHA-224";
-            algorithms[PkcsObjectIdentifiers.IdHmacWithSha224.Id] = "SHA-224";
-            algorithms["SHA256"] = "SHA-256";
-            algorithms[NistObjectIdentifiers.IdSha256.Id] = "SHA-256";
-            algorithms[PkcsObjectIdentifiers.IdHmacWithSha256.Id] = "SHA-256";
-            algorithms["SHA384"] = "SHA-384";
-            algorithms[NistObjectIdentifiers.IdSha384.Id] = "SHA-384";
-            algorithms[PkcsObjectIdentifiers.IdHmacWithSha384.Id] = "SHA-384";
-            algorithms["SHA512"] = "SHA-512";
-            algorithms[NistObjectIdentifiers.IdSha512.Id] = "SHA-512";
-            algorithms[PkcsObjectIdentifiers.IdHmacWithSha512.Id] = "SHA-512";
-
-            algorithms["SHA512/224"] = "SHA-512/224";
-            algorithms["SHA512(224)"] = "SHA-512/224";
-            algorithms["SHA-512(224)"] = "SHA-512/224";
-            algorithms[NistObjectIdentifiers.IdSha512_224.Id] = "SHA-512/224";
-            algorithms["SHA512/256"] = "SHA-512/256";
-            algorithms["SHA512(256)"] = "SHA-512/256";
-            algorithms["SHA-512(256)"] = "SHA-512/256";
-            algorithms[NistObjectIdentifiers.IdSha512_256.Id] = "SHA-512/256";
-
-            algorithms["RIPEMD-128"] = "RIPEMD128";
-            algorithms[TeleTrusTObjectIdentifiers.RipeMD128.Id] = "RIPEMD128";
-            algorithms["RIPEMD-160"] = "RIPEMD160";
-            algorithms[TeleTrusTObjectIdentifiers.RipeMD160.Id] = "RIPEMD160";
-            algorithms["RIPEMD-256"] = "RIPEMD256";
-            algorithms[TeleTrusTObjectIdentifiers.RipeMD256.Id] = "RIPEMD256";
-            algorithms["RIPEMD-320"] = "RIPEMD320";
-//			algorithms[TeleTrusTObjectIdentifiers.RipeMD320.Id] = "RIPEMD320";
-
-            algorithms[CryptoProObjectIdentifiers.GostR3411.Id] = "GOST3411";
-
-            algorithms["KECCAK224"] = "KECCAK-224";
-            algorithms["KECCAK256"] = "KECCAK-256";
-            algorithms["KECCAK288"] = "KECCAK-288";
-            algorithms["KECCAK384"] = "KECCAK-384";
-            algorithms["KECCAK512"] = "KECCAK-512";
-
-            algorithms[NistObjectIdentifiers.IdSha3_224.Id] = "SHA3-224";
-            algorithms[NistObjectIdentifiers.IdHMacWithSha3_224.Id] = "SHA3-224";
-            algorithms[NistObjectIdentifiers.IdSha3_256.Id] = "SHA3-256";
-            algorithms[NistObjectIdentifiers.IdHMacWithSha3_256.Id] = "SHA3-256";
-            algorithms[NistObjectIdentifiers.IdSha3_384.Id] = "SHA3-384";
-            algorithms[NistObjectIdentifiers.IdHMacWithSha3_384.Id] = "SHA3-384";
-            algorithms[NistObjectIdentifiers.IdSha3_512.Id] = "SHA3-512";
-            algorithms[NistObjectIdentifiers.IdHMacWithSha3_512.Id] = "SHA3-512";
-            algorithms["SHAKE128"] = "SHAKE128-256";
-            algorithms[NistObjectIdentifiers.IdShake128.Id] = "SHAKE128-256";
-            algorithms["SHAKE256"] = "SHAKE256-512";
-            algorithms[NistObjectIdentifiers.IdShake256.Id] = "SHAKE256-512";
-
-            algorithms[GMObjectIdentifiers.sm3.Id] = "SM3";
-
-            algorithms[MiscObjectIdentifiers.id_blake2b160.Id] = "BLAKE2B-160";
-            algorithms[MiscObjectIdentifiers.id_blake2b256.Id] = "BLAKE2B-256";
-            algorithms[MiscObjectIdentifiers.id_blake2b384.Id] = "BLAKE2B-384";
-            algorithms[MiscObjectIdentifiers.id_blake2b512.Id] = "BLAKE2B-512";
-            algorithms[MiscObjectIdentifiers.id_blake2s128.Id] = "BLAKE2S-128";
-            algorithms[MiscObjectIdentifiers.id_blake2s160.Id] = "BLAKE2S-160";
-            algorithms[MiscObjectIdentifiers.id_blake2s224.Id] = "BLAKE2S-224";
-            algorithms[MiscObjectIdentifiers.id_blake2s256.Id] = "BLAKE2S-256";
-
-            algorithms[RosstandartObjectIdentifiers.id_tc26_gost_3411_12_256.Id] = "GOST3411-2012-256";
-            algorithms[RosstandartObjectIdentifiers.id_tc26_gost_3411_12_512.Id] = "GOST3411-2012-512";
-
-            algorithms[UAObjectIdentifiers.dstu7564digest_256.Id] = "DSTU7564-256";
-            algorithms[UAObjectIdentifiers.dstu7564digest_384.Id] = "DSTU7564-384";
-            algorithms[UAObjectIdentifiers.dstu7564digest_512.Id] = "DSTU7564-512";
-
-            oids["MD2"] = PkcsObjectIdentifiers.MD2;
-            oids["MD4"] = PkcsObjectIdentifiers.MD4;
-            oids["MD5"] = PkcsObjectIdentifiers.MD5;
-            oids["SHA-1"] = OiwObjectIdentifiers.IdSha1;
-            oids["SHA-224"] = NistObjectIdentifiers.IdSha224;
-            oids["SHA-256"] = NistObjectIdentifiers.IdSha256;
-            oids["SHA-384"] = NistObjectIdentifiers.IdSha384;
-            oids["SHA-512"] = NistObjectIdentifiers.IdSha512;
-            oids["SHA-512/224"] = NistObjectIdentifiers.IdSha512_224;
-            oids["SHA-512/256"] = NistObjectIdentifiers.IdSha512_256;
-            oids["SHA3-224"] = NistObjectIdentifiers.IdSha3_224;
-            oids["SHA3-256"] = NistObjectIdentifiers.IdSha3_256;
-            oids["SHA3-384"] = NistObjectIdentifiers.IdSha3_384;
-            oids["SHA3-512"] = NistObjectIdentifiers.IdSha3_512;
-            oids["SHAKE128-256"] = NistObjectIdentifiers.IdShake128;
-            oids["SHAKE256-512"] = NistObjectIdentifiers.IdShake256;
-            oids["RIPEMD128"] = TeleTrusTObjectIdentifiers.RipeMD128;
-            oids["RIPEMD160"] = TeleTrusTObjectIdentifiers.RipeMD160;
-            oids["RIPEMD256"] = TeleTrusTObjectIdentifiers.RipeMD256;
-            oids["GOST3411"] = CryptoProObjectIdentifiers.GostR3411;
-            oids["SM3"] = GMObjectIdentifiers.sm3;
-            oids["BLAKE2B-160"] = MiscObjectIdentifiers.id_blake2b160;
-            oids["BLAKE2B-256"] = MiscObjectIdentifiers.id_blake2b256;
-            oids["BLAKE2B-384"] = MiscObjectIdentifiers.id_blake2b384;
-            oids["BLAKE2B-512"] = MiscObjectIdentifiers.id_blake2b512;
-            oids["BLAKE2S-128"] = MiscObjectIdentifiers.id_blake2s128;
-            oids["BLAKE2S-160"] = MiscObjectIdentifiers.id_blake2s160;
-            oids["BLAKE2S-224"] = MiscObjectIdentifiers.id_blake2s224;
-            oids["BLAKE2S-256"] = MiscObjectIdentifiers.id_blake2s256;
-            oids["GOST3411-2012-256"] = RosstandartObjectIdentifiers.id_tc26_gost_3411_12_256;
-            oids["GOST3411-2012-512"] = RosstandartObjectIdentifiers.id_tc26_gost_3411_12_512;
-            oids["DSTU7564-256"] = UAObjectIdentifiers.dstu7564digest_256;
-            oids["DSTU7564-384"] = UAObjectIdentifiers.dstu7564digest_384;
-            oids["DSTU7564-512"] = UAObjectIdentifiers.dstu7564digest_512;
+            Aliases[PkcsObjectIdentifiers.MD2.Id] = "MD2";
+            Aliases[PkcsObjectIdentifiers.MD4.Id] = "MD4";
+            Aliases[PkcsObjectIdentifiers.MD5.Id] = "MD5";
+
+            Aliases["SHA1"] = "SHA-1";
+            Aliases[OiwObjectIdentifiers.IdSha1.Id] = "SHA-1";
+            Aliases[PkcsObjectIdentifiers.IdHmacWithSha1.Id] = "SHA-1";
+            Aliases[MiscObjectIdentifiers.HMAC_SHA1.Id] = "SHA-1";
+            Aliases["SHA224"] = "SHA-224";
+            Aliases[NistObjectIdentifiers.IdSha224.Id] = "SHA-224";
+            Aliases[PkcsObjectIdentifiers.IdHmacWithSha224.Id] = "SHA-224";
+            Aliases["SHA256"] = "SHA-256";
+            Aliases[NistObjectIdentifiers.IdSha256.Id] = "SHA-256";
+            Aliases[PkcsObjectIdentifiers.IdHmacWithSha256.Id] = "SHA-256";
+            Aliases["SHA384"] = "SHA-384";
+            Aliases[NistObjectIdentifiers.IdSha384.Id] = "SHA-384";
+            Aliases[PkcsObjectIdentifiers.IdHmacWithSha384.Id] = "SHA-384";
+            Aliases["SHA512"] = "SHA-512";
+            Aliases[NistObjectIdentifiers.IdSha512.Id] = "SHA-512";
+            Aliases[PkcsObjectIdentifiers.IdHmacWithSha512.Id] = "SHA-512";
+
+            Aliases["SHA512/224"] = "SHA-512/224";
+            Aliases["SHA512(224)"] = "SHA-512/224";
+            Aliases["SHA-512(224)"] = "SHA-512/224";
+            Aliases[NistObjectIdentifiers.IdSha512_224.Id] = "SHA-512/224";
+            Aliases["SHA512/256"] = "SHA-512/256";
+            Aliases["SHA512(256)"] = "SHA-512/256";
+            Aliases["SHA-512(256)"] = "SHA-512/256";
+            Aliases[NistObjectIdentifiers.IdSha512_256.Id] = "SHA-512/256";
+
+            Aliases["RIPEMD-128"] = "RIPEMD128";
+            Aliases[TeleTrusTObjectIdentifiers.RipeMD128.Id] = "RIPEMD128";
+            Aliases["RIPEMD-160"] = "RIPEMD160";
+            Aliases[TeleTrusTObjectIdentifiers.RipeMD160.Id] = "RIPEMD160";
+            Aliases["RIPEMD-256"] = "RIPEMD256";
+            Aliases[TeleTrusTObjectIdentifiers.RipeMD256.Id] = "RIPEMD256";
+            Aliases["RIPEMD-320"] = "RIPEMD320";
+            //Aliases[TeleTrusTObjectIdentifiers.RipeMD320.Id] = "RIPEMD320";
+
+            Aliases[CryptoProObjectIdentifiers.GostR3411.Id] = "GOST3411";
+
+            Aliases["KECCAK224"] = "KECCAK-224";
+            Aliases["KECCAK256"] = "KECCAK-256";
+            Aliases["KECCAK288"] = "KECCAK-288";
+            Aliases["KECCAK384"] = "KECCAK-384";
+            Aliases["KECCAK512"] = "KECCAK-512";
+
+            Aliases[NistObjectIdentifiers.IdSha3_224.Id] = "SHA3-224";
+            Aliases[NistObjectIdentifiers.IdHMacWithSha3_224.Id] = "SHA3-224";
+            Aliases[NistObjectIdentifiers.IdSha3_256.Id] = "SHA3-256";
+            Aliases[NistObjectIdentifiers.IdHMacWithSha3_256.Id] = "SHA3-256";
+            Aliases[NistObjectIdentifiers.IdSha3_384.Id] = "SHA3-384";
+            Aliases[NistObjectIdentifiers.IdHMacWithSha3_384.Id] = "SHA3-384";
+            Aliases[NistObjectIdentifiers.IdSha3_512.Id] = "SHA3-512";
+            Aliases[NistObjectIdentifiers.IdHMacWithSha3_512.Id] = "SHA3-512";
+            Aliases["SHAKE128"] = "SHAKE128-256";
+            Aliases[NistObjectIdentifiers.IdShake128.Id] = "SHAKE128-256";
+            Aliases["SHAKE256"] = "SHAKE256-512";
+            Aliases[NistObjectIdentifiers.IdShake256.Id] = "SHAKE256-512";
+
+            Aliases[GMObjectIdentifiers.sm3.Id] = "SM3";
+
+            Aliases[MiscObjectIdentifiers.id_blake2b160.Id] = "BLAKE2B-160";
+            Aliases[MiscObjectIdentifiers.id_blake2b256.Id] = "BLAKE2B-256";
+            Aliases[MiscObjectIdentifiers.id_blake2b384.Id] = "BLAKE2B-384";
+            Aliases[MiscObjectIdentifiers.id_blake2b512.Id] = "BLAKE2B-512";
+            Aliases[MiscObjectIdentifiers.id_blake2s128.Id] = "BLAKE2S-128";
+            Aliases[MiscObjectIdentifiers.id_blake2s160.Id] = "BLAKE2S-160";
+            Aliases[MiscObjectIdentifiers.id_blake2s224.Id] = "BLAKE2S-224";
+            Aliases[MiscObjectIdentifiers.id_blake2s256.Id] = "BLAKE2S-256";
+
+            Aliases[RosstandartObjectIdentifiers.id_tc26_gost_3411_12_256.Id] = "GOST3411-2012-256";
+            Aliases[RosstandartObjectIdentifiers.id_tc26_gost_3411_12_512.Id] = "GOST3411-2012-512";
+
+            Aliases[UAObjectIdentifiers.dstu7564digest_256.Id] = "DSTU7564-256";
+            Aliases[UAObjectIdentifiers.dstu7564digest_384.Id] = "DSTU7564-384";
+            Aliases[UAObjectIdentifiers.dstu7564digest_512.Id] = "DSTU7564-512";
+
+            Oids["MD2"] = PkcsObjectIdentifiers.MD2;
+            Oids["MD4"] = PkcsObjectIdentifiers.MD4;
+            Oids["MD5"] = PkcsObjectIdentifiers.MD5;
+            Oids["SHA-1"] = OiwObjectIdentifiers.IdSha1;
+            Oids["SHA-224"] = NistObjectIdentifiers.IdSha224;
+            Oids["SHA-256"] = NistObjectIdentifiers.IdSha256;
+            Oids["SHA-384"] = NistObjectIdentifiers.IdSha384;
+            Oids["SHA-512"] = NistObjectIdentifiers.IdSha512;
+            Oids["SHA-512/224"] = NistObjectIdentifiers.IdSha512_224;
+            Oids["SHA-512/256"] = NistObjectIdentifiers.IdSha512_256;
+            Oids["SHA3-224"] = NistObjectIdentifiers.IdSha3_224;
+            Oids["SHA3-256"] = NistObjectIdentifiers.IdSha3_256;
+            Oids["SHA3-384"] = NistObjectIdentifiers.IdSha3_384;
+            Oids["SHA3-512"] = NistObjectIdentifiers.IdSha3_512;
+            Oids["SHAKE128-256"] = NistObjectIdentifiers.IdShake128;
+            Oids["SHAKE256-512"] = NistObjectIdentifiers.IdShake256;
+            Oids["RIPEMD128"] = TeleTrusTObjectIdentifiers.RipeMD128;
+            Oids["RIPEMD160"] = TeleTrusTObjectIdentifiers.RipeMD160;
+            Oids["RIPEMD256"] = TeleTrusTObjectIdentifiers.RipeMD256;
+            Oids["GOST3411"] = CryptoProObjectIdentifiers.GostR3411;
+            Oids["SM3"] = GMObjectIdentifiers.sm3;
+            Oids["BLAKE2B-160"] = MiscObjectIdentifiers.id_blake2b160;
+            Oids["BLAKE2B-256"] = MiscObjectIdentifiers.id_blake2b256;
+            Oids["BLAKE2B-384"] = MiscObjectIdentifiers.id_blake2b384;
+            Oids["BLAKE2B-512"] = MiscObjectIdentifiers.id_blake2b512;
+            Oids["BLAKE2S-128"] = MiscObjectIdentifiers.id_blake2s128;
+            Oids["BLAKE2S-160"] = MiscObjectIdentifiers.id_blake2s160;
+            Oids["BLAKE2S-224"] = MiscObjectIdentifiers.id_blake2s224;
+            Oids["BLAKE2S-256"] = MiscObjectIdentifiers.id_blake2s256;
+            Oids["GOST3411-2012-256"] = RosstandartObjectIdentifiers.id_tc26_gost_3411_12_256;
+            Oids["GOST3411-2012-512"] = RosstandartObjectIdentifiers.id_tc26_gost_3411_12_512;
+            Oids["DSTU7564-256"] = UAObjectIdentifiers.dstu7564digest_256;
+            Oids["DSTU7564-384"] = UAObjectIdentifiers.dstu7564digest_384;
+            Oids["DSTU7564-512"] = UAObjectIdentifiers.dstu7564digest_512;
         }
 
         /// <summary>
@@ -174,42 +172,27 @@ namespace Org.BouncyCastle.Security
         /// <param name="mechanism">A string representation of the digest meanism.</param>
         /// <returns>A DerObjectIdentifier, null if the Oid is not available.</returns>
 
-        public static DerObjectIdentifier GetObjectIdentifier(
-            string mechanism)
+        public static DerObjectIdentifier GetObjectIdentifier(string mechanism)
         {
             if (mechanism == null)
-                throw new System.ArgumentNullException("mechanism");
-
-            mechanism = Platform.ToUpperInvariant(mechanism);
-            string aliased = (string) algorithms[mechanism];
+                throw new ArgumentNullException(nameof(mechanism));
 
-            if (aliased != null)
-                mechanism = aliased;
+            mechanism = CollectionUtilities.GetValueOrKey(Aliases, mechanism).ToUpperInvariant();
 
-            return (DerObjectIdentifier) oids[mechanism];
+            return CollectionUtilities.GetValueOrNull(Oids, mechanism);
         }
 
-        public static ICollection Algorithms
-        {
-            get { return oids.Keys; }
-        }
-
-        public static IDigest GetDigest(
-            DerObjectIdentifier id)
+        public static IDigest GetDigest(DerObjectIdentifier id)
         {
             return GetDigest(id.Id);
         }
 
-        public static IDigest GetDigest(
-            string algorithm)
+        public static IDigest GetDigest(string algorithm)
         {
-            string upper = Platform.ToUpperInvariant(algorithm);
-            string mechanism = (string) algorithms[upper];
+            if (algorithm == null)
+                throw new ArgumentNullException(nameof(algorithm));
 
-            if (mechanism == null)
-            {
-                mechanism = upper;
-            }
+            string mechanism = CollectionUtilities.GetValueOrKey(Aliases, algorithm).ToUpperInvariant();
 
             try
             {
@@ -218,49 +201,49 @@ namespace Org.BouncyCastle.Security
 
                 switch (digestAlgorithm)
                 {
-                    case DigestAlgorithm.BLAKE2B_160: return new Blake2bDigest(160);
-                    case DigestAlgorithm.BLAKE2B_256: return new Blake2bDigest(256);
-                    case DigestAlgorithm.BLAKE2B_384: return new Blake2bDigest(384);
-                    case DigestAlgorithm.BLAKE2B_512: return new Blake2bDigest(512);
-                    case DigestAlgorithm.BLAKE2S_128: return new Blake2sDigest(128);
-                    case DigestAlgorithm.BLAKE2S_160: return new Blake2sDigest(160);
-                    case DigestAlgorithm.BLAKE2S_224: return new Blake2sDigest(224);
-                    case DigestAlgorithm.BLAKE2S_256: return new Blake2sDigest(256);
-                    case DigestAlgorithm.DSTU7564_256: return new Dstu7564Digest(256);
-                    case DigestAlgorithm.DSTU7564_384: return new Dstu7564Digest(384);
-                    case DigestAlgorithm.DSTU7564_512: return new Dstu7564Digest(512);
-                    case DigestAlgorithm.GOST3411: return new Gost3411Digest();
-                    case DigestAlgorithm.GOST3411_2012_256: return new Gost3411_2012_256Digest();
-                    case DigestAlgorithm.GOST3411_2012_512: return new Gost3411_2012_512Digest();
-                    case DigestAlgorithm.KECCAK_224: return new KeccakDigest(224);
-                    case DigestAlgorithm.KECCAK_256: return new KeccakDigest(256);
-                    case DigestAlgorithm.KECCAK_288: return new KeccakDigest(288);
-                    case DigestAlgorithm.KECCAK_384: return new KeccakDigest(384);
-                    case DigestAlgorithm.KECCAK_512: return new KeccakDigest(512);
-                    case DigestAlgorithm.MD2: return new MD2Digest();
-                    case DigestAlgorithm.MD4: return new MD4Digest();
-                    case DigestAlgorithm.MD5: return new MD5Digest();
-                    case DigestAlgorithm.NONE: return new NullDigest();
-                    case DigestAlgorithm.RIPEMD128: return new RipeMD128Digest();
-                    case DigestAlgorithm.RIPEMD160: return new RipeMD160Digest();
-                    case DigestAlgorithm.RIPEMD256: return new RipeMD256Digest();
-                    case DigestAlgorithm.RIPEMD320: return new RipeMD320Digest();
-                    case DigestAlgorithm.SHA_1: return new Sha1Digest();
-                    case DigestAlgorithm.SHA_224: return new Sha224Digest();
-                    case DigestAlgorithm.SHA_256: return new Sha256Digest();
-                    case DigestAlgorithm.SHA_384: return new Sha384Digest();
-                    case DigestAlgorithm.SHA_512: return new Sha512Digest();
-                    case DigestAlgorithm.SHA_512_224: return new Sha512tDigest(224);
-                    case DigestAlgorithm.SHA_512_256: return new Sha512tDigest(256);
-                    case DigestAlgorithm.SHA3_224: return new Sha3Digest(224);
-                    case DigestAlgorithm.SHA3_256: return new Sha3Digest(256);
-                    case DigestAlgorithm.SHA3_384: return new Sha3Digest(384);
-                    case DigestAlgorithm.SHA3_512: return new Sha3Digest(512);
-                    case DigestAlgorithm.SHAKE128_256: return new ShakeDigest(128);
-                    case DigestAlgorithm.SHAKE256_512: return new ShakeDigest(256);
-                    case DigestAlgorithm.SM3: return new SM3Digest();
-                    case DigestAlgorithm.TIGER: return new TigerDigest();
-                    case DigestAlgorithm.WHIRLPOOL: return new WhirlpoolDigest();
+                case DigestAlgorithm.BLAKE2B_160: return new Blake2bDigest(160);
+                case DigestAlgorithm.BLAKE2B_256: return new Blake2bDigest(256);
+                case DigestAlgorithm.BLAKE2B_384: return new Blake2bDigest(384);
+                case DigestAlgorithm.BLAKE2B_512: return new Blake2bDigest(512);
+                case DigestAlgorithm.BLAKE2S_128: return new Blake2sDigest(128);
+                case DigestAlgorithm.BLAKE2S_160: return new Blake2sDigest(160);
+                case DigestAlgorithm.BLAKE2S_224: return new Blake2sDigest(224);
+                case DigestAlgorithm.BLAKE2S_256: return new Blake2sDigest(256);
+                case DigestAlgorithm.DSTU7564_256: return new Dstu7564Digest(256);
+                case DigestAlgorithm.DSTU7564_384: return new Dstu7564Digest(384);
+                case DigestAlgorithm.DSTU7564_512: return new Dstu7564Digest(512);
+                case DigestAlgorithm.GOST3411: return new Gost3411Digest();
+                case DigestAlgorithm.GOST3411_2012_256: return new Gost3411_2012_256Digest();
+                case DigestAlgorithm.GOST3411_2012_512: return new Gost3411_2012_512Digest();
+                case DigestAlgorithm.KECCAK_224: return new KeccakDigest(224);
+                case DigestAlgorithm.KECCAK_256: return new KeccakDigest(256);
+                case DigestAlgorithm.KECCAK_288: return new KeccakDigest(288);
+                case DigestAlgorithm.KECCAK_384: return new KeccakDigest(384);
+                case DigestAlgorithm.KECCAK_512: return new KeccakDigest(512);
+                case DigestAlgorithm.MD2: return new MD2Digest();
+                case DigestAlgorithm.MD4: return new MD4Digest();
+                case DigestAlgorithm.MD5: return new MD5Digest();
+                case DigestAlgorithm.NONE: return new NullDigest();
+                case DigestAlgorithm.RIPEMD128: return new RipeMD128Digest();
+                case DigestAlgorithm.RIPEMD160: return new RipeMD160Digest();
+                case DigestAlgorithm.RIPEMD256: return new RipeMD256Digest();
+                case DigestAlgorithm.RIPEMD320: return new RipeMD320Digest();
+                case DigestAlgorithm.SHA_1: return new Sha1Digest();
+                case DigestAlgorithm.SHA_224: return new Sha224Digest();
+                case DigestAlgorithm.SHA_256: return new Sha256Digest();
+                case DigestAlgorithm.SHA_384: return new Sha384Digest();
+                case DigestAlgorithm.SHA_512: return new Sha512Digest();
+                case DigestAlgorithm.SHA_512_224: return new Sha512tDigest(224);
+                case DigestAlgorithm.SHA_512_256: return new Sha512tDigest(256);
+                case DigestAlgorithm.SHA3_224: return new Sha3Digest(224);
+                case DigestAlgorithm.SHA3_256: return new Sha3Digest(256);
+                case DigestAlgorithm.SHA3_384: return new Sha3Digest(384);
+                case DigestAlgorithm.SHA3_512: return new Sha3Digest(512);
+                case DigestAlgorithm.SHAKE128_256: return new ShakeDigest(128);
+                case DigestAlgorithm.SHAKE256_512: return new ShakeDigest(256);
+                case DigestAlgorithm.SM3: return new SM3Digest();
+                case DigestAlgorithm.TIGER: return new TigerDigest();
+                case DigestAlgorithm.WHIRLPOOL: return new WhirlpoolDigest();
                 }
             }
             catch (ArgumentException)
@@ -270,10 +253,9 @@ namespace Org.BouncyCastle.Security
             throw new SecurityUtilityException("Digest " + mechanism + " not recognised.");
         }
 
-        public static string GetAlgorithmName(
-            DerObjectIdentifier oid)
+        public static string GetAlgorithmName(DerObjectIdentifier oid)
         {
-            return (string) algorithms[oid.Id];
+            return CollectionUtilities.GetValueOrNull(Aliases, oid.Id);
         }
 
         public static byte[] CalculateDigest(DerObjectIdentifier id, byte[] input)
@@ -288,17 +270,14 @@ namespace Org.BouncyCastle.Security
             return DoFinal(digest);
         }
 
-        public static byte[] DoFinal(
-            IDigest digest)
+        public static byte[] DoFinal(IDigest digest)
         {
             byte[] b = new byte[digest.GetDigestSize()];
             digest.DoFinal(b, 0);
             return b;
         }
 
-        public static byte[] DoFinal(
-            IDigest	digest,
-            byte[]	input)
+        public static byte[] DoFinal(IDigest digest, byte[] input)
         {
             digest.BlockUpdate(input, 0, input.Length);
             return DoFinal(digest);
diff --git a/crypto/src/security/DotNetUtilities.cs b/crypto/src/security/DotNetUtilities.cs
index 0a83ab88c..d37e27abd 100644
--- a/crypto/src/security/DotNetUtilities.cs
+++ b/crypto/src/security/DotNetUtilities.cs
@@ -17,12 +17,8 @@ namespace Org.BouncyCastle.Security
     /// <summary>
     /// A class containing methods to interface the BouncyCastle world to the .NET Crypto world.
     /// </summary>
-    public sealed class DotNetUtilities
+    public static class DotNetUtilities
     {
-        private DotNetUtilities()
-        {
-        }
-
         /// <summary>
         /// Create an System.Security.Cryptography.X509Certificate from an X509Certificate Structure.
         /// </summary>
diff --git a/crypto/src/security/GeneratorUtilities.cs b/crypto/src/security/GeneratorUtilities.cs
index 8f996bcc6..c48a71f2e 100644
--- a/crypto/src/security/GeneratorUtilities.cs
+++ b/crypto/src/security/GeneratorUtilities.cs
@@ -1,4 +1,5 @@
-using System.Collections;
+using System;
+using System.Collections.Generic;
 
 using Org.BouncyCastle.Asn1;
 using Org.BouncyCastle.Asn1.CryptoPro;
@@ -15,18 +16,18 @@ using Org.BouncyCastle.Asn1.X9;
 using Org.BouncyCastle.Crypto;
 using Org.BouncyCastle.Crypto.Generators;
 using Org.BouncyCastle.Utilities;
+using Org.BouncyCastle.Utilities.Collections;
 
 namespace Org.BouncyCastle.Security
 {
-    public sealed class GeneratorUtilities
+    public static class GeneratorUtilities
     {
-        private GeneratorUtilities()
-        {
-        }
-
-        private static readonly IDictionary kgAlgorithms = Platform.CreateHashtable();
-        private static readonly IDictionary kpgAlgorithms = Platform.CreateHashtable();
-        private static readonly IDictionary defaultKeySizes = Platform.CreateHashtable();
+        private static readonly IDictionary<string, string> KgAlgorithms =
+            new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
+        private static readonly IDictionary<string, string> KpgAlgorithms =
+            new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
+        private static readonly IDictionary<string, int> DefaultKeySizes =
+            new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
 
         static GeneratorUtilities()
         {
@@ -263,72 +264,62 @@ namespace Org.BouncyCastle.Security
         {
             foreach (string algorithm in algorithms)
             {
-                defaultKeySizes.Add(algorithm, size);
+                DefaultKeySizes.Add(algorithm, size);
             }
         }
 
-        private static void AddKgAlgorithm(
-            string			canonicalName,
-            params object[] aliases)
+        private static void AddKgAlgorithm(string canonicalName, params object[] aliases)
         {
-            kgAlgorithms[Platform.ToUpperInvariant(canonicalName)] = canonicalName;
+            KgAlgorithms[canonicalName] = canonicalName;
 
             foreach (object alias in aliases)
             {
-                kgAlgorithms[Platform.ToUpperInvariant(alias.ToString())] = canonicalName;
+                KgAlgorithms[alias.ToString()] = canonicalName;
             }
         }
 
-        private static void AddKpgAlgorithm(
-            string			canonicalName,
-            params object[] aliases)
+        private static void AddKpgAlgorithm(string canonicalName, params object[] aliases)
         {
-            kpgAlgorithms[Platform.ToUpperInvariant(canonicalName)] = canonicalName;
+            KpgAlgorithms[canonicalName] = canonicalName;
 
             foreach (object alias in aliases)
             {
-                kpgAlgorithms[Platform.ToUpperInvariant(alias.ToString())] = canonicalName;
+                KpgAlgorithms[alias.ToString()] = canonicalName;
             }
         }
 
-        private static void AddHMacKeyGenerator(
-            string			algorithm,
-            params object[]	aliases)
+        private static void AddHMacKeyGenerator(string algorithm, params object[] aliases)
         {
             string mainName = "HMAC" + algorithm;
 
-            kgAlgorithms[mainName] = mainName;
-            kgAlgorithms["HMAC-" + algorithm] = mainName;
-            kgAlgorithms["HMAC/" + algorithm] = mainName;
+            KgAlgorithms[mainName] = mainName;
+            KgAlgorithms["HMAC-" + algorithm] = mainName;
+            KgAlgorithms["HMAC/" + algorithm] = mainName;
 
             foreach (object alias in aliases)
             {
-                kgAlgorithms[Platform.ToUpperInvariant(alias.ToString())] = mainName;
+                KgAlgorithms[alias.ToString()] = mainName;
             }
         }
 
         // TODO Consider making this public
-        internal static string GetCanonicalKeyGeneratorAlgorithm(
-            string algorithm)
+        internal static string GetCanonicalKeyGeneratorAlgorithm(string algorithm)
         {
-            return (string) kgAlgorithms[Platform.ToUpperInvariant(algorithm)];
+            return CollectionUtilities.GetValueOrNull(KgAlgorithms, algorithm);
         }
 
         // TODO Consider making this public
-        internal static string GetCanonicalKeyPairGeneratorAlgorithm(
-            string algorithm)
+        internal static string GetCanonicalKeyPairGeneratorAlgorithm(string algorithm)
         {
-            return (string)kpgAlgorithms[Platform.ToUpperInvariant(algorithm)];
+            return CollectionUtilities.GetValueOrNull(KpgAlgorithms, algorithm);
         }
 
-        public static CipherKeyGenerator GetKeyGenerator(
-            DerObjectIdentifier oid)
+        public static CipherKeyGenerator GetKeyGenerator(DerObjectIdentifier oid)
         {
             return GetKeyGenerator(oid.Id);
         }
 
-        public static CipherKeyGenerator GetKeyGenerator(
-            string algorithm)
+        public static CipherKeyGenerator GetKeyGenerator(string algorithm)
         {
             string canonicalName = GetCanonicalKeyGeneratorAlgorithm(algorithm);
 
@@ -349,14 +340,12 @@ namespace Org.BouncyCastle.Security
             return new CipherKeyGenerator(defaultKeySize);
         }
 
-        public static IAsymmetricCipherKeyPairGenerator GetKeyPairGenerator(
-            DerObjectIdentifier oid)
+        public static IAsymmetricCipherKeyPairGenerator GetKeyPairGenerator(DerObjectIdentifier oid)
         {
             return GetKeyPairGenerator(oid.Id);
         }
 
-        public static IAsymmetricCipherKeyPairGenerator GetKeyPairGenerator(
-            string algorithm)
+        public static IAsymmetricCipherKeyPairGenerator GetKeyPairGenerator(string algorithm)
         {
             string canonicalName = GetCanonicalKeyPairGeneratorAlgorithm(algorithm);
 
@@ -398,14 +387,12 @@ namespace Org.BouncyCastle.Security
                 + " (" + canonicalName + ") not supported.");
         }
 
-        internal static int GetDefaultKeySize(
-            DerObjectIdentifier oid)
+        internal static int GetDefaultKeySize(DerObjectIdentifier oid)
         {
             return GetDefaultKeySize(oid.Id);
         }
 
-        internal static int GetDefaultKeySize(
-            string algorithm)
+        internal static int GetDefaultKeySize(string algorithm)
         {
             string canonicalName = GetCanonicalKeyGeneratorAlgorithm(algorithm);
 
@@ -420,13 +407,9 @@ namespace Org.BouncyCastle.Security
             return defaultKeySize;
         }
 
-        private static int FindDefaultKeySize(
-            string canonicalName)
+        private static int FindDefaultKeySize(string canonicalName)
         {
-            if (!defaultKeySizes.Contains(canonicalName))
-                return -1;
-
-            return (int)defaultKeySizes[canonicalName];
+            return DefaultKeySizes.TryGetValue(canonicalName, out int keySize) ? keySize : -1;
         }
     }
 }
diff --git a/crypto/src/security/MacUtilities.cs b/crypto/src/security/MacUtilities.cs
index f36fc6ae4..f9f586d29 100644
--- a/crypto/src/security/MacUtilities.cs
+++ b/crypto/src/security/MacUtilities.cs
@@ -1,6 +1,5 @@
 using System;
-using System.Collections;
-using System.Globalization;
+using System.Collections.Generic;
 
 using Org.BouncyCastle.Asn1;
 using Org.BouncyCastle.Asn1.Iana;
@@ -13,118 +12,86 @@ using Org.BouncyCastle.Crypto.Engines;
 using Org.BouncyCastle.Crypto.Macs;
 using Org.BouncyCastle.Crypto.Paddings;
 using Org.BouncyCastle.Utilities;
+using Org.BouncyCastle.Utilities.Collections;
 
 namespace Org.BouncyCastle.Security
 {
     /// <remarks>
     ///  Utility class for creating HMac object from their names/Oids
     /// </remarks>
-    public sealed class MacUtilities
+    public static class MacUtilities
     {
-        private MacUtilities()
-        {
-        }
-
-        private static readonly IDictionary algorithms = Platform.CreateHashtable();
-        //private static readonly IDictionary oids = Platform.CreateHashtable();
+        private static readonly IDictionary<string, string> Algorithms =
+            new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
 
         static MacUtilities()
         {
-            algorithms[IanaObjectIdentifiers.HmacMD5.Id] = "HMAC-MD5";
-            algorithms[IanaObjectIdentifiers.HmacRipeMD160.Id] = "HMAC-RIPEMD160";
-            algorithms[IanaObjectIdentifiers.HmacSha1.Id] = "HMAC-SHA1";
-            algorithms[IanaObjectIdentifiers.HmacTiger.Id] = "HMAC-TIGER";
-
-            algorithms[PkcsObjectIdentifiers.IdHmacWithSha1.Id] = "HMAC-SHA1";
-            algorithms[MiscObjectIdentifiers.HMAC_SHA1.Id] = "HMAC-SHA1";
-            algorithms[PkcsObjectIdentifiers.IdHmacWithSha224.Id] = "HMAC-SHA224";
-            algorithms[PkcsObjectIdentifiers.IdHmacWithSha256.Id] = "HMAC-SHA256";
-            algorithms[PkcsObjectIdentifiers.IdHmacWithSha384.Id] = "HMAC-SHA384";
-            algorithms[PkcsObjectIdentifiers.IdHmacWithSha512.Id] = "HMAC-SHA512";
-
-            algorithms[NistObjectIdentifiers.IdHMacWithSha3_224.Id] = "HMAC-SHA3-224";
-            algorithms[NistObjectIdentifiers.IdHMacWithSha3_256.Id] = "HMAC-SHA3-256";
-            algorithms[NistObjectIdentifiers.IdHMacWithSha3_384.Id] = "HMAC-SHA3-384";
-            algorithms[NistObjectIdentifiers.IdHMacWithSha3_512.Id] = "HMAC-SHA3-512";
-
-            algorithms[RosstandartObjectIdentifiers.id_tc26_hmac_gost_3411_12_256.Id] = "HMAC-GOST3411-2012-256";
-            algorithms[RosstandartObjectIdentifiers.id_tc26_hmac_gost_3411_12_512.Id] = "HMAC-GOST3411-2012-512";
+            Algorithms[IanaObjectIdentifiers.HmacMD5.Id] = "HMAC-MD5";
+            Algorithms[IanaObjectIdentifiers.HmacRipeMD160.Id] = "HMAC-RIPEMD160";
+            Algorithms[IanaObjectIdentifiers.HmacSha1.Id] = "HMAC-SHA1";
+            Algorithms[IanaObjectIdentifiers.HmacTiger.Id] = "HMAC-TIGER";
+
+            Algorithms[PkcsObjectIdentifiers.IdHmacWithSha1.Id] = "HMAC-SHA1";
+            Algorithms[MiscObjectIdentifiers.HMAC_SHA1.Id] = "HMAC-SHA1";
+            Algorithms[PkcsObjectIdentifiers.IdHmacWithSha224.Id] = "HMAC-SHA224";
+            Algorithms[PkcsObjectIdentifiers.IdHmacWithSha256.Id] = "HMAC-SHA256";
+            Algorithms[PkcsObjectIdentifiers.IdHmacWithSha384.Id] = "HMAC-SHA384";
+            Algorithms[PkcsObjectIdentifiers.IdHmacWithSha512.Id] = "HMAC-SHA512";
+
+            Algorithms[NistObjectIdentifiers.IdHMacWithSha3_224.Id] = "HMAC-SHA3-224";
+            Algorithms[NistObjectIdentifiers.IdHMacWithSha3_256.Id] = "HMAC-SHA3-256";
+            Algorithms[NistObjectIdentifiers.IdHMacWithSha3_384.Id] = "HMAC-SHA3-384";
+            Algorithms[NistObjectIdentifiers.IdHMacWithSha3_512.Id] = "HMAC-SHA3-512";
+
+            Algorithms[RosstandartObjectIdentifiers.id_tc26_hmac_gost_3411_12_256.Id] = "HMAC-GOST3411-2012-256";
+            Algorithms[RosstandartObjectIdentifiers.id_tc26_hmac_gost_3411_12_512.Id] = "HMAC-GOST3411-2012-512";
 
             // TODO AESMAC?
 
-            algorithms["DES"] = "DESMAC";
-            algorithms["DES/CFB8"] = "DESMAC/CFB8";
-            algorithms["DES64"] = "DESMAC64";
-            algorithms["DESEDE"] = "DESEDEMAC";
-            algorithms[PkcsObjectIdentifiers.DesEde3Cbc.Id] = "DESEDEMAC";
-            algorithms["DESEDE/CFB8"] = "DESEDEMAC/CFB8";
-            algorithms["DESISO9797MAC"] = "DESWITHISO9797";
-            algorithms["DESEDE64"] = "DESEDEMAC64";
-
-            algorithms["DESEDE64WITHISO7816-4PADDING"] = "DESEDEMAC64WITHISO7816-4PADDING";
-            algorithms["DESEDEISO9797ALG1MACWITHISO7816-4PADDING"] = "DESEDEMAC64WITHISO7816-4PADDING";
-            algorithms["DESEDEISO9797ALG1WITHISO7816-4PADDING"] = "DESEDEMAC64WITHISO7816-4PADDING";
-
-            algorithms["ISO9797ALG3"] = "ISO9797ALG3MAC";
-            algorithms["ISO9797ALG3MACWITHISO7816-4PADDING"] = "ISO9797ALG3WITHISO7816-4PADDING";
-
-            algorithms["SKIPJACK"] = "SKIPJACKMAC";
-            algorithms["SKIPJACK/CFB8"] = "SKIPJACKMAC/CFB8";
-            algorithms["IDEA"] = "IDEAMAC";
-            algorithms["IDEA/CFB8"] = "IDEAMAC/CFB8";
-            algorithms["RC2"] = "RC2MAC";
-            algorithms["RC2/CFB8"] = "RC2MAC/CFB8";
-            algorithms["RC5"] = "RC5MAC";
-            algorithms["RC5/CFB8"] = "RC5MAC/CFB8";
-            algorithms["GOST28147"] = "GOST28147MAC";
-            algorithms["VMPC"] = "VMPCMAC";
-            algorithms["VMPC-MAC"] = "VMPCMAC";
-            algorithms["SIPHASH"] = "SIPHASH-2-4";
-
-            algorithms["PBEWITHHMACSHA"] = "PBEWITHHMACSHA1";
-            algorithms["1.3.14.3.2.26"] = "PBEWITHHMACSHA1";
+            Algorithms["DES"] = "DESMAC";
+            Algorithms["DES/CFB8"] = "DESMAC/CFB8";
+            Algorithms["DES64"] = "DESMAC64";
+            Algorithms["DESEDE"] = "DESEDEMAC";
+            Algorithms[PkcsObjectIdentifiers.DesEde3Cbc.Id] = "DESEDEMAC";
+            Algorithms["DESEDE/CFB8"] = "DESEDEMAC/CFB8";
+            Algorithms["DESISO9797MAC"] = "DESWITHISO9797";
+            Algorithms["DESEDE64"] = "DESEDEMAC64";
+
+            Algorithms["DESEDE64WITHISO7816-4PADDING"] = "DESEDEMAC64WITHISO7816-4PADDING";
+            Algorithms["DESEDEISO9797ALG1MACWITHISO7816-4PADDING"] = "DESEDEMAC64WITHISO7816-4PADDING";
+            Algorithms["DESEDEISO9797ALG1WITHISO7816-4PADDING"] = "DESEDEMAC64WITHISO7816-4PADDING";
+
+            Algorithms["ISO9797ALG3"] = "ISO9797ALG3MAC";
+            Algorithms["ISO9797ALG3MACWITHISO7816-4PADDING"] = "ISO9797ALG3WITHISO7816-4PADDING";
+
+            Algorithms["SKIPJACK"] = "SKIPJACKMAC";
+            Algorithms["SKIPJACK/CFB8"] = "SKIPJACKMAC/CFB8";
+            Algorithms["IDEA"] = "IDEAMAC";
+            Algorithms["IDEA/CFB8"] = "IDEAMAC/CFB8";
+            Algorithms["RC2"] = "RC2MAC";
+            Algorithms["RC2/CFB8"] = "RC2MAC/CFB8";
+            Algorithms["RC5"] = "RC5MAC";
+            Algorithms["RC5/CFB8"] = "RC5MAC/CFB8";
+            Algorithms["GOST28147"] = "GOST28147MAC";
+            Algorithms["VMPC"] = "VMPCMAC";
+            Algorithms["VMPC-MAC"] = "VMPCMAC";
+            Algorithms["SIPHASH"] = "SIPHASH-2-4";
+
+            Algorithms["PBEWITHHMACSHA"] = "PBEWITHHMACSHA1";
+            Algorithms["1.3.14.3.2.26"] = "PBEWITHHMACSHA1";
         }
 
-//		/// <summary>
-//		/// Returns a ObjectIdentifier for a given digest mechanism.
-//		/// </summary>
-//		/// <param name="mechanism">A string representation of the digest meanism.</param>
-//		/// <returns>A DerObjectIdentifier, null if the Oid is not available.</returns>
-//		public static DerObjectIdentifier GetObjectIdentifier(
-//			string mechanism)
-//		{
-//			mechanism = (string) algorithms[Platform.ToUpperInvariant(mechanism)];
-//
-//			if (mechanism != null)
-//			{
-//				return (DerObjectIdentifier)oids[mechanism];
-//			}
-//
-//			return null;
-//		}
-
-//		public static ICollection Algorithms
-//		{
-//			get { return oids.Keys; }
-//		}
-
-        public static IMac GetMac(
-            DerObjectIdentifier id)
+        public static IMac GetMac(DerObjectIdentifier id)
         {
             return GetMac(id.Id);
         }
 
-        public static IMac GetMac(
-            string algorithm)
+        public static IMac GetMac(string algorithm)
         {
-            string upper = Platform.ToUpperInvariant(algorithm);
+            if (algorithm == null)
+                throw new ArgumentNullException(nameof(algorithm));
 
-            string mechanism = (string) algorithms[upper];
-
-            if (mechanism == null)
-            {
-                mechanism = upper;
-            }
+            string mechanism = CollectionUtilities.GetValueOrKey(Algorithms, algorithm).ToUpperInvariant();
 
             if (Platform.StartsWith(mechanism, "PBEWITH"))
             {
@@ -238,10 +205,9 @@ namespace Org.BouncyCastle.Security
             throw new SecurityUtilityException("Mac " + mechanism + " not recognised.");
         }
 
-        public static string GetAlgorithmName(
-            DerObjectIdentifier oid)
+        public static string GetAlgorithmName(DerObjectIdentifier oid)
         {
-            return (string) algorithms[oid.Id];
+            return CollectionUtilities.GetValueOrNull(Algorithms, oid.Id);
         }
 
         public static byte[] CalculateMac(string algorithm, ICipherParameters cp, byte[] input)
diff --git a/crypto/src/security/ParameterUtilities.cs b/crypto/src/security/ParameterUtilities.cs
index fdb8d86be..5a407fc9d 100644
--- a/crypto/src/security/ParameterUtilities.cs
+++ b/crypto/src/security/ParameterUtilities.cs
@@ -1,5 +1,5 @@
 using System;
-using System.Collections;
+using System.Collections.Generic;
 
 using Org.BouncyCastle.Asn1;
 using Org.BouncyCastle.Asn1.CryptoPro;
@@ -12,18 +12,16 @@ using Org.BouncyCastle.Asn1.Oiw;
 using Org.BouncyCastle.Asn1.Pkcs;
 using Org.BouncyCastle.Crypto;
 using Org.BouncyCastle.Crypto.Parameters;
-using Org.BouncyCastle.Utilities;
+using Org.BouncyCastle.Utilities.Collections;
 
 namespace Org.BouncyCastle.Security
 {
-    public sealed class ParameterUtilities
+    public static class ParameterUtilities
     {
-        private ParameterUtilities()
-        {
-        }
-
-        private static readonly IDictionary algorithms = Platform.CreateHashtable();
-        private static readonly IDictionary basicIVSizes = Platform.CreateHashtable();
+        private static readonly IDictionary<string, string> Algorithms =
+            new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
+        private static readonly IDictionary<string, int> BasicIVSizes =
+            new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
 
         static ParameterUtilities()
         {
@@ -164,15 +162,13 @@ namespace Org.BouncyCastle.Security
             // "RIJNDAEL", "SKIPJACK", "TWOFISH"
         }
 
-        private static void AddAlgorithm(
-            string			canonicalName,
-            params object[]	aliases)
+        private static void AddAlgorithm(string canonicalName, params object[] aliases)
         {
-            algorithms[canonicalName] = canonicalName;
+            Algorithms[canonicalName] = canonicalName;
 
             foreach (object alias in aliases)
             {
-                algorithms[alias.ToString()] = canonicalName;
+                Algorithms[alias.ToString()] = canonicalName;
             }
         }
 
@@ -180,26 +176,21 @@ namespace Org.BouncyCastle.Security
         {
             foreach (string algorithm in algorithms)
             {
-                basicIVSizes.Add(algorithm, size);
+                BasicIVSizes.Add(algorithm, size);
             }
         }
 
-        public static string GetCanonicalAlgorithmName(
-            string algorithm)
+        public static string GetCanonicalAlgorithmName(string algorithm)
         {
-            return (string) algorithms[Platform.ToUpperInvariant(algorithm)];
+            return CollectionUtilities.GetValueOrNull(Algorithms, algorithm);
         }
 
-        public static KeyParameter CreateKeyParameter(
-            DerObjectIdentifier algOid,
-            byte[]				keyBytes)
+        public static KeyParameter CreateKeyParameter(DerObjectIdentifier algOid, byte[] keyBytes)
         {
             return CreateKeyParameter(algOid.Id, keyBytes, 0, keyBytes.Length);
         }
 
-        public static KeyParameter CreateKeyParameter(
-            string	algorithm,
-            byte[]	keyBytes)
+        public static KeyParameter CreateKeyParameter(string algorithm, byte[] keyBytes)
         {
             return CreateKeyParameter(algorithm, keyBytes, 0, keyBytes.Length);
         }
@@ -220,7 +211,7 @@ namespace Org.BouncyCastle.Security
             int		length)
         {
             if (algorithm == null)
-                throw new ArgumentNullException("algorithm");
+                throw new ArgumentNullException(nameof(algorithm));
 
             string canonical = GetCanonicalAlgorithmName(algorithm);
 
@@ -348,9 +339,7 @@ namespace Org.BouncyCastle.Security
             return cp;
         }
 
-        private static Asn1OctetString CreateIVOctetString(
-            SecureRandom	random,
-            int				ivLength)
+        private static Asn1OctetString CreateIVOctetString(SecureRandom random, int ivLength)
         {
             return new DerOctetString(CreateIV(random, ivLength));
         }
@@ -360,13 +349,9 @@ namespace Org.BouncyCastle.Security
             return SecureRandom.GetNextBytes(random, ivLength);
         }
 
-        private static int FindBasicIVSize(
-            string canonicalName)
+        private static int FindBasicIVSize(string canonicalName)
         {
-            if (!basicIVSizes.Contains(canonicalName))
-                return -1;
-
-            return (int)basicIVSizes[canonicalName];
+            return BasicIVSizes.TryGetValue(canonicalName, out int keySize) ? keySize : -1;
         }
     }
 }
diff --git a/crypto/src/security/PbeUtilities.cs b/crypto/src/security/PbeUtilities.cs
index 622c6dd43..4121ddd7d 100644
--- a/crypto/src/security/PbeUtilities.cs
+++ b/crypto/src/security/PbeUtilities.cs
@@ -1,5 +1,5 @@
 using System;
-using System.Collections;
+using System.Collections.Generic;
 
 using Org.BouncyCastle.Asn1;
 using Org.BouncyCastle.Asn1.BC;
@@ -10,40 +10,36 @@ using Org.BouncyCastle.Asn1.TeleTrust;
 using Org.BouncyCastle.Asn1.X509;
 using Org.BouncyCastle.Crypto;
 using Org.BouncyCastle.Crypto.Digests;
-using Org.BouncyCastle.Crypto.Engines;
 using Org.BouncyCastle.Crypto.Generators;
-using Org.BouncyCastle.Crypto.Macs;
-using Org.BouncyCastle.Crypto.Modes;
-using Org.BouncyCastle.Crypto.Paddings;
 using Org.BouncyCastle.Crypto.Parameters;
 using Org.BouncyCastle.Utilities;
+using Org.BouncyCastle.Utilities.Collections;
 
 namespace Org.BouncyCastle.Security
 {
     /// <summary>
     ///
     /// </summary>
-    public sealed class PbeUtilities
+    public static class PbeUtilities
     {
-        private PbeUtilities()
-        {
-        }
-
         const string Pkcs5S1 = "Pkcs5S1";
         const string Pkcs5S2 = "Pkcs5S2";
         const string Pkcs12 = "Pkcs12";
         const string OpenSsl = "OpenSsl";
 
-        private static readonly IDictionary algorithms = Platform.CreateHashtable();
-        private static readonly IDictionary algorithmType = Platform.CreateHashtable();
-        private static readonly IDictionary oids = Platform.CreateHashtable();
+        private static readonly IDictionary<string, string> Algorithms =
+            new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
+        private static readonly IDictionary<string, string> AlgorithmType =
+            new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
+        private static readonly IDictionary<string, DerObjectIdentifier> Oids =
+            new Dictionary<string, DerObjectIdentifier>(StringComparer.OrdinalIgnoreCase);
 
         static PbeUtilities()
         {
-            algorithms["PKCS5SCHEME1"] = "Pkcs5scheme1";
-            algorithms["PKCS5SCHEME2"] = "Pkcs5scheme2";
-            algorithms["PBKDF2"] = "Pkcs5scheme2";
-            algorithms[PkcsObjectIdentifiers.IdPbeS2.Id] = "Pkcs5scheme2";
+            Algorithms["PKCS5SCHEME1"] = "Pkcs5scheme1";
+            Algorithms["PKCS5SCHEME2"] = "Pkcs5scheme2";
+            Algorithms["PBKDF2"] = "Pkcs5scheme2";
+            Algorithms[PkcsObjectIdentifiers.IdPbeS2.Id] = "Pkcs5scheme2";
 //			algorithms[PkcsObjectIdentifiers.IdPbkdf2.Id] = "Pkcs5scheme2";
 
             // FIXME Add support for these? (see Pkcs8Generator)
@@ -52,155 +48,155 @@ namespace Org.BouncyCastle.Security
 //			algorithms[NistObjectIdentifiers.IdAes192Cbc.Id] = "Pkcs5scheme2";
 //			algorithms[NistObjectIdentifiers.IdAes256Cbc.Id] = "Pkcs5scheme2";
 
-            algorithms["PBEWITHMD2ANDDES-CBC"] = "PBEwithMD2andDES-CBC";
-            algorithms[PkcsObjectIdentifiers.PbeWithMD2AndDesCbc.Id] = "PBEwithMD2andDES-CBC";
-            algorithms["PBEWITHMD2ANDRC2-CBC"] = "PBEwithMD2andRC2-CBC";
-            algorithms[PkcsObjectIdentifiers.PbeWithMD2AndRC2Cbc.Id] = "PBEwithMD2andRC2-CBC";
-            algorithms["PBEWITHMD5ANDDES-CBC"] = "PBEwithMD5andDES-CBC";
-            algorithms[PkcsObjectIdentifiers.PbeWithMD5AndDesCbc.Id] = "PBEwithMD5andDES-CBC";
-            algorithms["PBEWITHMD5ANDRC2-CBC"] = "PBEwithMD5andRC2-CBC";
-            algorithms[PkcsObjectIdentifiers.PbeWithMD5AndRC2Cbc.Id] = "PBEwithMD5andRC2-CBC";
-            algorithms["PBEWITHSHA1ANDDES"] = "PBEwithSHA-1andDES-CBC";
-            algorithms["PBEWITHSHA-1ANDDES"] = "PBEwithSHA-1andDES-CBC";
-            algorithms["PBEWITHSHA1ANDDES-CBC"] = "PBEwithSHA-1andDES-CBC";
-            algorithms["PBEWITHSHA-1ANDDES-CBC"] = "PBEwithSHA-1andDES-CBC";
-            algorithms[PkcsObjectIdentifiers.PbeWithSha1AndDesCbc.Id] = "PBEwithSHA-1andDES-CBC";
-            algorithms["PBEWITHSHA1ANDRC2"] = "PBEwithSHA-1andRC2-CBC";
-            algorithms["PBEWITHSHA-1ANDRC2"] = "PBEwithSHA-1andRC2-CBC";
-            algorithms["PBEWITHSHA1ANDRC2-CBC"] = "PBEwithSHA-1andRC2-CBC";
-            algorithms["PBEWITHSHA-1ANDRC2-CBC"] = "PBEwithSHA-1andRC2-CBC";
-            algorithms[PkcsObjectIdentifiers.PbeWithSha1AndRC2Cbc.Id] = "PBEwithSHA-1andRC2-CBC";
-            algorithms["PKCS12"] = "Pkcs12";
-            algorithms[BCObjectIdentifiers.bc_pbe_sha1_pkcs12_aes128_cbc.Id] = "PBEwithSHA-1and128bitAES-CBC-BC";
-            algorithms[BCObjectIdentifiers.bc_pbe_sha1_pkcs12_aes192_cbc.Id] = "PBEwithSHA-1and192bitAES-CBC-BC";
-            algorithms[BCObjectIdentifiers.bc_pbe_sha1_pkcs12_aes256_cbc.Id] = "PBEwithSHA-1and256bitAES-CBC-BC";
-            algorithms[BCObjectIdentifiers.bc_pbe_sha256_pkcs12_aes128_cbc.Id] = "PBEwithSHA-256and128bitAES-CBC-BC";
-            algorithms[BCObjectIdentifiers.bc_pbe_sha256_pkcs12_aes192_cbc.Id] = "PBEwithSHA-256and192bitAES-CBC-BC";
-            algorithms[BCObjectIdentifiers.bc_pbe_sha256_pkcs12_aes256_cbc.Id] = "PBEwithSHA-256and256bitAES-CBC-BC";
-            algorithms["PBEWITHSHAAND128BITRC4"] = "PBEwithSHA-1and128bitRC4";
-            algorithms["PBEWITHSHA1AND128BITRC4"] = "PBEwithSHA-1and128bitRC4";
-            algorithms["PBEWITHSHA-1AND128BITRC4"] = "PBEwithSHA-1and128bitRC4";
-            algorithms[PkcsObjectIdentifiers.PbeWithShaAnd128BitRC4.Id] = "PBEwithSHA-1and128bitRC4";
-            algorithms["PBEWITHSHAAND40BITRC4"] = "PBEwithSHA-1and40bitRC4";
-            algorithms["PBEWITHSHA1AND40BITRC4"] = "PBEwithSHA-1and40bitRC4";
-            algorithms["PBEWITHSHA-1AND40BITRC4"] = "PBEwithSHA-1and40bitRC4";
-            algorithms[PkcsObjectIdentifiers.PbeWithShaAnd40BitRC4.Id] = "PBEwithSHA-1and40bitRC4";
-            algorithms["PBEWITHSHAAND3-KEYDESEDE-CBC"] = "PBEwithSHA-1and3-keyDESEDE-CBC";
-            algorithms["PBEWITHSHAAND3-KEYTRIPLEDES-CBC"] = "PBEwithSHA-1and3-keyDESEDE-CBC";
-            algorithms["PBEWITHSHA1AND3-KEYDESEDE-CBC"] = "PBEwithSHA-1and3-keyDESEDE-CBC";
-            algorithms["PBEWITHSHA1AND3-KEYTRIPLEDES-CBC"] = "PBEwithSHA-1and3-keyDESEDE-CBC";
-            algorithms["PBEWITHSHA-1AND3-KEYDESEDE-CBC"] = "PBEwithSHA-1and3-keyDESEDE-CBC";
-            algorithms["PBEWITHSHA-1AND3-KEYTRIPLEDES-CBC"] = "PBEwithSHA-1and3-keyDESEDE-CBC";
-            algorithms[PkcsObjectIdentifiers.PbeWithShaAnd3KeyTripleDesCbc.Id] = "PBEwithSHA-1and3-keyDESEDE-CBC";
-            algorithms["PBEWITHSHAAND2-KEYDESEDE-CBC"] = "PBEwithSHA-1and2-keyDESEDE-CBC";
-            algorithms["PBEWITHSHAAND2-KEYTRIPLEDES-CBC"] = "PBEwithSHA-1and2-keyDESEDE-CBC";
-            algorithms["PBEWITHSHA1AND2-KEYDESEDE-CBC"] = "PBEwithSHA-1and2-keyDESEDE-CBC";
-            algorithms["PBEWITHSHA1AND2-KEYTRIPLEDES-CBC"] = "PBEwithSHA-1and2-keyDESEDE-CBC";
-            algorithms["PBEWITHSHA-1AND2-KEYDESEDE-CBC"] = "PBEwithSHA-1and2-keyDESEDE-CBC";
-            algorithms["PBEWITHSHA-1AND2-KEYTRIPLEDES-CBC"] = "PBEwithSHA-1and2-keyDESEDE-CBC";
-            algorithms[PkcsObjectIdentifiers.PbeWithShaAnd2KeyTripleDesCbc.Id] = "PBEwithSHA-1and2-keyDESEDE-CBC";
-            algorithms["PBEWITHSHAAND128BITRC2-CBC"] = "PBEwithSHA-1and128bitRC2-CBC";
-            algorithms["PBEWITHSHA1AND128BITRC2-CBC"] = "PBEwithSHA-1and128bitRC2-CBC";
-            algorithms["PBEWITHSHA-1AND128BITRC2-CBC"] = "PBEwithSHA-1and128bitRC2-CBC";
-            algorithms[PkcsObjectIdentifiers.PbeWithShaAnd128BitRC2Cbc.Id] = "PBEwithSHA-1and128bitRC2-CBC";
-            algorithms["PBEWITHSHAAND40BITRC2-CBC"] = "PBEwithSHA-1and40bitRC2-CBC";
-            algorithms["PBEWITHSHA1AND40BITRC2-CBC"] = "PBEwithSHA-1and40bitRC2-CBC";
-            algorithms["PBEWITHSHA-1AND40BITRC2-CBC"] = "PBEwithSHA-1and40bitRC2-CBC";
-            algorithms[PkcsObjectIdentifiers.PbewithShaAnd40BitRC2Cbc.Id] = "PBEwithSHA-1and40bitRC2-CBC";
-            algorithms["PBEWITHSHAAND128BITAES-CBC-BC"] = "PBEwithSHA-1and128bitAES-CBC-BC";
-            algorithms["PBEWITHSHA1AND128BITAES-CBC-BC"] = "PBEwithSHA-1and128bitAES-CBC-BC";
-            algorithms["PBEWITHSHA-1AND128BITAES-CBC-BC"] = "PBEwithSHA-1and128bitAES-CBC-BC";
-            algorithms["PBEWITHSHAAND192BITAES-CBC-BC"] = "PBEwithSHA-1and192bitAES-CBC-BC";
-            algorithms["PBEWITHSHA1AND192BITAES-CBC-BC"] = "PBEwithSHA-1and192bitAES-CBC-BC";
-            algorithms["PBEWITHSHA-1AND192BITAES-CBC-BC"] = "PBEwithSHA-1and192bitAES-CBC-BC";
-            algorithms["PBEWITHSHAAND256BITAES-CBC-BC"] = "PBEwithSHA-1and256bitAES-CBC-BC";
-            algorithms["PBEWITHSHA1AND256BITAES-CBC-BC"] = "PBEwithSHA-1and256bitAES-CBC-BC";
-            algorithms["PBEWITHSHA-1AND256BITAES-CBC-BC"] = "PBEwithSHA-1and256bitAES-CBC-BC";
-            algorithms["PBEWITHSHA256AND128BITAES-CBC-BC"] = "PBEwithSHA-256and128bitAES-CBC-BC";
-            algorithms["PBEWITHSHA-256AND128BITAES-CBC-BC"] = "PBEwithSHA-256and128bitAES-CBC-BC";
-            algorithms["PBEWITHSHA256AND192BITAES-CBC-BC"] = "PBEwithSHA-256and192bitAES-CBC-BC";
-            algorithms["PBEWITHSHA-256AND192BITAES-CBC-BC"] = "PBEwithSHA-256and192bitAES-CBC-BC";
-            algorithms["PBEWITHSHA256AND256BITAES-CBC-BC"] = "PBEwithSHA-256and256bitAES-CBC-BC";
-            algorithms["PBEWITHSHA-256AND256BITAES-CBC-BC"] = "PBEwithSHA-256and256bitAES-CBC-BC";
-            algorithms["PBEWITHSHAANDIDEA"] = "PBEwithSHA-1andIDEA-CBC";
-            algorithms["PBEWITHSHAANDIDEA-CBC"] = "PBEwithSHA-1andIDEA-CBC";
-            algorithms["PBEWITHSHAANDTWOFISH"] = "PBEwithSHA-1andTWOFISH-CBC";
-            algorithms["PBEWITHSHAANDTWOFISH-CBC"] = "PBEwithSHA-1andTWOFISH-CBC";
-            algorithms["PBEWITHHMACSHA1"] = "PBEwithHmacSHA-1";
-            algorithms["PBEWITHHMACSHA-1"] = "PBEwithHmacSHA-1";
-            algorithms[OiwObjectIdentifiers.IdSha1.Id] = "PBEwithHmacSHA-1";
-            algorithms["PBEWITHHMACSHA224"] = "PBEwithHmacSHA-224";
-            algorithms["PBEWITHHMACSHA-224"] = "PBEwithHmacSHA-224";
-            algorithms[NistObjectIdentifiers.IdSha224.Id] = "PBEwithHmacSHA-224";
-            algorithms["PBEWITHHMACSHA256"] = "PBEwithHmacSHA-256";
-            algorithms["PBEWITHHMACSHA-256"] = "PBEwithHmacSHA-256";
-            algorithms[NistObjectIdentifiers.IdSha256.Id] = "PBEwithHmacSHA-256";
-            algorithms["PBEWITHHMACRIPEMD128"] = "PBEwithHmacRipeMD128";
-            algorithms[TeleTrusTObjectIdentifiers.RipeMD128.Id] = "PBEwithHmacRipeMD128";
-            algorithms["PBEWITHHMACRIPEMD160"] = "PBEwithHmacRipeMD160";
-            algorithms[TeleTrusTObjectIdentifiers.RipeMD160.Id] = "PBEwithHmacRipeMD160";
-            algorithms["PBEWITHHMACRIPEMD256"] = "PBEwithHmacRipeMD256";
-            algorithms[TeleTrusTObjectIdentifiers.RipeMD256.Id] = "PBEwithHmacRipeMD256";
-            algorithms["PBEWITHHMACTIGER"] = "PBEwithHmacTiger";
-
-            algorithms["PBEWITHMD5AND128BITAES-CBC-OPENSSL"] = "PBEwithMD5and128bitAES-CBC-OpenSSL";
-            algorithms["PBEWITHMD5AND192BITAES-CBC-OPENSSL"] = "PBEwithMD5and192bitAES-CBC-OpenSSL";
-            algorithms["PBEWITHMD5AND256BITAES-CBC-OPENSSL"] = "PBEwithMD5and256bitAES-CBC-OpenSSL";
-
-            algorithmType["Pkcs5scheme1"] = Pkcs5S1;
-            algorithmType["Pkcs5scheme2"] = Pkcs5S2;
-            algorithmType["PBEwithMD2andDES-CBC"] = Pkcs5S1;
-            algorithmType["PBEwithMD2andRC2-CBC"] = Pkcs5S1;
-            algorithmType["PBEwithMD5andDES-CBC"] = Pkcs5S1;
-            algorithmType["PBEwithMD5andRC2-CBC"] = Pkcs5S1;
-            algorithmType["PBEwithSHA-1andDES-CBC"] = Pkcs5S1;
-            algorithmType["PBEwithSHA-1andRC2-CBC"] = Pkcs5S1;
-            algorithmType["Pkcs12"] = Pkcs12;
-            algorithmType["PBEwithSHA-1and128bitRC4"] = Pkcs12;
-            algorithmType["PBEwithSHA-1and40bitRC4"] = Pkcs12;
-            algorithmType["PBEwithSHA-1and3-keyDESEDE-CBC"] = Pkcs12;
-            algorithmType["PBEwithSHA-1and2-keyDESEDE-CBC"] = Pkcs12;
-            algorithmType["PBEwithSHA-1and128bitRC2-CBC"] = Pkcs12;
-            algorithmType["PBEwithSHA-1and40bitRC2-CBC"] = Pkcs12;
-            algorithmType["PBEwithSHA-1and128bitAES-CBC-BC"] = Pkcs12;
-            algorithmType["PBEwithSHA-1and192bitAES-CBC-BC"] = Pkcs12;
-            algorithmType["PBEwithSHA-1and256bitAES-CBC-BC"] = Pkcs12;
-            algorithmType["PBEwithSHA-256and128bitAES-CBC-BC"] = Pkcs12;
-            algorithmType["PBEwithSHA-256and192bitAES-CBC-BC"] = Pkcs12;
-            algorithmType["PBEwithSHA-256and256bitAES-CBC-BC"] = Pkcs12;
-            algorithmType["PBEwithSHA-1andIDEA-CBC"] = Pkcs12;
-            algorithmType["PBEwithSHA-1andTWOFISH-CBC"] = Pkcs12;
-            algorithmType["PBEwithHmacSHA-1"] = Pkcs12;
-            algorithmType["PBEwithHmacSHA-224"] = Pkcs12;
-            algorithmType["PBEwithHmacSHA-256"] = Pkcs12;
-            algorithmType["PBEwithHmacRipeMD128"] = Pkcs12;
-            algorithmType["PBEwithHmacRipeMD160"] = Pkcs12;
-            algorithmType["PBEwithHmacRipeMD256"] = Pkcs12;
-            algorithmType["PBEwithHmacTiger"] = Pkcs12;
-
-            algorithmType["PBEwithMD5and128bitAES-CBC-OpenSSL"] = OpenSsl;
-            algorithmType["PBEwithMD5and192bitAES-CBC-OpenSSL"] = OpenSsl;
-            algorithmType["PBEwithMD5and256bitAES-CBC-OpenSSL"] = OpenSsl;
-
-            oids["PBEwithMD2andDES-CBC"] = PkcsObjectIdentifiers.PbeWithMD2AndDesCbc;
-            oids["PBEwithMD2andRC2-CBC"] = PkcsObjectIdentifiers.PbeWithMD2AndRC2Cbc;
-            oids["PBEwithMD5andDES-CBC"] = PkcsObjectIdentifiers.PbeWithMD5AndDesCbc;
-            oids["PBEwithMD5andRC2-CBC"] = PkcsObjectIdentifiers.PbeWithMD5AndRC2Cbc;
-            oids["PBEwithSHA-1andDES-CBC"] = PkcsObjectIdentifiers.PbeWithSha1AndDesCbc;
-            oids["PBEwithSHA-1andRC2-CBC"] = PkcsObjectIdentifiers.PbeWithSha1AndRC2Cbc;
-            oids["PBEwithSHA-1and128bitRC4"] = PkcsObjectIdentifiers.PbeWithShaAnd128BitRC4;
-            oids["PBEwithSHA-1and40bitRC4"] = PkcsObjectIdentifiers.PbeWithShaAnd40BitRC4;
-            oids["PBEwithSHA-1and3-keyDESEDE-CBC"] = PkcsObjectIdentifiers.PbeWithShaAnd3KeyTripleDesCbc;
-            oids["PBEwithSHA-1and2-keyDESEDE-CBC"] = PkcsObjectIdentifiers.PbeWithShaAnd2KeyTripleDesCbc;
-            oids["PBEwithSHA-1and128bitRC2-CBC"] = PkcsObjectIdentifiers.PbeWithShaAnd128BitRC2Cbc;
-            oids["PBEwithSHA-1and40bitRC2-CBC"] = PkcsObjectIdentifiers.PbewithShaAnd40BitRC2Cbc;
-            oids["PBEwithHmacSHA-1"] = OiwObjectIdentifiers.IdSha1;
-            oids["PBEwithHmacSHA-224"] = NistObjectIdentifiers.IdSha224;
-            oids["PBEwithHmacSHA-256"] = NistObjectIdentifiers.IdSha256;
-            oids["PBEwithHmacRipeMD128"] = TeleTrusTObjectIdentifiers.RipeMD128;
-            oids["PBEwithHmacRipeMD160"] = TeleTrusTObjectIdentifiers.RipeMD160;
-            oids["PBEwithHmacRipeMD256"] = TeleTrusTObjectIdentifiers.RipeMD256;
-            oids["Pkcs5scheme2"] = PkcsObjectIdentifiers.IdPbeS2;
+            Algorithms["PBEWITHMD2ANDDES-CBC"] = "PBEwithMD2andDES-CBC";
+            Algorithms[PkcsObjectIdentifiers.PbeWithMD2AndDesCbc.Id] = "PBEwithMD2andDES-CBC";
+            Algorithms["PBEWITHMD2ANDRC2-CBC"] = "PBEwithMD2andRC2-CBC";
+            Algorithms[PkcsObjectIdentifiers.PbeWithMD2AndRC2Cbc.Id] = "PBEwithMD2andRC2-CBC";
+            Algorithms["PBEWITHMD5ANDDES-CBC"] = "PBEwithMD5andDES-CBC";
+            Algorithms[PkcsObjectIdentifiers.PbeWithMD5AndDesCbc.Id] = "PBEwithMD5andDES-CBC";
+            Algorithms["PBEWITHMD5ANDRC2-CBC"] = "PBEwithMD5andRC2-CBC";
+            Algorithms[PkcsObjectIdentifiers.PbeWithMD5AndRC2Cbc.Id] = "PBEwithMD5andRC2-CBC";
+            Algorithms["PBEWITHSHA1ANDDES"] = "PBEwithSHA-1andDES-CBC";
+            Algorithms["PBEWITHSHA-1ANDDES"] = "PBEwithSHA-1andDES-CBC";
+            Algorithms["PBEWITHSHA1ANDDES-CBC"] = "PBEwithSHA-1andDES-CBC";
+            Algorithms["PBEWITHSHA-1ANDDES-CBC"] = "PBEwithSHA-1andDES-CBC";
+            Algorithms[PkcsObjectIdentifiers.PbeWithSha1AndDesCbc.Id] = "PBEwithSHA-1andDES-CBC";
+            Algorithms["PBEWITHSHA1ANDRC2"] = "PBEwithSHA-1andRC2-CBC";
+            Algorithms["PBEWITHSHA-1ANDRC2"] = "PBEwithSHA-1andRC2-CBC";
+            Algorithms["PBEWITHSHA1ANDRC2-CBC"] = "PBEwithSHA-1andRC2-CBC";
+            Algorithms["PBEWITHSHA-1ANDRC2-CBC"] = "PBEwithSHA-1andRC2-CBC";
+            Algorithms[PkcsObjectIdentifiers.PbeWithSha1AndRC2Cbc.Id] = "PBEwithSHA-1andRC2-CBC";
+            Algorithms["PKCS12"] = "Pkcs12";
+            Algorithms[BCObjectIdentifiers.bc_pbe_sha1_pkcs12_aes128_cbc.Id] = "PBEwithSHA-1and128bitAES-CBC-BC";
+            Algorithms[BCObjectIdentifiers.bc_pbe_sha1_pkcs12_aes192_cbc.Id] = "PBEwithSHA-1and192bitAES-CBC-BC";
+            Algorithms[BCObjectIdentifiers.bc_pbe_sha1_pkcs12_aes256_cbc.Id] = "PBEwithSHA-1and256bitAES-CBC-BC";
+            Algorithms[BCObjectIdentifiers.bc_pbe_sha256_pkcs12_aes128_cbc.Id] = "PBEwithSHA-256and128bitAES-CBC-BC";
+            Algorithms[BCObjectIdentifiers.bc_pbe_sha256_pkcs12_aes192_cbc.Id] = "PBEwithSHA-256and192bitAES-CBC-BC";
+            Algorithms[BCObjectIdentifiers.bc_pbe_sha256_pkcs12_aes256_cbc.Id] = "PBEwithSHA-256and256bitAES-CBC-BC";
+            Algorithms["PBEWITHSHAAND128BITRC4"] = "PBEwithSHA-1and128bitRC4";
+            Algorithms["PBEWITHSHA1AND128BITRC4"] = "PBEwithSHA-1and128bitRC4";
+            Algorithms["PBEWITHSHA-1AND128BITRC4"] = "PBEwithSHA-1and128bitRC4";
+            Algorithms[PkcsObjectIdentifiers.PbeWithShaAnd128BitRC4.Id] = "PBEwithSHA-1and128bitRC4";
+            Algorithms["PBEWITHSHAAND40BITRC4"] = "PBEwithSHA-1and40bitRC4";
+            Algorithms["PBEWITHSHA1AND40BITRC4"] = "PBEwithSHA-1and40bitRC4";
+            Algorithms["PBEWITHSHA-1AND40BITRC4"] = "PBEwithSHA-1and40bitRC4";
+            Algorithms[PkcsObjectIdentifiers.PbeWithShaAnd40BitRC4.Id] = "PBEwithSHA-1and40bitRC4";
+            Algorithms["PBEWITHSHAAND3-KEYDESEDE-CBC"] = "PBEwithSHA-1and3-keyDESEDE-CBC";
+            Algorithms["PBEWITHSHAAND3-KEYTRIPLEDES-CBC"] = "PBEwithSHA-1and3-keyDESEDE-CBC";
+            Algorithms["PBEWITHSHA1AND3-KEYDESEDE-CBC"] = "PBEwithSHA-1and3-keyDESEDE-CBC";
+            Algorithms["PBEWITHSHA1AND3-KEYTRIPLEDES-CBC"] = "PBEwithSHA-1and3-keyDESEDE-CBC";
+            Algorithms["PBEWITHSHA-1AND3-KEYDESEDE-CBC"] = "PBEwithSHA-1and3-keyDESEDE-CBC";
+            Algorithms["PBEWITHSHA-1AND3-KEYTRIPLEDES-CBC"] = "PBEwithSHA-1and3-keyDESEDE-CBC";
+            Algorithms[PkcsObjectIdentifiers.PbeWithShaAnd3KeyTripleDesCbc.Id] = "PBEwithSHA-1and3-keyDESEDE-CBC";
+            Algorithms["PBEWITHSHAAND2-KEYDESEDE-CBC"] = "PBEwithSHA-1and2-keyDESEDE-CBC";
+            Algorithms["PBEWITHSHAAND2-KEYTRIPLEDES-CBC"] = "PBEwithSHA-1and2-keyDESEDE-CBC";
+            Algorithms["PBEWITHSHA1AND2-KEYDESEDE-CBC"] = "PBEwithSHA-1and2-keyDESEDE-CBC";
+            Algorithms["PBEWITHSHA1AND2-KEYTRIPLEDES-CBC"] = "PBEwithSHA-1and2-keyDESEDE-CBC";
+            Algorithms["PBEWITHSHA-1AND2-KEYDESEDE-CBC"] = "PBEwithSHA-1and2-keyDESEDE-CBC";
+            Algorithms["PBEWITHSHA-1AND2-KEYTRIPLEDES-CBC"] = "PBEwithSHA-1and2-keyDESEDE-CBC";
+            Algorithms[PkcsObjectIdentifiers.PbeWithShaAnd2KeyTripleDesCbc.Id] = "PBEwithSHA-1and2-keyDESEDE-CBC";
+            Algorithms["PBEWITHSHAAND128BITRC2-CBC"] = "PBEwithSHA-1and128bitRC2-CBC";
+            Algorithms["PBEWITHSHA1AND128BITRC2-CBC"] = "PBEwithSHA-1and128bitRC2-CBC";
+            Algorithms["PBEWITHSHA-1AND128BITRC2-CBC"] = "PBEwithSHA-1and128bitRC2-CBC";
+            Algorithms[PkcsObjectIdentifiers.PbeWithShaAnd128BitRC2Cbc.Id] = "PBEwithSHA-1and128bitRC2-CBC";
+            Algorithms["PBEWITHSHAAND40BITRC2-CBC"] = "PBEwithSHA-1and40bitRC2-CBC";
+            Algorithms["PBEWITHSHA1AND40BITRC2-CBC"] = "PBEwithSHA-1and40bitRC2-CBC";
+            Algorithms["PBEWITHSHA-1AND40BITRC2-CBC"] = "PBEwithSHA-1and40bitRC2-CBC";
+            Algorithms[PkcsObjectIdentifiers.PbewithShaAnd40BitRC2Cbc.Id] = "PBEwithSHA-1and40bitRC2-CBC";
+            Algorithms["PBEWITHSHAAND128BITAES-CBC-BC"] = "PBEwithSHA-1and128bitAES-CBC-BC";
+            Algorithms["PBEWITHSHA1AND128BITAES-CBC-BC"] = "PBEwithSHA-1and128bitAES-CBC-BC";
+            Algorithms["PBEWITHSHA-1AND128BITAES-CBC-BC"] = "PBEwithSHA-1and128bitAES-CBC-BC";
+            Algorithms["PBEWITHSHAAND192BITAES-CBC-BC"] = "PBEwithSHA-1and192bitAES-CBC-BC";
+            Algorithms["PBEWITHSHA1AND192BITAES-CBC-BC"] = "PBEwithSHA-1and192bitAES-CBC-BC";
+            Algorithms["PBEWITHSHA-1AND192BITAES-CBC-BC"] = "PBEwithSHA-1and192bitAES-CBC-BC";
+            Algorithms["PBEWITHSHAAND256BITAES-CBC-BC"] = "PBEwithSHA-1and256bitAES-CBC-BC";
+            Algorithms["PBEWITHSHA1AND256BITAES-CBC-BC"] = "PBEwithSHA-1and256bitAES-CBC-BC";
+            Algorithms["PBEWITHSHA-1AND256BITAES-CBC-BC"] = "PBEwithSHA-1and256bitAES-CBC-BC";
+            Algorithms["PBEWITHSHA256AND128BITAES-CBC-BC"] = "PBEwithSHA-256and128bitAES-CBC-BC";
+            Algorithms["PBEWITHSHA-256AND128BITAES-CBC-BC"] = "PBEwithSHA-256and128bitAES-CBC-BC";
+            Algorithms["PBEWITHSHA256AND192BITAES-CBC-BC"] = "PBEwithSHA-256and192bitAES-CBC-BC";
+            Algorithms["PBEWITHSHA-256AND192BITAES-CBC-BC"] = "PBEwithSHA-256and192bitAES-CBC-BC";
+            Algorithms["PBEWITHSHA256AND256BITAES-CBC-BC"] = "PBEwithSHA-256and256bitAES-CBC-BC";
+            Algorithms["PBEWITHSHA-256AND256BITAES-CBC-BC"] = "PBEwithSHA-256and256bitAES-CBC-BC";
+            Algorithms["PBEWITHSHAANDIDEA"] = "PBEwithSHA-1andIDEA-CBC";
+            Algorithms["PBEWITHSHAANDIDEA-CBC"] = "PBEwithSHA-1andIDEA-CBC";
+            Algorithms["PBEWITHSHAANDTWOFISH"] = "PBEwithSHA-1andTWOFISH-CBC";
+            Algorithms["PBEWITHSHAANDTWOFISH-CBC"] = "PBEwithSHA-1andTWOFISH-CBC";
+            Algorithms["PBEWITHHMACSHA1"] = "PBEwithHmacSHA-1";
+            Algorithms["PBEWITHHMACSHA-1"] = "PBEwithHmacSHA-1";
+            Algorithms[OiwObjectIdentifiers.IdSha1.Id] = "PBEwithHmacSHA-1";
+            Algorithms["PBEWITHHMACSHA224"] = "PBEwithHmacSHA-224";
+            Algorithms["PBEWITHHMACSHA-224"] = "PBEwithHmacSHA-224";
+            Algorithms[NistObjectIdentifiers.IdSha224.Id] = "PBEwithHmacSHA-224";
+            Algorithms["PBEWITHHMACSHA256"] = "PBEwithHmacSHA-256";
+            Algorithms["PBEWITHHMACSHA-256"] = "PBEwithHmacSHA-256";
+            Algorithms[NistObjectIdentifiers.IdSha256.Id] = "PBEwithHmacSHA-256";
+            Algorithms["PBEWITHHMACRIPEMD128"] = "PBEwithHmacRipeMD128";
+            Algorithms[TeleTrusTObjectIdentifiers.RipeMD128.Id] = "PBEwithHmacRipeMD128";
+            Algorithms["PBEWITHHMACRIPEMD160"] = "PBEwithHmacRipeMD160";
+            Algorithms[TeleTrusTObjectIdentifiers.RipeMD160.Id] = "PBEwithHmacRipeMD160";
+            Algorithms["PBEWITHHMACRIPEMD256"] = "PBEwithHmacRipeMD256";
+            Algorithms[TeleTrusTObjectIdentifiers.RipeMD256.Id] = "PBEwithHmacRipeMD256";
+            Algorithms["PBEWITHHMACTIGER"] = "PBEwithHmacTiger";
+
+            Algorithms["PBEWITHMD5AND128BITAES-CBC-OPENSSL"] = "PBEwithMD5and128bitAES-CBC-OpenSSL";
+            Algorithms["PBEWITHMD5AND192BITAES-CBC-OPENSSL"] = "PBEwithMD5and192bitAES-CBC-OpenSSL";
+            Algorithms["PBEWITHMD5AND256BITAES-CBC-OPENSSL"] = "PBEwithMD5and256bitAES-CBC-OpenSSL";
+
+            AlgorithmType["Pkcs5scheme1"] = Pkcs5S1;
+            AlgorithmType["Pkcs5scheme2"] = Pkcs5S2;
+            AlgorithmType["PBEwithMD2andDES-CBC"] = Pkcs5S1;
+            AlgorithmType["PBEwithMD2andRC2-CBC"] = Pkcs5S1;
+            AlgorithmType["PBEwithMD5andDES-CBC"] = Pkcs5S1;
+            AlgorithmType["PBEwithMD5andRC2-CBC"] = Pkcs5S1;
+            AlgorithmType["PBEwithSHA-1andDES-CBC"] = Pkcs5S1;
+            AlgorithmType["PBEwithSHA-1andRC2-CBC"] = Pkcs5S1;
+            AlgorithmType["Pkcs12"] = Pkcs12;
+            AlgorithmType["PBEwithSHA-1and128bitRC4"] = Pkcs12;
+            AlgorithmType["PBEwithSHA-1and40bitRC4"] = Pkcs12;
+            AlgorithmType["PBEwithSHA-1and3-keyDESEDE-CBC"] = Pkcs12;
+            AlgorithmType["PBEwithSHA-1and2-keyDESEDE-CBC"] = Pkcs12;
+            AlgorithmType["PBEwithSHA-1and128bitRC2-CBC"] = Pkcs12;
+            AlgorithmType["PBEwithSHA-1and40bitRC2-CBC"] = Pkcs12;
+            AlgorithmType["PBEwithSHA-1and128bitAES-CBC-BC"] = Pkcs12;
+            AlgorithmType["PBEwithSHA-1and192bitAES-CBC-BC"] = Pkcs12;
+            AlgorithmType["PBEwithSHA-1and256bitAES-CBC-BC"] = Pkcs12;
+            AlgorithmType["PBEwithSHA-256and128bitAES-CBC-BC"] = Pkcs12;
+            AlgorithmType["PBEwithSHA-256and192bitAES-CBC-BC"] = Pkcs12;
+            AlgorithmType["PBEwithSHA-256and256bitAES-CBC-BC"] = Pkcs12;
+            AlgorithmType["PBEwithSHA-1andIDEA-CBC"] = Pkcs12;
+            AlgorithmType["PBEwithSHA-1andTWOFISH-CBC"] = Pkcs12;
+            AlgorithmType["PBEwithHmacSHA-1"] = Pkcs12;
+            AlgorithmType["PBEwithHmacSHA-224"] = Pkcs12;
+            AlgorithmType["PBEwithHmacSHA-256"] = Pkcs12;
+            AlgorithmType["PBEwithHmacRipeMD128"] = Pkcs12;
+            AlgorithmType["PBEwithHmacRipeMD160"] = Pkcs12;
+            AlgorithmType["PBEwithHmacRipeMD256"] = Pkcs12;
+            AlgorithmType["PBEwithHmacTiger"] = Pkcs12;
+
+            AlgorithmType["PBEwithMD5and128bitAES-CBC-OpenSSL"] = OpenSsl;
+            AlgorithmType["PBEwithMD5and192bitAES-CBC-OpenSSL"] = OpenSsl;
+            AlgorithmType["PBEwithMD5and256bitAES-CBC-OpenSSL"] = OpenSsl;
+
+            Oids["PBEwithMD2andDES-CBC"] = PkcsObjectIdentifiers.PbeWithMD2AndDesCbc;
+            Oids["PBEwithMD2andRC2-CBC"] = PkcsObjectIdentifiers.PbeWithMD2AndRC2Cbc;
+            Oids["PBEwithMD5andDES-CBC"] = PkcsObjectIdentifiers.PbeWithMD5AndDesCbc;
+            Oids["PBEwithMD5andRC2-CBC"] = PkcsObjectIdentifiers.PbeWithMD5AndRC2Cbc;
+            Oids["PBEwithSHA-1andDES-CBC"] = PkcsObjectIdentifiers.PbeWithSha1AndDesCbc;
+            Oids["PBEwithSHA-1andRC2-CBC"] = PkcsObjectIdentifiers.PbeWithSha1AndRC2Cbc;
+            Oids["PBEwithSHA-1and128bitRC4"] = PkcsObjectIdentifiers.PbeWithShaAnd128BitRC4;
+            Oids["PBEwithSHA-1and40bitRC4"] = PkcsObjectIdentifiers.PbeWithShaAnd40BitRC4;
+            Oids["PBEwithSHA-1and3-keyDESEDE-CBC"] = PkcsObjectIdentifiers.PbeWithShaAnd3KeyTripleDesCbc;
+            Oids["PBEwithSHA-1and2-keyDESEDE-CBC"] = PkcsObjectIdentifiers.PbeWithShaAnd2KeyTripleDesCbc;
+            Oids["PBEwithSHA-1and128bitRC2-CBC"] = PkcsObjectIdentifiers.PbeWithShaAnd128BitRC2Cbc;
+            Oids["PBEwithSHA-1and40bitRC2-CBC"] = PkcsObjectIdentifiers.PbewithShaAnd40BitRC2Cbc;
+            Oids["PBEwithHmacSHA-1"] = OiwObjectIdentifiers.IdSha1;
+            Oids["PBEwithHmacSHA-224"] = NistObjectIdentifiers.IdSha224;
+            Oids["PBEwithHmacSHA-256"] = NistObjectIdentifiers.IdSha256;
+            Oids["PBEwithHmacRipeMD128"] = TeleTrusTObjectIdentifiers.RipeMD128;
+            Oids["PBEwithHmacRipeMD160"] = TeleTrusTObjectIdentifiers.RipeMD160;
+            Oids["PBEwithHmacRipeMD256"] = TeleTrusTObjectIdentifiers.RipeMD256;
+            Oids["Pkcs5scheme2"] = PkcsObjectIdentifiers.IdPbeS2;
         }
 
         static PbeParametersGenerator MakePbeGenerator(
@@ -242,60 +238,65 @@ namespace Org.BouncyCastle.Security
         /// </summary>
         /// <param name="mechanism">A string representation of the encoding.</param>
         /// <returns>A DerObjectIdentifier, null if the Oid is not available.</returns>
-        public static DerObjectIdentifier GetObjectIdentifier(
-            string mechanism)
+        public static DerObjectIdentifier GetObjectIdentifier(string mechanism)
         {
-            mechanism = (string) algorithms[Platform.ToUpperInvariant(mechanism)];
-            if (mechanism != null)
-            {
-                return (DerObjectIdentifier)oids[mechanism];
-            }
-            return null;
-        }
+            if (!Algorithms.TryGetValue(mechanism, out var algorithm))
+                return null;
 
-        public static ICollection Algorithms
-        {
-            get { return oids.Keys; }
+            return CollectionUtilities.GetValueOrNull(Oids, algorithm);
         }
 
-        public static bool IsPkcs12(
-            string algorithm)
+        //public static ICollection Algorithms
+        //{
+        //    get { return oids.Keys; }
+        //}
+
+        public static bool IsPkcs12(string algorithm)
         {
-            string mechanism = (string)algorithms[Platform.ToUpperInvariant(algorithm)];
+            if (!Algorithms.TryGetValue(algorithm, out var mechanism))
+                return false;
+            if (!AlgorithmType.TryGetValue(mechanism, out var algorithmType))
+                return false;
 
-            return mechanism != null && Pkcs12.Equals(algorithmType[mechanism]);
+            return Pkcs12.Equals(algorithmType);
         }
 
-        public static bool IsPkcs5Scheme1(
-            string algorithm)
+        public static bool IsPkcs5Scheme1(string algorithm)
         {
-            string mechanism = (string)algorithms[Platform.ToUpperInvariant(algorithm)];
+            if (!Algorithms.TryGetValue(algorithm, out var mechanism))
+                return false;
+            if (!AlgorithmType.TryGetValue(mechanism, out var algorithmType))
+                return false;
 
-            return mechanism != null && Pkcs5S1.Equals(algorithmType[mechanism]);
+            return Pkcs5S1.Equals(algorithmType);
         }
 
-        public static bool IsPkcs5Scheme2(
-            string algorithm)
+        public static bool IsPkcs5Scheme2(string algorithm)
         {
-            string mechanism = (string)algorithms[Platform.ToUpperInvariant(algorithm)];
+            if (!Algorithms.TryGetValue(algorithm, out var mechanism))
+                return false;
+            if (!AlgorithmType.TryGetValue(mechanism, out var algorithmType))
+                return false;
 
-            return mechanism != null && Pkcs5S2.Equals(algorithmType[mechanism]);
+            return Pkcs5S2.Equals(algorithmType);
         }
 
-        public static bool IsOpenSsl(
-            string algorithm)
+        public static bool IsOpenSsl(string algorithm)
         {
-            string mechanism = (string)algorithms[Platform.ToUpperInvariant(algorithm)];
+            if (!Algorithms.TryGetValue(algorithm, out var mechanism))
+                return false;
+            if (!AlgorithmType.TryGetValue(mechanism, out var algorithmType))
+                return false;
 
-            return mechanism != null && OpenSsl.Equals(algorithmType[mechanism]);
+            return OpenSsl.Equals(algorithmType);
         }
 
-        public static bool IsPbeAlgorithm(
-            string algorithm)
+        public static bool IsPbeAlgorithm(string algorithm)
         {
-            string mechanism = (string)algorithms[Platform.ToUpperInvariant(algorithm)];
+            if (!Algorithms.TryGetValue(algorithm, out var mechanism))
+                return false;
 
-            return mechanism != null && algorithmType[mechanism] != null;
+            return AlgorithmType.ContainsKey(mechanism);
         }
 
         public static Asn1Encodable GenerateAlgorithmParameters(
@@ -400,7 +401,7 @@ namespace Org.BouncyCastle.Security
             bool			wrongPkcs12Zero,
             Asn1Encodable   pbeParameters)
         {
-            string mechanism = (string)algorithms[Platform.ToUpperInvariant(algorithm)];
+            string mechanism = CollectionUtilities.GetValueOrNull(Algorithms, algorithm);
 
             byte[] keyBytes = null;
             byte[] salt = null;
@@ -457,7 +458,7 @@ namespace Org.BouncyCastle.Security
                     :	GeneratorUtilities.GetDefaultKeySize(encOid);
 
                 PbeParametersGenerator gen = MakePbeGenerator(
-                    (string)algorithmType[mechanism], digest, keyBytes, salt, iterationCount);
+                    AlgorithmType[mechanism], digest, keyBytes, salt, iterationCount);
 
                 parameters = gen.GenerateDerivedParameters(encOid.Id, keyLength);
 
@@ -477,7 +478,7 @@ namespace Org.BouncyCastle.Security
             else if (Platform.StartsWith(mechanism, "PBEwithSHA-1"))
             {
                 PbeParametersGenerator generator = MakePbeGenerator(
-                    (string) algorithmType[mechanism], new Sha1Digest(), keyBytes, salt, iterationCount);
+                    AlgorithmType[mechanism], new Sha1Digest(), keyBytes, salt, iterationCount);
 
                 if (mechanism.Equals("PBEwithSHA-1and128bitAES-CBC-BC"))
                 {
@@ -527,7 +528,7 @@ namespace Org.BouncyCastle.Security
             else if (Platform.StartsWith(mechanism, "PBEwithSHA-256"))
             {
                 PbeParametersGenerator generator = MakePbeGenerator(
-                    (string) algorithmType[mechanism], new Sha256Digest(), keyBytes, salt, iterationCount);
+                    AlgorithmType[mechanism], new Sha256Digest(), keyBytes, salt, iterationCount);
 
                 if (mechanism.Equals("PBEwithSHA-256and128bitAES-CBC-BC"))
                 {
@@ -545,7 +546,7 @@ namespace Org.BouncyCastle.Security
             else if (Platform.StartsWith(mechanism, "PBEwithMD5"))
             {
                 PbeParametersGenerator generator = MakePbeGenerator(
-                    (string)algorithmType[mechanism], new MD5Digest(), keyBytes, salt, iterationCount);
+                    AlgorithmType[mechanism], new MD5Digest(), keyBytes, salt, iterationCount);
 
                 if (mechanism.Equals("PBEwithMD5andDES-CBC"))
                 {
@@ -571,7 +572,7 @@ namespace Org.BouncyCastle.Security
             else if (Platform.StartsWith(mechanism, "PBEwithMD2"))
             {
                 PbeParametersGenerator generator = MakePbeGenerator(
-                    (string)algorithmType[mechanism], new MD2Digest(), keyBytes, salt, iterationCount);
+                    AlgorithmType[mechanism], new MD2Digest(), keyBytes, salt, iterationCount);
                 if (mechanism.Equals("PBEwithMD2andDES-CBC"))
                 {
                     parameters = generator.GenerateDerivedParameters("DES", 64, 64);
@@ -587,7 +588,7 @@ namespace Org.BouncyCastle.Security
                 IDigest digest = DigestUtilities.GetDigest(digestName);
 
                 PbeParametersGenerator generator = MakePbeGenerator(
-                    (string) algorithmType[mechanism], digest, keyBytes, salt, iterationCount);
+                    AlgorithmType[mechanism], digest, keyBytes, salt, iterationCount);
 
                 int bitLen = digest.GetDigestSize() * 8;
                 parameters = generator.GenerateDerivedMacParameters(bitLen);
@@ -619,10 +620,9 @@ namespace Org.BouncyCastle.Security
             return CreateEngine(algorithm);
         }
 
-        public static object CreateEngine(
-            string algorithm)
+        public static object CreateEngine(string algorithm)
         {
-            string mechanism = (string)algorithms[Platform.ToUpperInvariant(algorithm)];
+            string mechanism = CollectionUtilities.GetValueOrNull(Algorithms, algorithm);
 
             if (Platform.StartsWith(mechanism, "PBEwithHmac"))
             {
@@ -665,10 +665,9 @@ namespace Org.BouncyCastle.Security
             return null;
         }
 
-        public static string GetEncodingName(
-            DerObjectIdentifier oid)
+        public static string GetEncodingName(DerObjectIdentifier oid)
         {
-            return (string) algorithms[oid.Id];
+            return CollectionUtilities.GetValueOrNull(Algorithms, oid.Id);
         }
 
         private static ICipherParameters FixDesParity(string mechanism, ICipherParameters parameters)
diff --git a/crypto/src/security/PrivateKeyFactory.cs b/crypto/src/security/PrivateKeyFactory.cs
index 93f8a2260..3c57297fe 100644
--- a/crypto/src/security/PrivateKeyFactory.cs
+++ b/crypto/src/security/PrivateKeyFactory.cs
@@ -1,7 +1,5 @@
 using System;
-using System.Collections;
 using System.IO;
-using System.Text;
 
 using Org.BouncyCastle.Asn1;
 using Org.BouncyCastle.Asn1.CryptoPro;
diff --git a/crypto/src/security/PublicKeyFactory.cs b/crypto/src/security/PublicKeyFactory.cs
index 65baf003c..49ad49dd0 100644
--- a/crypto/src/security/PublicKeyFactory.cs
+++ b/crypto/src/security/PublicKeyFactory.cs
@@ -1,7 +1,5 @@
 using System;
-using System.Collections;
 using System.IO;
-using System.Text;
 
 using Org.BouncyCastle.Asn1;
 using Org.BouncyCastle.Asn1.CryptoPro;
@@ -9,7 +7,6 @@ using Org.BouncyCastle.Asn1.EdEC;
 using Org.BouncyCastle.Asn1.Oiw;
 using Org.BouncyCastle.Asn1.Pkcs;
 using Org.BouncyCastle.Asn1.Rosstandart;
-using Org.BouncyCastle.Asn1.Sec;
 using Org.BouncyCastle.Asn1.X509;
 using Org.BouncyCastle.Asn1.X9;
 using Org.BouncyCastle.Crypto;
@@ -18,7 +15,6 @@ using Org.BouncyCastle.Crypto.Parameters;
 using Org.BouncyCastle.Math;
 using Org.BouncyCastle.Math.EC;
 using Org.BouncyCastle.Utilities;
-using Org.BouncyCastle.Utilities.Encoders;
 
 namespace Org.BouncyCastle.Security
 {
diff --git a/crypto/src/security/SecureRandom.cs b/crypto/src/security/SecureRandom.cs
index eb5d69618..e8cac56f5 100644
--- a/crypto/src/security/SecureRandom.cs
+++ b/crypto/src/security/SecureRandom.cs
@@ -62,15 +62,16 @@ namespace Org.BouncyCastle.Security
         /// <param name="autoSeed">If true, the instance will be auto-seeded.</param>
         public static SecureRandom GetInstance(string algorithm, bool autoSeed)
         {
-            string upper = Platform.ToUpperInvariant(algorithm);
-            if (Platform.EndsWith(upper, "PRNG"))
+            if (algorithm == null)
+                throw new ArgumentNullException(nameof(algorithm));
+
+            if (algorithm.EndsWith("PRNG", StringComparison.OrdinalIgnoreCase))
             {
-                string digestName = upper.Substring(0, upper.Length - "PRNG".Length);
+                string digestName = algorithm.Substring(0, algorithm.Length - "PRNG".Length);
+
                 DigestRandomGenerator prng = CreatePrng(digestName, autoSeed);
                 if (prng != null)
-                {
                     return new SecureRandom(prng);
-                }
             }
 
             throw new ArgumentException("Unrecognised PRNG algorithm: " + algorithm, "algorithm");
diff --git a/crypto/src/security/SignerUtilities.cs b/crypto/src/security/SignerUtilities.cs
index b3a49dea8..e42e217cc 100644
--- a/crypto/src/security/SignerUtilities.cs
+++ b/crypto/src/security/SignerUtilities.cs
@@ -1,6 +1,5 @@
 using System;
-using System.Collections;
-using System.IO;
+using System.Collections.Generic;
 
 using Org.BouncyCastle.Asn1;
 using Org.BouncyCastle.Asn1.Bsi;
@@ -14,439 +13,437 @@ using Org.BouncyCastle.Asn1.Pkcs;
 using Org.BouncyCastle.Asn1.TeleTrust;
 using Org.BouncyCastle.Asn1.X509;
 using Org.BouncyCastle.Asn1.X9;
-using Org.BouncyCastle.Security;
 using Org.BouncyCastle.Crypto.Digests;
 using Org.BouncyCastle.Crypto;
 using Org.BouncyCastle.Crypto.Engines;
 using Org.BouncyCastle.Crypto.Signers;
 using Org.BouncyCastle.Utilities;
+using Org.BouncyCastle.Utilities.Collections;
 
 namespace Org.BouncyCastle.Security
 {
     /// <summary>
     ///  Signer Utility class contains methods that can not be specifically grouped into other classes.
     /// </summary>
-    public sealed class SignerUtilities
+    public static class SignerUtilities
     {
-        private SignerUtilities()
-        {
-        }
-
-        internal static readonly IDictionary algorithms = Platform.CreateHashtable();
-        internal static readonly IDictionary oids = Platform.CreateHashtable();
+        internal static readonly IDictionary<string, string> AlgorithmMap =
+            new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
+        internal static readonly IDictionary<string, DerObjectIdentifier> Oids =
+            new Dictionary<string, DerObjectIdentifier>(StringComparer.OrdinalIgnoreCase);
 
         static SignerUtilities()
         {
-            algorithms["MD2WITHRSA"] = "MD2withRSA";
-            algorithms["MD2WITHRSAENCRYPTION"] = "MD2withRSA";
-            algorithms[PkcsObjectIdentifiers.MD2WithRsaEncryption.Id] = "MD2withRSA";
-
-            algorithms["MD4WITHRSA"] = "MD4withRSA";
-            algorithms["MD4WITHRSAENCRYPTION"] = "MD4withRSA";
-            algorithms[PkcsObjectIdentifiers.MD4WithRsaEncryption.Id] = "MD4withRSA";
-            algorithms[OiwObjectIdentifiers.MD4WithRsa.Id] = "MD4withRSA";
-			algorithms[OiwObjectIdentifiers.MD4WithRsaEncryption.Id] = "MD4withRSA";
-
-			algorithms["MD5WITHRSA"] = "MD5withRSA";
-            algorithms["MD5WITHRSAENCRYPTION"] = "MD5withRSA";
-            algorithms[PkcsObjectIdentifiers.MD5WithRsaEncryption.Id] = "MD5withRSA";
-            algorithms[OiwObjectIdentifiers.MD5WithRsa.Id] = "MD5withRSA";
-
-            algorithms["SHA1WITHRSA"] = "SHA-1withRSA";
-            algorithms["SHA-1WITHRSA"] = "SHA-1withRSA";
-            algorithms["SHA1WITHRSAENCRYPTION"] = "SHA-1withRSA";
-            algorithms["SHA-1WITHRSAENCRYPTION"] = "SHA-1withRSA";
-            algorithms[PkcsObjectIdentifiers.Sha1WithRsaEncryption.Id] = "SHA-1withRSA";
-            algorithms[OiwObjectIdentifiers.Sha1WithRsa.Id] = "SHA-1withRSA";
-
-            algorithms["SHA224WITHRSA"] = "SHA-224withRSA";
-            algorithms["SHA-224WITHRSA"] = "SHA-224withRSA";
-            algorithms["SHA224WITHRSAENCRYPTION"] = "SHA-224withRSA";
-            algorithms["SHA-224WITHRSAENCRYPTION"] = "SHA-224withRSA";
-            algorithms[PkcsObjectIdentifiers.Sha224WithRsaEncryption.Id] = "SHA-224withRSA";
-
-            algorithms["SHA256WITHRSA"] = "SHA-256withRSA";
-            algorithms["SHA-256WITHRSA"] = "SHA-256withRSA";
-            algorithms["SHA256WITHRSAENCRYPTION"] = "SHA-256withRSA";
-            algorithms["SHA-256WITHRSAENCRYPTION"] = "SHA-256withRSA";
-            algorithms[PkcsObjectIdentifiers.Sha256WithRsaEncryption.Id] = "SHA-256withRSA";
-
-            algorithms["SHA384WITHRSA"] = "SHA-384withRSA";
-            algorithms["SHA-384WITHRSA"] = "SHA-384withRSA";
-            algorithms["SHA384WITHRSAENCRYPTION"] = "SHA-384withRSA";
-            algorithms["SHA-384WITHRSAENCRYPTION"] = "SHA-384withRSA";
-            algorithms[PkcsObjectIdentifiers.Sha384WithRsaEncryption.Id] = "SHA-384withRSA";
-
-            algorithms["SHA512WITHRSA"] = "SHA-512withRSA";
-            algorithms["SHA-512WITHRSA"] = "SHA-512withRSA";
-            algorithms["SHA512WITHRSAENCRYPTION"] = "SHA-512withRSA";
-            algorithms["SHA-512WITHRSAENCRYPTION"] = "SHA-512withRSA";
-            algorithms[PkcsObjectIdentifiers.Sha512WithRsaEncryption.Id] = "SHA-512withRSA";
-
-            algorithms["SHA512(224)WITHRSA"] = "SHA-512(224)withRSA";
-            algorithms["SHA-512(224)WITHRSA"] = "SHA-512(224)withRSA";
-            algorithms["SHA512(224)WITHRSAENCRYPTION"] = "SHA-512(224)withRSA";
-            algorithms["SHA-512(224)WITHRSAENCRYPTION"] = "SHA-512(224)withRSA";
-            algorithms[PkcsObjectIdentifiers.Sha512_224WithRSAEncryption.Id] = "SHA-512(224)withRSA";
-
-            algorithms["SHA512(256)WITHRSA"] = "SHA-512(256)withRSA";
-            algorithms["SHA-512(256)WITHRSA"] = "SHA-512(256)withRSA";
-            algorithms["SHA512(256)WITHRSAENCRYPTION"] = "SHA-512(256)withRSA";
-            algorithms["SHA-512(256)WITHRSAENCRYPTION"] = "SHA-512(256)withRSA";
-            algorithms[PkcsObjectIdentifiers.Sha512_256WithRSAEncryption.Id] = "SHA-512(256)withRSA";
-
-            algorithms["SHA3-224WITHRSA"] = "SHA3-224withRSA";
-            algorithms["SHA3-224WITHRSAENCRYPTION"] = "SHA3-224withRSA";
-            algorithms[NistObjectIdentifiers.IdRsassaPkcs1V15WithSha3_224.Id] = "SHA3-224withRSA";
-            algorithms["SHA3-256WITHRSA"] = "SHA3-256withRSA";
-            algorithms["SHA3-256WITHRSAENCRYPTION"] = "SHA3-256withRSA";
-            algorithms[NistObjectIdentifiers.IdRsassaPkcs1V15WithSha3_256.Id] = "SHA3-256withRSA";
-            algorithms["SHA3-384WITHRSA"] = "SHA3-384withRSA";
-            algorithms["SHA3-384WITHRSAENCRYPTION"] = "SHA3-384withRSA";
-            algorithms[NistObjectIdentifiers.IdRsassaPkcs1V15WithSha3_384.Id] = "SHA3-384withRSA";
-            algorithms["SHA3-512WITHRSA"] = "SHA3-512withRSA";
-            algorithms["SHA3-512WITHRSAENCRYPTION"] = "SHA3-512withRSA";
-            algorithms[NistObjectIdentifiers.IdRsassaPkcs1V15WithSha3_512.Id] = "SHA3-512withRSA";
-
-            algorithms["PSSWITHRSA"] = "PSSwithRSA";
-            algorithms["RSASSA-PSS"] = "PSSwithRSA";
-            algorithms[PkcsObjectIdentifiers.IdRsassaPss.Id] = "PSSwithRSA";
-            algorithms["RSAPSS"] = "PSSwithRSA";
-
-            algorithms["SHA1WITHRSAANDMGF1"] = "SHA-1withRSAandMGF1";
-            algorithms["SHA-1WITHRSAANDMGF1"] = "SHA-1withRSAandMGF1";
-            algorithms["SHA1WITHRSA/PSS"] = "SHA-1withRSAandMGF1";
-            algorithms["SHA-1WITHRSA/PSS"] = "SHA-1withRSAandMGF1";
-            algorithms["SHA1WITHRSASSA-PSS"] = "SHA-1withRSAandMGF1";
-            algorithms["SHA-1WITHRSASSA-PSS"] = "SHA-1withRSAandMGF1";
-
-            algorithms["SHA224WITHRSAANDMGF1"] = "SHA-224withRSAandMGF1";
-            algorithms["SHA-224WITHRSAANDMGF1"] = "SHA-224withRSAandMGF1";
-            algorithms["SHA224WITHRSA/PSS"] = "SHA-224withRSAandMGF1";
-            algorithms["SHA-224WITHRSA/PSS"] = "SHA-224withRSAandMGF1";
-            algorithms["SHA224WITHRSASSA-PSS"] = "SHA-224withRSAandMGF1";
-            algorithms["SHA-224WITHRSASSA-PSS"] = "SHA-224withRSAandMGF1";
-
-            algorithms["SHA256WITHRSAANDMGF1"] = "SHA-256withRSAandMGF1";
-            algorithms["SHA-256WITHRSAANDMGF1"] = "SHA-256withRSAandMGF1";
-            algorithms["SHA256WITHRSA/PSS"] = "SHA-256withRSAandMGF1";
-            algorithms["SHA-256WITHRSA/PSS"] = "SHA-256withRSAandMGF1";
-            algorithms["SHA256WITHRSASSA-PSS"] = "SHA-256withRSAandMGF1";
-            algorithms["SHA-256WITHRSASSA-PSS"] = "SHA-256withRSAandMGF1";
-
-            algorithms["SHA384WITHRSAANDMGF1"] = "SHA-384withRSAandMGF1";
-            algorithms["SHA-384WITHRSAANDMGF1"] = "SHA-384withRSAandMGF1";
-            algorithms["SHA384WITHRSA/PSS"] = "SHA-384withRSAandMGF1";
-            algorithms["SHA-384WITHRSA/PSS"] = "SHA-384withRSAandMGF1";
-            algorithms["SHA384WITHRSASSA-PSS"] = "SHA-384withRSAandMGF1";
-            algorithms["SHA-384WITHRSASSA-PSS"] = "SHA-384withRSAandMGF1";
-
-            algorithms["SHA512WITHRSAANDMGF1"] = "SHA-512withRSAandMGF1";
-            algorithms["SHA-512WITHRSAANDMGF1"] = "SHA-512withRSAandMGF1";
-            algorithms["SHA512WITHRSA/PSS"] = "SHA-512withRSAandMGF1";
-            algorithms["SHA-512WITHRSA/PSS"] = "SHA-512withRSAandMGF1";
-            algorithms["SHA512WITHRSASSA-PSS"] = "SHA-512withRSAandMGF1";
-            algorithms["SHA-512WITHRSASSA-PSS"] = "SHA-512withRSAandMGF1";
-
-            algorithms["RIPEMD128WITHRSA"] = "RIPEMD128withRSA";
-            algorithms["RIPEMD128WITHRSAENCRYPTION"] = "RIPEMD128withRSA";
-            algorithms[TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD128.Id] = "RIPEMD128withRSA";
-
-            algorithms["RIPEMD160WITHRSA"] = "RIPEMD160withRSA";
-            algorithms["RIPEMD160WITHRSAENCRYPTION"] = "RIPEMD160withRSA";
-            algorithms[TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD160.Id] = "RIPEMD160withRSA";
-
-            algorithms["RIPEMD256WITHRSA"] = "RIPEMD256withRSA";
-            algorithms["RIPEMD256WITHRSAENCRYPTION"] = "RIPEMD256withRSA";
-            algorithms[TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD256.Id] = "RIPEMD256withRSA";
-
-            algorithms["NONEWITHRSA"] = "RSA";
-            algorithms["RSAWITHNONE"] = "RSA";
-            algorithms["RAWRSA"] = "RSA";
-
-            algorithms["RAWRSAPSS"] = "RAWRSASSA-PSS";
-            algorithms["NONEWITHRSAPSS"] = "RAWRSASSA-PSS";
-            algorithms["NONEWITHRSASSA-PSS"] = "RAWRSASSA-PSS";
-
-            algorithms["NONEWITHDSA"] = "NONEwithDSA";
-            algorithms["DSAWITHNONE"] = "NONEwithDSA";
-            algorithms["RAWDSA"] = "NONEwithDSA";
-
-            algorithms["DSA"] = "SHA-1withDSA";
-            algorithms["DSAWITHSHA1"] = "SHA-1withDSA";
-            algorithms["DSAWITHSHA-1"] = "SHA-1withDSA";
-            algorithms["SHA/DSA"] = "SHA-1withDSA";
-            algorithms["SHA1/DSA"] = "SHA-1withDSA";
-            algorithms["SHA-1/DSA"] = "SHA-1withDSA";
-            algorithms["SHA1WITHDSA"] = "SHA-1withDSA";
-            algorithms["SHA-1WITHDSA"] = "SHA-1withDSA";
-            algorithms[X9ObjectIdentifiers.IdDsaWithSha1.Id] = "SHA-1withDSA";
-            algorithms[OiwObjectIdentifiers.DsaWithSha1.Id] = "SHA-1withDSA";
-
-            algorithms["DSAWITHSHA224"] = "SHA-224withDSA";
-            algorithms["DSAWITHSHA-224"] = "SHA-224withDSA";
-            algorithms["SHA224/DSA"] = "SHA-224withDSA";
-            algorithms["SHA-224/DSA"] = "SHA-224withDSA";
-            algorithms["SHA224WITHDSA"] = "SHA-224withDSA";
-            algorithms["SHA-224WITHDSA"] = "SHA-224withDSA";
-            algorithms[NistObjectIdentifiers.DsaWithSha224.Id] = "SHA-224withDSA";
-
-            algorithms["DSAWITHSHA256"] = "SHA-256withDSA";
-            algorithms["DSAWITHSHA-256"] = "SHA-256withDSA";
-            algorithms["SHA256/DSA"] = "SHA-256withDSA";
-            algorithms["SHA-256/DSA"] = "SHA-256withDSA";
-            algorithms["SHA256WITHDSA"] = "SHA-256withDSA";
-            algorithms["SHA-256WITHDSA"] = "SHA-256withDSA";
-            algorithms[NistObjectIdentifiers.DsaWithSha256.Id] = "SHA-256withDSA";
-
-            algorithms["DSAWITHSHA384"] = "SHA-384withDSA";
-            algorithms["DSAWITHSHA-384"] = "SHA-384withDSA";
-            algorithms["SHA384/DSA"] = "SHA-384withDSA";
-            algorithms["SHA-384/DSA"] = "SHA-384withDSA";
-            algorithms["SHA384WITHDSA"] = "SHA-384withDSA";
-            algorithms["SHA-384WITHDSA"] = "SHA-384withDSA";
-            algorithms[NistObjectIdentifiers.DsaWithSha384.Id] = "SHA-384withDSA";
-
-            algorithms["DSAWITHSHA512"] = "SHA-512withDSA";
-            algorithms["DSAWITHSHA-512"] = "SHA-512withDSA";
-            algorithms["SHA512/DSA"] = "SHA-512withDSA";
-            algorithms["SHA-512/DSA"] = "SHA-512withDSA";
-            algorithms["SHA512WITHDSA"] = "SHA-512withDSA";
-            algorithms["SHA-512WITHDSA"] = "SHA-512withDSA";
-            algorithms[NistObjectIdentifiers.DsaWithSha512.Id] = "SHA-512withDSA";
-
-            algorithms["NONEWITHECDSA"] = "NONEwithECDSA";
-            algorithms["ECDSAWITHNONE"] = "NONEwithECDSA";
-
-            algorithms["ECDSA"] = "SHA-1withECDSA";
-            algorithms["SHA1/ECDSA"] = "SHA-1withECDSA";
-            algorithms["SHA-1/ECDSA"] = "SHA-1withECDSA";
-            algorithms["ECDSAWITHSHA1"] = "SHA-1withECDSA";
-            algorithms["ECDSAWITHSHA-1"] = "SHA-1withECDSA";
-            algorithms["SHA1WITHECDSA"] = "SHA-1withECDSA";
-            algorithms["SHA-1WITHECDSA"] = "SHA-1withECDSA";
-            algorithms[X9ObjectIdentifiers.ECDsaWithSha1.Id] = "SHA-1withECDSA";
-            algorithms[TeleTrusTObjectIdentifiers.ECSignWithSha1.Id] = "SHA-1withECDSA";
-
-            algorithms["SHA224/ECDSA"] = "SHA-224withECDSA";
-            algorithms["SHA-224/ECDSA"] = "SHA-224withECDSA";
-            algorithms["ECDSAWITHSHA224"] = "SHA-224withECDSA";
-            algorithms["ECDSAWITHSHA-224"] = "SHA-224withECDSA";
-            algorithms["SHA224WITHECDSA"] = "SHA-224withECDSA";
-            algorithms["SHA-224WITHECDSA"] = "SHA-224withECDSA";
-            algorithms[X9ObjectIdentifiers.ECDsaWithSha224.Id] = "SHA-224withECDSA";
-
-            algorithms["SHA256/ECDSA"] = "SHA-256withECDSA";
-            algorithms["SHA-256/ECDSA"] = "SHA-256withECDSA";
-            algorithms["ECDSAWITHSHA256"] = "SHA-256withECDSA";
-            algorithms["ECDSAWITHSHA-256"] = "SHA-256withECDSA";
-            algorithms["SHA256WITHECDSA"] = "SHA-256withECDSA";
-            algorithms["SHA-256WITHECDSA"] = "SHA-256withECDSA";
-            algorithms[X9ObjectIdentifiers.ECDsaWithSha256.Id] = "SHA-256withECDSA";
-
-            algorithms["SHA384/ECDSA"] = "SHA-384withECDSA";
-            algorithms["SHA-384/ECDSA"] = "SHA-384withECDSA";
-            algorithms["ECDSAWITHSHA384"] = "SHA-384withECDSA";
-            algorithms["ECDSAWITHSHA-384"] = "SHA-384withECDSA";
-            algorithms["SHA384WITHECDSA"] = "SHA-384withECDSA";
-            algorithms["SHA-384WITHECDSA"] = "SHA-384withECDSA";
-            algorithms[X9ObjectIdentifiers.ECDsaWithSha384.Id] = "SHA-384withECDSA";
-
-            algorithms["SHA512/ECDSA"] = "SHA-512withECDSA";
-            algorithms["SHA-512/ECDSA"] = "SHA-512withECDSA";
-            algorithms["ECDSAWITHSHA512"] = "SHA-512withECDSA";
-            algorithms["ECDSAWITHSHA-512"] = "SHA-512withECDSA";
-            algorithms["SHA512WITHECDSA"] = "SHA-512withECDSA";
-            algorithms["SHA-512WITHECDSA"] = "SHA-512withECDSA";
-            algorithms[X9ObjectIdentifiers.ECDsaWithSha512.Id] = "SHA-512withECDSA";
-
-            algorithms["RIPEMD160/ECDSA"] = "RIPEMD160withECDSA";
-            algorithms["ECDSAWITHRIPEMD160"] = "RIPEMD160withECDSA";
-            algorithms["RIPEMD160WITHECDSA"] = "RIPEMD160withECDSA";
-            algorithms[TeleTrusTObjectIdentifiers.ECSignWithRipeMD160.Id] = "RIPEMD160withECDSA";
-
-            algorithms["NONEWITHCVC-ECDSA"] = "NONEwithCVC-ECDSA";
-            algorithms["CVC-ECDSAWITHNONE"] = "NONEwithCVC-ECDSA";
-
-            algorithms["SHA1/CVC-ECDSA"] = "SHA-1withCVC-ECDSA";
-            algorithms["SHA-1/CVC-ECDSA"] = "SHA-1withCVC-ECDSA";
-            algorithms["CVC-ECDSAWITHSHA1"] = "SHA-1withCVC-ECDSA";
-            algorithms["CVC-ECDSAWITHSHA-1"] = "SHA-1withCVC-ECDSA";
-            algorithms["SHA1WITHCVC-ECDSA"] = "SHA-1withCVC-ECDSA";
-            algorithms["SHA-1WITHCVC-ECDSA"] = "SHA-1withCVC-ECDSA";
-            algorithms[EacObjectIdentifiers.id_TA_ECDSA_SHA_1.Id] = "SHA-1withCVC-ECDSA";
-
-            algorithms["SHA224/CVC-ECDSA"] = "SHA-224withCVC-ECDSA";
-            algorithms["SHA-224/CVC-ECDSA"] = "SHA-224withCVC-ECDSA";
-            algorithms["CVC-ECDSAWITHSHA224"] = "SHA-224withCVC-ECDSA";
-            algorithms["CVC-ECDSAWITHSHA-224"] = "SHA-224withCVC-ECDSA";
-            algorithms["SHA224WITHCVC-ECDSA"] = "SHA-224withCVC-ECDSA";
-            algorithms["SHA-224WITHCVC-ECDSA"] = "SHA-224withCVC-ECDSA";
-            algorithms[EacObjectIdentifiers.id_TA_ECDSA_SHA_224.Id] = "SHA-224withCVC-ECDSA";
-
-            algorithms["SHA256/CVC-ECDSA"] = "SHA-256withCVC-ECDSA";
-            algorithms["SHA-256/CVC-ECDSA"] = "SHA-256withCVC-ECDSA";
-            algorithms["CVC-ECDSAWITHSHA256"] = "SHA-256withCVC-ECDSA";
-            algorithms["CVC-ECDSAWITHSHA-256"] = "SHA-256withCVC-ECDSA";
-            algorithms["SHA256WITHCVC-ECDSA"] = "SHA-256withCVC-ECDSA";
-            algorithms["SHA-256WITHCVC-ECDSA"] = "SHA-256withCVC-ECDSA";
-            algorithms[EacObjectIdentifiers.id_TA_ECDSA_SHA_256.Id] = "SHA-256withCVC-ECDSA";
-
-            algorithms["SHA384/CVC-ECDSA"] = "SHA-384withCVC-ECDSA";
-            algorithms["SHA-384/CVC-ECDSA"] = "SHA-384withCVC-ECDSA";
-            algorithms["CVC-ECDSAWITHSHA384"] = "SHA-384withCVC-ECDSA";
-            algorithms["CVC-ECDSAWITHSHA-384"] = "SHA-384withCVC-ECDSA";
-            algorithms["SHA384WITHCVC-ECDSA"] = "SHA-384withCVC-ECDSA";
-            algorithms["SHA-384WITHCVC-ECDSA"] = "SHA-384withCVC-ECDSA";
-            algorithms[EacObjectIdentifiers.id_TA_ECDSA_SHA_384.Id] = "SHA-384withCVC-ECDSA";
-
-            algorithms["SHA512/CVC-ECDSA"] = "SHA-512withCVC-ECDSA";
-            algorithms["SHA-512/CVC-ECDSA"] = "SHA-512withCVC-ECDSA";
-            algorithms["CVC-ECDSAWITHSHA512"] = "SHA-512withCVC-ECDSA";
-            algorithms["CVC-ECDSAWITHSHA-512"] = "SHA-512withCVC-ECDSA";
-            algorithms["SHA512WITHCVC-ECDSA"] = "SHA-512withCVC-ECDSA";
-            algorithms["SHA-512WITHCVC-ECDSA"] = "SHA-512withCVC-ECDSA";
-            algorithms[EacObjectIdentifiers.id_TA_ECDSA_SHA_512.Id] = "SHA-512withCVC-ECDSA";
-
-            algorithms["NONEWITHPLAIN-ECDSA"] = "NONEwithPLAIN-ECDSA";
-            algorithms["PLAIN-ECDSAWITHNONE"] = "NONEwithPLAIN-ECDSA";
-
-            algorithms["SHA1/PLAIN-ECDSA"] = "SHA-1withPLAIN-ECDSA";
-            algorithms["SHA-1/PLAIN-ECDSA"] = "SHA-1withPLAIN-ECDSA";
-            algorithms["PLAIN-ECDSAWITHSHA1"] = "SHA-1withPLAIN-ECDSA";
-            algorithms["PLAIN-ECDSAWITHSHA-1"] = "SHA-1withPLAIN-ECDSA";
-            algorithms["SHA1WITHPLAIN-ECDSA"] = "SHA-1withPLAIN-ECDSA";
-            algorithms["SHA-1WITHPLAIN-ECDSA"] = "SHA-1withPLAIN-ECDSA";
-            algorithms[BsiObjectIdentifiers.ecdsa_plain_SHA1.Id] = "SHA-1withPLAIN-ECDSA";
-
-            algorithms["SHA224/PLAIN-ECDSA"] = "SHA-224withPLAIN-ECDSA";
-            algorithms["SHA-224/PLAIN-ECDSA"] = "SHA-224withPLAIN-ECDSA";
-            algorithms["PLAIN-ECDSAWITHSHA224"] = "SHA-224withPLAIN-ECDSA";
-            algorithms["PLAIN-ECDSAWITHSHA-224"] = "SHA-224withPLAIN-ECDSA";
-            algorithms["SHA224WITHPLAIN-ECDSA"] = "SHA-224withPLAIN-ECDSA";
-            algorithms["SHA-224WITHPLAIN-ECDSA"] = "SHA-224withPLAIN-ECDSA";
-            algorithms[BsiObjectIdentifiers.ecdsa_plain_SHA224.Id] = "SHA-224withPLAIN-ECDSA";
-
-            algorithms["SHA256/PLAIN-ECDSA"] = "SHA-256withPLAIN-ECDSA";
-            algorithms["SHA-256/PLAIN-ECDSA"] = "SHA-256withPLAIN-ECDSA";
-            algorithms["PLAIN-ECDSAWITHSHA256"] = "SHA-256withPLAIN-ECDSA";
-            algorithms["PLAIN-ECDSAWITHSHA-256"] = "SHA-256withPLAIN-ECDSA";
-            algorithms["SHA256WITHPLAIN-ECDSA"] = "SHA-256withPLAIN-ECDSA";
-            algorithms["SHA-256WITHPLAIN-ECDSA"] = "SHA-256withPLAIN-ECDSA";
-            algorithms[BsiObjectIdentifiers.ecdsa_plain_SHA256.Id] = "SHA-256withPLAIN-ECDSA";
-
-            algorithms["SHA384/PLAIN-ECDSA"] = "SHA-384withPLAIN-ECDSA";
-            algorithms["SHA-384/PLAIN-ECDSA"] = "SHA-384withPLAIN-ECDSA";
-            algorithms["PLAIN-ECDSAWITHSHA384"] = "SHA-384withPLAIN-ECDSA";
-            algorithms["PLAIN-ECDSAWITHSHA-384"] = "SHA-384withPLAIN-ECDSA";
-            algorithms["SHA384WITHPLAIN-ECDSA"] = "SHA-384withPLAIN-ECDSA";
-            algorithms["SHA-384WITHPLAIN-ECDSA"] = "SHA-384withPLAIN-ECDSA";
-            algorithms[BsiObjectIdentifiers.ecdsa_plain_SHA384.Id] = "SHA-384withPLAIN-ECDSA";
-
-            algorithms["SHA512/PLAIN-ECDSA"] = "SHA-512withPLAIN-ECDSA";
-            algorithms["SHA-512/PLAIN-ECDSA"] = "SHA-512withPLAIN-ECDSA";
-            algorithms["PLAIN-ECDSAWITHSHA512"] = "SHA-512withPLAIN-ECDSA";
-            algorithms["PLAIN-ECDSAWITHSHA-512"] = "SHA-512withPLAIN-ECDSA";
-            algorithms["SHA512WITHPLAIN-ECDSA"] = "SHA-512withPLAIN-ECDSA";
-            algorithms["SHA-512WITHPLAIN-ECDSA"] = "SHA-512withPLAIN-ECDSA";
-            algorithms[BsiObjectIdentifiers.ecdsa_plain_SHA512.Id] = "SHA-512withPLAIN-ECDSA";
-
-            algorithms["RIPEMD160/PLAIN-ECDSA"] = "RIPEMD160withPLAIN-ECDSA";
-            algorithms["PLAIN-ECDSAWITHRIPEMD160"] = "RIPEMD160withPLAIN-ECDSA";
-            algorithms["RIPEMD160WITHPLAIN-ECDSA"] = "RIPEMD160withPLAIN-ECDSA";
-            algorithms[BsiObjectIdentifiers.ecdsa_plain_RIPEMD160.Id] = "RIPEMD160withPLAIN-ECDSA";
-
-            algorithms["SHA1WITHECNR"] = "SHA-1withECNR";
-            algorithms["SHA-1WITHECNR"] = "SHA-1withECNR";
-            algorithms["SHA224WITHECNR"] = "SHA-224withECNR";
-            algorithms["SHA-224WITHECNR"] = "SHA-224withECNR";
-            algorithms["SHA256WITHECNR"] = "SHA-256withECNR";
-            algorithms["SHA-256WITHECNR"] = "SHA-256withECNR";
-            algorithms["SHA384WITHECNR"] = "SHA-384withECNR";
-            algorithms["SHA-384WITHECNR"] = "SHA-384withECNR";
-            algorithms["SHA512WITHECNR"] = "SHA-512withECNR";
-            algorithms["SHA-512WITHECNR"] = "SHA-512withECNR";
-
-            algorithms["GOST-3410"] = "GOST3410";
-            algorithms["GOST-3410-94"] = "GOST3410";
-            algorithms["GOST3411WITHGOST3410"] = "GOST3410";
-            algorithms[CryptoProObjectIdentifiers.GostR3411x94WithGostR3410x94.Id] = "GOST3410";
-
-            algorithms["ECGOST-3410"] = "ECGOST3410";
-            algorithms["ECGOST-3410-2001"] = "ECGOST3410";
-            algorithms["GOST3411WITHECGOST3410"] = "ECGOST3410";
-            algorithms[CryptoProObjectIdentifiers.GostR3411x94WithGostR3410x2001.Id] = "ECGOST3410";
-
-            algorithms["ED25519"] = "Ed25519";
-            algorithms[EdECObjectIdentifiers.id_Ed25519.Id] = "Ed25519";
-            algorithms["ED25519CTX"] = "Ed25519ctx";
-            algorithms["ED25519PH"] = "Ed25519ph";
-            algorithms["ED448"] = "Ed448";
-            algorithms[EdECObjectIdentifiers.id_Ed448.Id] = "Ed448";
-            algorithms["ED448PH"] = "Ed448ph";
-
-            algorithms["SHA256WITHSM2"] = "SHA256withSM2";
-            algorithms[GMObjectIdentifiers.sm2sign_with_sha256.Id] = "SHA256withSM2";
-            algorithms["SM3WITHSM2"] = "SM3withSM2";
-            algorithms[GMObjectIdentifiers.sm2sign_with_sm3.Id] = "SM3withSM2";
-
-            oids["MD2withRSA"] = PkcsObjectIdentifiers.MD2WithRsaEncryption;
-            oids["MD4withRSA"] = PkcsObjectIdentifiers.MD4WithRsaEncryption;
-            oids["MD5withRSA"] = PkcsObjectIdentifiers.MD5WithRsaEncryption;
-
-            oids["SHA-1withRSA"] = PkcsObjectIdentifiers.Sha1WithRsaEncryption;
-            oids["SHA-224withRSA"] = PkcsObjectIdentifiers.Sha224WithRsaEncryption;
-            oids["SHA-256withRSA"] = PkcsObjectIdentifiers.Sha256WithRsaEncryption;
-            oids["SHA-384withRSA"] = PkcsObjectIdentifiers.Sha384WithRsaEncryption;
-            oids["SHA-512withRSA"] = PkcsObjectIdentifiers.Sha512WithRsaEncryption;
-            oids["SHA-512(224)withRSA"] = PkcsObjectIdentifiers.Sha512_224WithRSAEncryption;
-            oids["SHA-512(256)withRSA"] = PkcsObjectIdentifiers.Sha512_256WithRSAEncryption;
-            oids["SHA3-224withRSA"] = NistObjectIdentifiers.IdRsassaPkcs1V15WithSha3_224;
-            oids["SHA3-256withRSA"] = NistObjectIdentifiers.IdRsassaPkcs1V15WithSha3_256;
-            oids["SHA3-384withRSA"] = NistObjectIdentifiers.IdRsassaPkcs1V15WithSha3_384;
-            oids["SHA3-512withRSA"] = NistObjectIdentifiers.IdRsassaPkcs1V15WithSha3_512;
-
-            oids["PSSwithRSA"] = PkcsObjectIdentifiers.IdRsassaPss;
-            oids["SHA-1withRSAandMGF1"] = PkcsObjectIdentifiers.IdRsassaPss;
-            oids["SHA-224withRSAandMGF1"] = PkcsObjectIdentifiers.IdRsassaPss;
-            oids["SHA-256withRSAandMGF1"] = PkcsObjectIdentifiers.IdRsassaPss;
-            oids["SHA-384withRSAandMGF1"] = PkcsObjectIdentifiers.IdRsassaPss;
-            oids["SHA-512withRSAandMGF1"] = PkcsObjectIdentifiers.IdRsassaPss;
-
-            oids["RIPEMD128withRSA"] = TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD128;
-            oids["RIPEMD160withRSA"] = TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD160;
-            oids["RIPEMD256withRSA"] = TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD256;
-
-            oids["SHA-1withDSA"] = X9ObjectIdentifiers.IdDsaWithSha1;
-
-            oids["SHA-1withECDSA"] = X9ObjectIdentifiers.ECDsaWithSha1;
-            oids["SHA-224withECDSA"] = X9ObjectIdentifiers.ECDsaWithSha224;
-            oids["SHA-256withECDSA"] = X9ObjectIdentifiers.ECDsaWithSha256;
-            oids["SHA-384withECDSA"] = X9ObjectIdentifiers.ECDsaWithSha384;
-            oids["SHA-512withECDSA"] = X9ObjectIdentifiers.ECDsaWithSha512;
-            oids["RIPEMD160withECDSA"] = TeleTrusTObjectIdentifiers.ECSignWithRipeMD160;
-
-            oids["SHA-1withCVC-ECDSA"] = EacObjectIdentifiers.id_TA_ECDSA_SHA_1;
-            oids["SHA-224withCVC-ECDSA"] = EacObjectIdentifiers.id_TA_ECDSA_SHA_224;
-            oids["SHA-256withCVC-ECDSA"] = EacObjectIdentifiers.id_TA_ECDSA_SHA_256;
-            oids["SHA-384withCVC-ECDSA"] = EacObjectIdentifiers.id_TA_ECDSA_SHA_384;
-            oids["SHA-512withCVC-ECDSA"] = EacObjectIdentifiers.id_TA_ECDSA_SHA_512;
-
-            oids["SHA-1withPLAIN-ECDSA"] = BsiObjectIdentifiers.ecdsa_plain_SHA1;
-            oids["SHA-224withPLAIN-ECDSA"] = BsiObjectIdentifiers.ecdsa_plain_SHA224;
-            oids["SHA-256withPLAIN-ECDSA"] = BsiObjectIdentifiers.ecdsa_plain_SHA256;
-            oids["SHA-384withPLAIN-ECDSA"] = BsiObjectIdentifiers.ecdsa_plain_SHA384;
-            oids["SHA-512withPLAIN-ECDSA"] = BsiObjectIdentifiers.ecdsa_plain_SHA512;
-            oids["RIPEMD160withPLAIN-ECDSA"] = BsiObjectIdentifiers.ecdsa_plain_RIPEMD160;
-
-            oids["GOST3410"] = CryptoProObjectIdentifiers.GostR3411x94WithGostR3410x94;
-            oids["ECGOST3410"] = CryptoProObjectIdentifiers.GostR3411x94WithGostR3410x2001;
-
-            oids["Ed25519"] = EdECObjectIdentifiers.id_Ed25519;
-            oids["Ed448"] = EdECObjectIdentifiers.id_Ed448;
-
-            oids["SHA256withSM2"] = GMObjectIdentifiers.sm2sign_with_sha256;
-            oids["SM3withSM2"] = GMObjectIdentifiers.sm2sign_with_sm3;
+            AlgorithmMap["MD2WITHRSA"] = "MD2withRSA";
+            AlgorithmMap["MD2WITHRSAENCRYPTION"] = "MD2withRSA";
+            AlgorithmMap[PkcsObjectIdentifiers.MD2WithRsaEncryption.Id] = "MD2withRSA";
+
+            AlgorithmMap["MD4WITHRSA"] = "MD4withRSA";
+            AlgorithmMap["MD4WITHRSAENCRYPTION"] = "MD4withRSA";
+            AlgorithmMap[PkcsObjectIdentifiers.MD4WithRsaEncryption.Id] = "MD4withRSA";
+            AlgorithmMap[OiwObjectIdentifiers.MD4WithRsa.Id] = "MD4withRSA";
+			AlgorithmMap[OiwObjectIdentifiers.MD4WithRsaEncryption.Id] = "MD4withRSA";
+
+			AlgorithmMap["MD5WITHRSA"] = "MD5withRSA";
+            AlgorithmMap["MD5WITHRSAENCRYPTION"] = "MD5withRSA";
+            AlgorithmMap[PkcsObjectIdentifiers.MD5WithRsaEncryption.Id] = "MD5withRSA";
+            AlgorithmMap[OiwObjectIdentifiers.MD5WithRsa.Id] = "MD5withRSA";
+
+            AlgorithmMap["SHA1WITHRSA"] = "SHA-1withRSA";
+            AlgorithmMap["SHA-1WITHRSA"] = "SHA-1withRSA";
+            AlgorithmMap["SHA1WITHRSAENCRYPTION"] = "SHA-1withRSA";
+            AlgorithmMap["SHA-1WITHRSAENCRYPTION"] = "SHA-1withRSA";
+            AlgorithmMap[PkcsObjectIdentifiers.Sha1WithRsaEncryption.Id] = "SHA-1withRSA";
+            AlgorithmMap[OiwObjectIdentifiers.Sha1WithRsa.Id] = "SHA-1withRSA";
+
+            AlgorithmMap["SHA224WITHRSA"] = "SHA-224withRSA";
+            AlgorithmMap["SHA-224WITHRSA"] = "SHA-224withRSA";
+            AlgorithmMap["SHA224WITHRSAENCRYPTION"] = "SHA-224withRSA";
+            AlgorithmMap["SHA-224WITHRSAENCRYPTION"] = "SHA-224withRSA";
+            AlgorithmMap[PkcsObjectIdentifiers.Sha224WithRsaEncryption.Id] = "SHA-224withRSA";
+
+            AlgorithmMap["SHA256WITHRSA"] = "SHA-256withRSA";
+            AlgorithmMap["SHA-256WITHRSA"] = "SHA-256withRSA";
+            AlgorithmMap["SHA256WITHRSAENCRYPTION"] = "SHA-256withRSA";
+            AlgorithmMap["SHA-256WITHRSAENCRYPTION"] = "SHA-256withRSA";
+            AlgorithmMap[PkcsObjectIdentifiers.Sha256WithRsaEncryption.Id] = "SHA-256withRSA";
+
+            AlgorithmMap["SHA384WITHRSA"] = "SHA-384withRSA";
+            AlgorithmMap["SHA-384WITHRSA"] = "SHA-384withRSA";
+            AlgorithmMap["SHA384WITHRSAENCRYPTION"] = "SHA-384withRSA";
+            AlgorithmMap["SHA-384WITHRSAENCRYPTION"] = "SHA-384withRSA";
+            AlgorithmMap[PkcsObjectIdentifiers.Sha384WithRsaEncryption.Id] = "SHA-384withRSA";
+
+            AlgorithmMap["SHA512WITHRSA"] = "SHA-512withRSA";
+            AlgorithmMap["SHA-512WITHRSA"] = "SHA-512withRSA";
+            AlgorithmMap["SHA512WITHRSAENCRYPTION"] = "SHA-512withRSA";
+            AlgorithmMap["SHA-512WITHRSAENCRYPTION"] = "SHA-512withRSA";
+            AlgorithmMap[PkcsObjectIdentifiers.Sha512WithRsaEncryption.Id] = "SHA-512withRSA";
+
+            AlgorithmMap["SHA512(224)WITHRSA"] = "SHA-512(224)withRSA";
+            AlgorithmMap["SHA-512(224)WITHRSA"] = "SHA-512(224)withRSA";
+            AlgorithmMap["SHA512(224)WITHRSAENCRYPTION"] = "SHA-512(224)withRSA";
+            AlgorithmMap["SHA-512(224)WITHRSAENCRYPTION"] = "SHA-512(224)withRSA";
+            AlgorithmMap[PkcsObjectIdentifiers.Sha512_224WithRSAEncryption.Id] = "SHA-512(224)withRSA";
+
+            AlgorithmMap["SHA512(256)WITHRSA"] = "SHA-512(256)withRSA";
+            AlgorithmMap["SHA-512(256)WITHRSA"] = "SHA-512(256)withRSA";
+            AlgorithmMap["SHA512(256)WITHRSAENCRYPTION"] = "SHA-512(256)withRSA";
+            AlgorithmMap["SHA-512(256)WITHRSAENCRYPTION"] = "SHA-512(256)withRSA";
+            AlgorithmMap[PkcsObjectIdentifiers.Sha512_256WithRSAEncryption.Id] = "SHA-512(256)withRSA";
+
+            AlgorithmMap["SHA3-224WITHRSA"] = "SHA3-224withRSA";
+            AlgorithmMap["SHA3-224WITHRSAENCRYPTION"] = "SHA3-224withRSA";
+            AlgorithmMap[NistObjectIdentifiers.IdRsassaPkcs1V15WithSha3_224.Id] = "SHA3-224withRSA";
+            AlgorithmMap["SHA3-256WITHRSA"] = "SHA3-256withRSA";
+            AlgorithmMap["SHA3-256WITHRSAENCRYPTION"] = "SHA3-256withRSA";
+            AlgorithmMap[NistObjectIdentifiers.IdRsassaPkcs1V15WithSha3_256.Id] = "SHA3-256withRSA";
+            AlgorithmMap["SHA3-384WITHRSA"] = "SHA3-384withRSA";
+            AlgorithmMap["SHA3-384WITHRSAENCRYPTION"] = "SHA3-384withRSA";
+            AlgorithmMap[NistObjectIdentifiers.IdRsassaPkcs1V15WithSha3_384.Id] = "SHA3-384withRSA";
+            AlgorithmMap["SHA3-512WITHRSA"] = "SHA3-512withRSA";
+            AlgorithmMap["SHA3-512WITHRSAENCRYPTION"] = "SHA3-512withRSA";
+            AlgorithmMap[NistObjectIdentifiers.IdRsassaPkcs1V15WithSha3_512.Id] = "SHA3-512withRSA";
+
+            AlgorithmMap["PSSWITHRSA"] = "PSSwithRSA";
+            AlgorithmMap["RSASSA-PSS"] = "PSSwithRSA";
+            AlgorithmMap[PkcsObjectIdentifiers.IdRsassaPss.Id] = "PSSwithRSA";
+            AlgorithmMap["RSAPSS"] = "PSSwithRSA";
+
+            AlgorithmMap["SHA1WITHRSAANDMGF1"] = "SHA-1withRSAandMGF1";
+            AlgorithmMap["SHA-1WITHRSAANDMGF1"] = "SHA-1withRSAandMGF1";
+            AlgorithmMap["SHA1WITHRSA/PSS"] = "SHA-1withRSAandMGF1";
+            AlgorithmMap["SHA-1WITHRSA/PSS"] = "SHA-1withRSAandMGF1";
+            AlgorithmMap["SHA1WITHRSASSA-PSS"] = "SHA-1withRSAandMGF1";
+            AlgorithmMap["SHA-1WITHRSASSA-PSS"] = "SHA-1withRSAandMGF1";
+
+            AlgorithmMap["SHA224WITHRSAANDMGF1"] = "SHA-224withRSAandMGF1";
+            AlgorithmMap["SHA-224WITHRSAANDMGF1"] = "SHA-224withRSAandMGF1";
+            AlgorithmMap["SHA224WITHRSA/PSS"] = "SHA-224withRSAandMGF1";
+            AlgorithmMap["SHA-224WITHRSA/PSS"] = "SHA-224withRSAandMGF1";
+            AlgorithmMap["SHA224WITHRSASSA-PSS"] = "SHA-224withRSAandMGF1";
+            AlgorithmMap["SHA-224WITHRSASSA-PSS"] = "SHA-224withRSAandMGF1";
+
+            AlgorithmMap["SHA256WITHRSAANDMGF1"] = "SHA-256withRSAandMGF1";
+            AlgorithmMap["SHA-256WITHRSAANDMGF1"] = "SHA-256withRSAandMGF1";
+            AlgorithmMap["SHA256WITHRSA/PSS"] = "SHA-256withRSAandMGF1";
+            AlgorithmMap["SHA-256WITHRSA/PSS"] = "SHA-256withRSAandMGF1";
+            AlgorithmMap["SHA256WITHRSASSA-PSS"] = "SHA-256withRSAandMGF1";
+            AlgorithmMap["SHA-256WITHRSASSA-PSS"] = "SHA-256withRSAandMGF1";
+
+            AlgorithmMap["SHA384WITHRSAANDMGF1"] = "SHA-384withRSAandMGF1";
+            AlgorithmMap["SHA-384WITHRSAANDMGF1"] = "SHA-384withRSAandMGF1";
+            AlgorithmMap["SHA384WITHRSA/PSS"] = "SHA-384withRSAandMGF1";
+            AlgorithmMap["SHA-384WITHRSA/PSS"] = "SHA-384withRSAandMGF1";
+            AlgorithmMap["SHA384WITHRSASSA-PSS"] = "SHA-384withRSAandMGF1";
+            AlgorithmMap["SHA-384WITHRSASSA-PSS"] = "SHA-384withRSAandMGF1";
+
+            AlgorithmMap["SHA512WITHRSAANDMGF1"] = "SHA-512withRSAandMGF1";
+            AlgorithmMap["SHA-512WITHRSAANDMGF1"] = "SHA-512withRSAandMGF1";
+            AlgorithmMap["SHA512WITHRSA/PSS"] = "SHA-512withRSAandMGF1";
+            AlgorithmMap["SHA-512WITHRSA/PSS"] = "SHA-512withRSAandMGF1";
+            AlgorithmMap["SHA512WITHRSASSA-PSS"] = "SHA-512withRSAandMGF1";
+            AlgorithmMap["SHA-512WITHRSASSA-PSS"] = "SHA-512withRSAandMGF1";
+
+            AlgorithmMap["RIPEMD128WITHRSA"] = "RIPEMD128withRSA";
+            AlgorithmMap["RIPEMD128WITHRSAENCRYPTION"] = "RIPEMD128withRSA";
+            AlgorithmMap[TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD128.Id] = "RIPEMD128withRSA";
+
+            AlgorithmMap["RIPEMD160WITHRSA"] = "RIPEMD160withRSA";
+            AlgorithmMap["RIPEMD160WITHRSAENCRYPTION"] = "RIPEMD160withRSA";
+            AlgorithmMap[TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD160.Id] = "RIPEMD160withRSA";
+
+            AlgorithmMap["RIPEMD256WITHRSA"] = "RIPEMD256withRSA";
+            AlgorithmMap["RIPEMD256WITHRSAENCRYPTION"] = "RIPEMD256withRSA";
+            AlgorithmMap[TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD256.Id] = "RIPEMD256withRSA";
+
+            AlgorithmMap["NONEWITHRSA"] = "RSA";
+            AlgorithmMap["RSAWITHNONE"] = "RSA";
+            AlgorithmMap["RAWRSA"] = "RSA";
+
+            AlgorithmMap["RAWRSAPSS"] = "RAWRSASSA-PSS";
+            AlgorithmMap["NONEWITHRSAPSS"] = "RAWRSASSA-PSS";
+            AlgorithmMap["NONEWITHRSASSA-PSS"] = "RAWRSASSA-PSS";
+
+            AlgorithmMap["NONEWITHDSA"] = "NONEwithDSA";
+            AlgorithmMap["DSAWITHNONE"] = "NONEwithDSA";
+            AlgorithmMap["RAWDSA"] = "NONEwithDSA";
+
+            AlgorithmMap["DSA"] = "SHA-1withDSA";
+            AlgorithmMap["DSAWITHSHA1"] = "SHA-1withDSA";
+            AlgorithmMap["DSAWITHSHA-1"] = "SHA-1withDSA";
+            AlgorithmMap["SHA/DSA"] = "SHA-1withDSA";
+            AlgorithmMap["SHA1/DSA"] = "SHA-1withDSA";
+            AlgorithmMap["SHA-1/DSA"] = "SHA-1withDSA";
+            AlgorithmMap["SHA1WITHDSA"] = "SHA-1withDSA";
+            AlgorithmMap["SHA-1WITHDSA"] = "SHA-1withDSA";
+            AlgorithmMap[X9ObjectIdentifiers.IdDsaWithSha1.Id] = "SHA-1withDSA";
+            AlgorithmMap[OiwObjectIdentifiers.DsaWithSha1.Id] = "SHA-1withDSA";
+
+            AlgorithmMap["DSAWITHSHA224"] = "SHA-224withDSA";
+            AlgorithmMap["DSAWITHSHA-224"] = "SHA-224withDSA";
+            AlgorithmMap["SHA224/DSA"] = "SHA-224withDSA";
+            AlgorithmMap["SHA-224/DSA"] = "SHA-224withDSA";
+            AlgorithmMap["SHA224WITHDSA"] = "SHA-224withDSA";
+            AlgorithmMap["SHA-224WITHDSA"] = "SHA-224withDSA";
+            AlgorithmMap[NistObjectIdentifiers.DsaWithSha224.Id] = "SHA-224withDSA";
+
+            AlgorithmMap["DSAWITHSHA256"] = "SHA-256withDSA";
+            AlgorithmMap["DSAWITHSHA-256"] = "SHA-256withDSA";
+            AlgorithmMap["SHA256/DSA"] = "SHA-256withDSA";
+            AlgorithmMap["SHA-256/DSA"] = "SHA-256withDSA";
+            AlgorithmMap["SHA256WITHDSA"] = "SHA-256withDSA";
+            AlgorithmMap["SHA-256WITHDSA"] = "SHA-256withDSA";
+            AlgorithmMap[NistObjectIdentifiers.DsaWithSha256.Id] = "SHA-256withDSA";
+
+            AlgorithmMap["DSAWITHSHA384"] = "SHA-384withDSA";
+            AlgorithmMap["DSAWITHSHA-384"] = "SHA-384withDSA";
+            AlgorithmMap["SHA384/DSA"] = "SHA-384withDSA";
+            AlgorithmMap["SHA-384/DSA"] = "SHA-384withDSA";
+            AlgorithmMap["SHA384WITHDSA"] = "SHA-384withDSA";
+            AlgorithmMap["SHA-384WITHDSA"] = "SHA-384withDSA";
+            AlgorithmMap[NistObjectIdentifiers.DsaWithSha384.Id] = "SHA-384withDSA";
+
+            AlgorithmMap["DSAWITHSHA512"] = "SHA-512withDSA";
+            AlgorithmMap["DSAWITHSHA-512"] = "SHA-512withDSA";
+            AlgorithmMap["SHA512/DSA"] = "SHA-512withDSA";
+            AlgorithmMap["SHA-512/DSA"] = "SHA-512withDSA";
+            AlgorithmMap["SHA512WITHDSA"] = "SHA-512withDSA";
+            AlgorithmMap["SHA-512WITHDSA"] = "SHA-512withDSA";
+            AlgorithmMap[NistObjectIdentifiers.DsaWithSha512.Id] = "SHA-512withDSA";
+
+            AlgorithmMap["NONEWITHECDSA"] = "NONEwithECDSA";
+            AlgorithmMap["ECDSAWITHNONE"] = "NONEwithECDSA";
+
+            AlgorithmMap["ECDSA"] = "SHA-1withECDSA";
+            AlgorithmMap["SHA1/ECDSA"] = "SHA-1withECDSA";
+            AlgorithmMap["SHA-1/ECDSA"] = "SHA-1withECDSA";
+            AlgorithmMap["ECDSAWITHSHA1"] = "SHA-1withECDSA";
+            AlgorithmMap["ECDSAWITHSHA-1"] = "SHA-1withECDSA";
+            AlgorithmMap["SHA1WITHECDSA"] = "SHA-1withECDSA";
+            AlgorithmMap["SHA-1WITHECDSA"] = "SHA-1withECDSA";
+            AlgorithmMap[X9ObjectIdentifiers.ECDsaWithSha1.Id] = "SHA-1withECDSA";
+            AlgorithmMap[TeleTrusTObjectIdentifiers.ECSignWithSha1.Id] = "SHA-1withECDSA";
+
+            AlgorithmMap["SHA224/ECDSA"] = "SHA-224withECDSA";
+            AlgorithmMap["SHA-224/ECDSA"] = "SHA-224withECDSA";
+            AlgorithmMap["ECDSAWITHSHA224"] = "SHA-224withECDSA";
+            AlgorithmMap["ECDSAWITHSHA-224"] = "SHA-224withECDSA";
+            AlgorithmMap["SHA224WITHECDSA"] = "SHA-224withECDSA";
+            AlgorithmMap["SHA-224WITHECDSA"] = "SHA-224withECDSA";
+            AlgorithmMap[X9ObjectIdentifiers.ECDsaWithSha224.Id] = "SHA-224withECDSA";
+
+            AlgorithmMap["SHA256/ECDSA"] = "SHA-256withECDSA";
+            AlgorithmMap["SHA-256/ECDSA"] = "SHA-256withECDSA";
+            AlgorithmMap["ECDSAWITHSHA256"] = "SHA-256withECDSA";
+            AlgorithmMap["ECDSAWITHSHA-256"] = "SHA-256withECDSA";
+            AlgorithmMap["SHA256WITHECDSA"] = "SHA-256withECDSA";
+            AlgorithmMap["SHA-256WITHECDSA"] = "SHA-256withECDSA";
+            AlgorithmMap[X9ObjectIdentifiers.ECDsaWithSha256.Id] = "SHA-256withECDSA";
+
+            AlgorithmMap["SHA384/ECDSA"] = "SHA-384withECDSA";
+            AlgorithmMap["SHA-384/ECDSA"] = "SHA-384withECDSA";
+            AlgorithmMap["ECDSAWITHSHA384"] = "SHA-384withECDSA";
+            AlgorithmMap["ECDSAWITHSHA-384"] = "SHA-384withECDSA";
+            AlgorithmMap["SHA384WITHECDSA"] = "SHA-384withECDSA";
+            AlgorithmMap["SHA-384WITHECDSA"] = "SHA-384withECDSA";
+            AlgorithmMap[X9ObjectIdentifiers.ECDsaWithSha384.Id] = "SHA-384withECDSA";
+
+            AlgorithmMap["SHA512/ECDSA"] = "SHA-512withECDSA";
+            AlgorithmMap["SHA-512/ECDSA"] = "SHA-512withECDSA";
+            AlgorithmMap["ECDSAWITHSHA512"] = "SHA-512withECDSA";
+            AlgorithmMap["ECDSAWITHSHA-512"] = "SHA-512withECDSA";
+            AlgorithmMap["SHA512WITHECDSA"] = "SHA-512withECDSA";
+            AlgorithmMap["SHA-512WITHECDSA"] = "SHA-512withECDSA";
+            AlgorithmMap[X9ObjectIdentifiers.ECDsaWithSha512.Id] = "SHA-512withECDSA";
+
+            AlgorithmMap["RIPEMD160/ECDSA"] = "RIPEMD160withECDSA";
+            AlgorithmMap["ECDSAWITHRIPEMD160"] = "RIPEMD160withECDSA";
+            AlgorithmMap["RIPEMD160WITHECDSA"] = "RIPEMD160withECDSA";
+            AlgorithmMap[TeleTrusTObjectIdentifiers.ECSignWithRipeMD160.Id] = "RIPEMD160withECDSA";
+
+            AlgorithmMap["NONEWITHCVC-ECDSA"] = "NONEwithCVC-ECDSA";
+            AlgorithmMap["CVC-ECDSAWITHNONE"] = "NONEwithCVC-ECDSA";
+
+            AlgorithmMap["SHA1/CVC-ECDSA"] = "SHA-1withCVC-ECDSA";
+            AlgorithmMap["SHA-1/CVC-ECDSA"] = "SHA-1withCVC-ECDSA";
+            AlgorithmMap["CVC-ECDSAWITHSHA1"] = "SHA-1withCVC-ECDSA";
+            AlgorithmMap["CVC-ECDSAWITHSHA-1"] = "SHA-1withCVC-ECDSA";
+            AlgorithmMap["SHA1WITHCVC-ECDSA"] = "SHA-1withCVC-ECDSA";
+            AlgorithmMap["SHA-1WITHCVC-ECDSA"] = "SHA-1withCVC-ECDSA";
+            AlgorithmMap[EacObjectIdentifiers.id_TA_ECDSA_SHA_1.Id] = "SHA-1withCVC-ECDSA";
+
+            AlgorithmMap["SHA224/CVC-ECDSA"] = "SHA-224withCVC-ECDSA";
+            AlgorithmMap["SHA-224/CVC-ECDSA"] = "SHA-224withCVC-ECDSA";
+            AlgorithmMap["CVC-ECDSAWITHSHA224"] = "SHA-224withCVC-ECDSA";
+            AlgorithmMap["CVC-ECDSAWITHSHA-224"] = "SHA-224withCVC-ECDSA";
+            AlgorithmMap["SHA224WITHCVC-ECDSA"] = "SHA-224withCVC-ECDSA";
+            AlgorithmMap["SHA-224WITHCVC-ECDSA"] = "SHA-224withCVC-ECDSA";
+            AlgorithmMap[EacObjectIdentifiers.id_TA_ECDSA_SHA_224.Id] = "SHA-224withCVC-ECDSA";
+
+            AlgorithmMap["SHA256/CVC-ECDSA"] = "SHA-256withCVC-ECDSA";
+            AlgorithmMap["SHA-256/CVC-ECDSA"] = "SHA-256withCVC-ECDSA";
+            AlgorithmMap["CVC-ECDSAWITHSHA256"] = "SHA-256withCVC-ECDSA";
+            AlgorithmMap["CVC-ECDSAWITHSHA-256"] = "SHA-256withCVC-ECDSA";
+            AlgorithmMap["SHA256WITHCVC-ECDSA"] = "SHA-256withCVC-ECDSA";
+            AlgorithmMap["SHA-256WITHCVC-ECDSA"] = "SHA-256withCVC-ECDSA";
+            AlgorithmMap[EacObjectIdentifiers.id_TA_ECDSA_SHA_256.Id] = "SHA-256withCVC-ECDSA";
+
+            AlgorithmMap["SHA384/CVC-ECDSA"] = "SHA-384withCVC-ECDSA";
+            AlgorithmMap["SHA-384/CVC-ECDSA"] = "SHA-384withCVC-ECDSA";
+            AlgorithmMap["CVC-ECDSAWITHSHA384"] = "SHA-384withCVC-ECDSA";
+            AlgorithmMap["CVC-ECDSAWITHSHA-384"] = "SHA-384withCVC-ECDSA";
+            AlgorithmMap["SHA384WITHCVC-ECDSA"] = "SHA-384withCVC-ECDSA";
+            AlgorithmMap["SHA-384WITHCVC-ECDSA"] = "SHA-384withCVC-ECDSA";
+            AlgorithmMap[EacObjectIdentifiers.id_TA_ECDSA_SHA_384.Id] = "SHA-384withCVC-ECDSA";
+
+            AlgorithmMap["SHA512/CVC-ECDSA"] = "SHA-512withCVC-ECDSA";
+            AlgorithmMap["SHA-512/CVC-ECDSA"] = "SHA-512withCVC-ECDSA";
+            AlgorithmMap["CVC-ECDSAWITHSHA512"] = "SHA-512withCVC-ECDSA";
+            AlgorithmMap["CVC-ECDSAWITHSHA-512"] = "SHA-512withCVC-ECDSA";
+            AlgorithmMap["SHA512WITHCVC-ECDSA"] = "SHA-512withCVC-ECDSA";
+            AlgorithmMap["SHA-512WITHCVC-ECDSA"] = "SHA-512withCVC-ECDSA";
+            AlgorithmMap[EacObjectIdentifiers.id_TA_ECDSA_SHA_512.Id] = "SHA-512withCVC-ECDSA";
+
+            AlgorithmMap["NONEWITHPLAIN-ECDSA"] = "NONEwithPLAIN-ECDSA";
+            AlgorithmMap["PLAIN-ECDSAWITHNONE"] = "NONEwithPLAIN-ECDSA";
+
+            AlgorithmMap["SHA1/PLAIN-ECDSA"] = "SHA-1withPLAIN-ECDSA";
+            AlgorithmMap["SHA-1/PLAIN-ECDSA"] = "SHA-1withPLAIN-ECDSA";
+            AlgorithmMap["PLAIN-ECDSAWITHSHA1"] = "SHA-1withPLAIN-ECDSA";
+            AlgorithmMap["PLAIN-ECDSAWITHSHA-1"] = "SHA-1withPLAIN-ECDSA";
+            AlgorithmMap["SHA1WITHPLAIN-ECDSA"] = "SHA-1withPLAIN-ECDSA";
+            AlgorithmMap["SHA-1WITHPLAIN-ECDSA"] = "SHA-1withPLAIN-ECDSA";
+            AlgorithmMap[BsiObjectIdentifiers.ecdsa_plain_SHA1.Id] = "SHA-1withPLAIN-ECDSA";
+
+            AlgorithmMap["SHA224/PLAIN-ECDSA"] = "SHA-224withPLAIN-ECDSA";
+            AlgorithmMap["SHA-224/PLAIN-ECDSA"] = "SHA-224withPLAIN-ECDSA";
+            AlgorithmMap["PLAIN-ECDSAWITHSHA224"] = "SHA-224withPLAIN-ECDSA";
+            AlgorithmMap["PLAIN-ECDSAWITHSHA-224"] = "SHA-224withPLAIN-ECDSA";
+            AlgorithmMap["SHA224WITHPLAIN-ECDSA"] = "SHA-224withPLAIN-ECDSA";
+            AlgorithmMap["SHA-224WITHPLAIN-ECDSA"] = "SHA-224withPLAIN-ECDSA";
+            AlgorithmMap[BsiObjectIdentifiers.ecdsa_plain_SHA224.Id] = "SHA-224withPLAIN-ECDSA";
+
+            AlgorithmMap["SHA256/PLAIN-ECDSA"] = "SHA-256withPLAIN-ECDSA";
+            AlgorithmMap["SHA-256/PLAIN-ECDSA"] = "SHA-256withPLAIN-ECDSA";
+            AlgorithmMap["PLAIN-ECDSAWITHSHA256"] = "SHA-256withPLAIN-ECDSA";
+            AlgorithmMap["PLAIN-ECDSAWITHSHA-256"] = "SHA-256withPLAIN-ECDSA";
+            AlgorithmMap["SHA256WITHPLAIN-ECDSA"] = "SHA-256withPLAIN-ECDSA";
+            AlgorithmMap["SHA-256WITHPLAIN-ECDSA"] = "SHA-256withPLAIN-ECDSA";
+            AlgorithmMap[BsiObjectIdentifiers.ecdsa_plain_SHA256.Id] = "SHA-256withPLAIN-ECDSA";
+
+            AlgorithmMap["SHA384/PLAIN-ECDSA"] = "SHA-384withPLAIN-ECDSA";
+            AlgorithmMap["SHA-384/PLAIN-ECDSA"] = "SHA-384withPLAIN-ECDSA";
+            AlgorithmMap["PLAIN-ECDSAWITHSHA384"] = "SHA-384withPLAIN-ECDSA";
+            AlgorithmMap["PLAIN-ECDSAWITHSHA-384"] = "SHA-384withPLAIN-ECDSA";
+            AlgorithmMap["SHA384WITHPLAIN-ECDSA"] = "SHA-384withPLAIN-ECDSA";
+            AlgorithmMap["SHA-384WITHPLAIN-ECDSA"] = "SHA-384withPLAIN-ECDSA";
+            AlgorithmMap[BsiObjectIdentifiers.ecdsa_plain_SHA384.Id] = "SHA-384withPLAIN-ECDSA";
+
+            AlgorithmMap["SHA512/PLAIN-ECDSA"] = "SHA-512withPLAIN-ECDSA";
+            AlgorithmMap["SHA-512/PLAIN-ECDSA"] = "SHA-512withPLAIN-ECDSA";
+            AlgorithmMap["PLAIN-ECDSAWITHSHA512"] = "SHA-512withPLAIN-ECDSA";
+            AlgorithmMap["PLAIN-ECDSAWITHSHA-512"] = "SHA-512withPLAIN-ECDSA";
+            AlgorithmMap["SHA512WITHPLAIN-ECDSA"] = "SHA-512withPLAIN-ECDSA";
+            AlgorithmMap["SHA-512WITHPLAIN-ECDSA"] = "SHA-512withPLAIN-ECDSA";
+            AlgorithmMap[BsiObjectIdentifiers.ecdsa_plain_SHA512.Id] = "SHA-512withPLAIN-ECDSA";
+
+            AlgorithmMap["RIPEMD160/PLAIN-ECDSA"] = "RIPEMD160withPLAIN-ECDSA";
+            AlgorithmMap["PLAIN-ECDSAWITHRIPEMD160"] = "RIPEMD160withPLAIN-ECDSA";
+            AlgorithmMap["RIPEMD160WITHPLAIN-ECDSA"] = "RIPEMD160withPLAIN-ECDSA";
+            AlgorithmMap[BsiObjectIdentifiers.ecdsa_plain_RIPEMD160.Id] = "RIPEMD160withPLAIN-ECDSA";
+
+            AlgorithmMap["SHA1WITHECNR"] = "SHA-1withECNR";
+            AlgorithmMap["SHA-1WITHECNR"] = "SHA-1withECNR";
+            AlgorithmMap["SHA224WITHECNR"] = "SHA-224withECNR";
+            AlgorithmMap["SHA-224WITHECNR"] = "SHA-224withECNR";
+            AlgorithmMap["SHA256WITHECNR"] = "SHA-256withECNR";
+            AlgorithmMap["SHA-256WITHECNR"] = "SHA-256withECNR";
+            AlgorithmMap["SHA384WITHECNR"] = "SHA-384withECNR";
+            AlgorithmMap["SHA-384WITHECNR"] = "SHA-384withECNR";
+            AlgorithmMap["SHA512WITHECNR"] = "SHA-512withECNR";
+            AlgorithmMap["SHA-512WITHECNR"] = "SHA-512withECNR";
+
+            AlgorithmMap["GOST-3410"] = "GOST3410";
+            AlgorithmMap["GOST-3410-94"] = "GOST3410";
+            AlgorithmMap["GOST3411WITHGOST3410"] = "GOST3410";
+            AlgorithmMap[CryptoProObjectIdentifiers.GostR3411x94WithGostR3410x94.Id] = "GOST3410";
+
+            AlgorithmMap["ECGOST-3410"] = "ECGOST3410";
+            AlgorithmMap["ECGOST-3410-2001"] = "ECGOST3410";
+            AlgorithmMap["GOST3411WITHECGOST3410"] = "ECGOST3410";
+            AlgorithmMap[CryptoProObjectIdentifiers.GostR3411x94WithGostR3410x2001.Id] = "ECGOST3410";
+
+            AlgorithmMap["ED25519"] = "Ed25519";
+            AlgorithmMap[EdECObjectIdentifiers.id_Ed25519.Id] = "Ed25519";
+            AlgorithmMap["ED25519CTX"] = "Ed25519ctx";
+            AlgorithmMap["ED25519PH"] = "Ed25519ph";
+            AlgorithmMap["ED448"] = "Ed448";
+            AlgorithmMap[EdECObjectIdentifiers.id_Ed448.Id] = "Ed448";
+            AlgorithmMap["ED448PH"] = "Ed448ph";
+
+            AlgorithmMap["SHA256WITHSM2"] = "SHA256withSM2";
+            AlgorithmMap[GMObjectIdentifiers.sm2sign_with_sha256.Id] = "SHA256withSM2";
+            AlgorithmMap["SM3WITHSM2"] = "SM3withSM2";
+            AlgorithmMap[GMObjectIdentifiers.sm2sign_with_sm3.Id] = "SM3withSM2";
+
+            Oids["MD2withRSA"] = PkcsObjectIdentifiers.MD2WithRsaEncryption;
+            Oids["MD4withRSA"] = PkcsObjectIdentifiers.MD4WithRsaEncryption;
+            Oids["MD5withRSA"] = PkcsObjectIdentifiers.MD5WithRsaEncryption;
+
+            Oids["SHA-1withRSA"] = PkcsObjectIdentifiers.Sha1WithRsaEncryption;
+            Oids["SHA-224withRSA"] = PkcsObjectIdentifiers.Sha224WithRsaEncryption;
+            Oids["SHA-256withRSA"] = PkcsObjectIdentifiers.Sha256WithRsaEncryption;
+            Oids["SHA-384withRSA"] = PkcsObjectIdentifiers.Sha384WithRsaEncryption;
+            Oids["SHA-512withRSA"] = PkcsObjectIdentifiers.Sha512WithRsaEncryption;
+            Oids["SHA-512(224)withRSA"] = PkcsObjectIdentifiers.Sha512_224WithRSAEncryption;
+            Oids["SHA-512(256)withRSA"] = PkcsObjectIdentifiers.Sha512_256WithRSAEncryption;
+            Oids["SHA3-224withRSA"] = NistObjectIdentifiers.IdRsassaPkcs1V15WithSha3_224;
+            Oids["SHA3-256withRSA"] = NistObjectIdentifiers.IdRsassaPkcs1V15WithSha3_256;
+            Oids["SHA3-384withRSA"] = NistObjectIdentifiers.IdRsassaPkcs1V15WithSha3_384;
+            Oids["SHA3-512withRSA"] = NistObjectIdentifiers.IdRsassaPkcs1V15WithSha3_512;
+
+            Oids["PSSwithRSA"] = PkcsObjectIdentifiers.IdRsassaPss;
+            Oids["SHA-1withRSAandMGF1"] = PkcsObjectIdentifiers.IdRsassaPss;
+            Oids["SHA-224withRSAandMGF1"] = PkcsObjectIdentifiers.IdRsassaPss;
+            Oids["SHA-256withRSAandMGF1"] = PkcsObjectIdentifiers.IdRsassaPss;
+            Oids["SHA-384withRSAandMGF1"] = PkcsObjectIdentifiers.IdRsassaPss;
+            Oids["SHA-512withRSAandMGF1"] = PkcsObjectIdentifiers.IdRsassaPss;
+
+            Oids["RIPEMD128withRSA"] = TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD128;
+            Oids["RIPEMD160withRSA"] = TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD160;
+            Oids["RIPEMD256withRSA"] = TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD256;
+
+            Oids["SHA-1withDSA"] = X9ObjectIdentifiers.IdDsaWithSha1;
+
+            Oids["SHA-1withECDSA"] = X9ObjectIdentifiers.ECDsaWithSha1;
+            Oids["SHA-224withECDSA"] = X9ObjectIdentifiers.ECDsaWithSha224;
+            Oids["SHA-256withECDSA"] = X9ObjectIdentifiers.ECDsaWithSha256;
+            Oids["SHA-384withECDSA"] = X9ObjectIdentifiers.ECDsaWithSha384;
+            Oids["SHA-512withECDSA"] = X9ObjectIdentifiers.ECDsaWithSha512;
+            Oids["RIPEMD160withECDSA"] = TeleTrusTObjectIdentifiers.ECSignWithRipeMD160;
+
+            Oids["SHA-1withCVC-ECDSA"] = EacObjectIdentifiers.id_TA_ECDSA_SHA_1;
+            Oids["SHA-224withCVC-ECDSA"] = EacObjectIdentifiers.id_TA_ECDSA_SHA_224;
+            Oids["SHA-256withCVC-ECDSA"] = EacObjectIdentifiers.id_TA_ECDSA_SHA_256;
+            Oids["SHA-384withCVC-ECDSA"] = EacObjectIdentifiers.id_TA_ECDSA_SHA_384;
+            Oids["SHA-512withCVC-ECDSA"] = EacObjectIdentifiers.id_TA_ECDSA_SHA_512;
+
+            Oids["SHA-1withPLAIN-ECDSA"] = BsiObjectIdentifiers.ecdsa_plain_SHA1;
+            Oids["SHA-224withPLAIN-ECDSA"] = BsiObjectIdentifiers.ecdsa_plain_SHA224;
+            Oids["SHA-256withPLAIN-ECDSA"] = BsiObjectIdentifiers.ecdsa_plain_SHA256;
+            Oids["SHA-384withPLAIN-ECDSA"] = BsiObjectIdentifiers.ecdsa_plain_SHA384;
+            Oids["SHA-512withPLAIN-ECDSA"] = BsiObjectIdentifiers.ecdsa_plain_SHA512;
+            Oids["RIPEMD160withPLAIN-ECDSA"] = BsiObjectIdentifiers.ecdsa_plain_RIPEMD160;
+
+            Oids["GOST3410"] = CryptoProObjectIdentifiers.GostR3411x94WithGostR3410x94;
+            Oids["ECGOST3410"] = CryptoProObjectIdentifiers.GostR3411x94WithGostR3410x2001;
+
+            Oids["Ed25519"] = EdECObjectIdentifiers.id_Ed25519;
+            Oids["Ed448"] = EdECObjectIdentifiers.id_Ed448;
+
+            Oids["SHA256withSM2"] = GMObjectIdentifiers.sm2sign_with_sha256;
+            Oids["SM3withSM2"] = GMObjectIdentifiers.sm2sign_with_sm3;
         }
 
         /// <summary>
@@ -455,44 +452,32 @@ namespace Org.BouncyCastle.Security
         /// <param name="mechanism">A string representation of the encoding.</param>
         /// <returns>A DerObjectIdentifier, null if the OID is not available.</returns>
         // TODO Don't really want to support this
-        public static DerObjectIdentifier GetObjectIdentifier(
-            string mechanism)
+        public static DerObjectIdentifier GetObjectIdentifier(string mechanism)
         {
             if (mechanism == null)
-                throw new ArgumentNullException("mechanism");
+                throw new ArgumentNullException(nameof(mechanism));
 
-            mechanism = Platform.ToUpperInvariant(mechanism);
-            string aliased = (string) algorithms[mechanism];
+            string algorithm = CollectionUtilities.GetValueOrKey(AlgorithmMap, mechanism);
 
-            if (aliased != null)
-                mechanism = aliased;
-
-            return (DerObjectIdentifier) oids[mechanism];
+            return CollectionUtilities.GetValueOrNull(Oids, algorithm);
         }
 
-        public static ICollection Algorithms
+        public static ICollection<string> Algorithms
         {
-            get { return oids.Keys; }
+            get { return CollectionUtilities.ReadOnly(Oids.Keys); }
         }
 
-        public static Asn1Encodable GetDefaultX509Parameters(
-            DerObjectIdentifier id)
+        public static Asn1Encodable GetDefaultX509Parameters(DerObjectIdentifier id)
         {
             return GetDefaultX509Parameters(id.Id);
         }
 
-        public static Asn1Encodable GetDefaultX509Parameters(
-            string algorithm)
+        public static Asn1Encodable GetDefaultX509Parameters(string algorithm)
         {
             if (algorithm == null)
-                throw new ArgumentNullException("algorithm");
-
-            algorithm = Platform.ToUpperInvariant(algorithm);
+                throw new ArgumentNullException(nameof(algorithm));
 
-            string mechanism = (string) algorithms[algorithm];
-
-            if (mechanism == null)
-                mechanism = algorithm;
+            string mechanism = CollectionUtilities.GetValueOrKey(AlgorithmMap, algorithm);
 
             if (mechanism == "PSSwithRSA")
             {
@@ -525,24 +510,17 @@ namespace Org.BouncyCastle.Security
                 new DerInteger(saltLen), new DerInteger(1));
         }
 
-        public static ISigner GetSigner(
-            DerObjectIdentifier id)
+        public static ISigner GetSigner(DerObjectIdentifier id)
         {
             return GetSigner(id.Id);
         }
 
-        public static ISigner GetSigner(
-            string algorithm)
+        public static ISigner GetSigner(string algorithm)
         {
             if (algorithm == null)
-                throw new ArgumentNullException("algorithm");
-
-            algorithm = Platform.ToUpperInvariant(algorithm);
+                throw new ArgumentNullException(nameof(algorithm));
 
-            string mechanism = (string) algorithms[algorithm];
-
-            if (mechanism == null)
-                mechanism = algorithm;
+            string mechanism = CollectionUtilities.GetValueOrKey(AlgorithmMap, algorithm.ToUpperInvariant());
 
             if (Platform.StartsWith(mechanism, "Ed"))
             {
@@ -677,10 +655,9 @@ namespace Org.BouncyCastle.Security
             throw new SecurityUtilityException("Signer " + algorithm + " not recognised.");
         }
 
-        public static string GetEncodingName(
-            DerObjectIdentifier oid)
+        public static string GetEncodingName(DerObjectIdentifier oid)
         {
-            return (string) algorithms[oid.Id];
+            return CollectionUtilities.GetValueOrNull(AlgorithmMap, oid.Id);
         }
 
         public static ISigner InitSigner(DerObjectIdentifier algorithmOid, bool forSigning, AsymmetricKeyParameter privateKey, SecureRandom random)
diff --git a/crypto/src/security/WrapperUtilities.cs b/crypto/src/security/WrapperUtilities.cs
index c57632081..983ff824c 100644
--- a/crypto/src/security/WrapperUtilities.cs
+++ b/crypto/src/security/WrapperUtilities.cs
@@ -1,5 +1,5 @@
 using System;
-using System.Collections;
+using System.Collections.Generic;
 
 using Org.BouncyCastle.Asn1;
 using Org.BouncyCastle.Asn1.Kisa;
@@ -9,61 +9,50 @@ using Org.BouncyCastle.Asn1.Pkcs;
 using Org.BouncyCastle.Crypto;
 using Org.BouncyCastle.Crypto.Engines;
 using Org.BouncyCastle.Utilities;
+using Org.BouncyCastle.Utilities.Collections;
 
 namespace Org.BouncyCastle.Security
 {
     /// <remarks>
     ///  Utility class for creating IWrapper objects from their names/Oids
     /// </remarks>
-    public sealed class WrapperUtilities
+    public static class WrapperUtilities
     {
         private enum WrapAlgorithm { AESWRAP, CAMELLIAWRAP, DESEDEWRAP, RC2WRAP, SEEDWRAP,
             DESEDERFC3211WRAP, AESRFC3211WRAP, CAMELLIARFC3211WRAP };
 
-        private WrapperUtilities()
-        {
-        }
-
-        private static readonly IDictionary algorithms = Platform.CreateHashtable();
-        //private static readonly IDictionary oids = Platform.CreateHashtable();
+        private static readonly IDictionary<string, string> Algorithms =
+            new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
 
         static WrapperUtilities()
         {
             // Signal to obfuscation tools not to change enum constants
             ((WrapAlgorithm)Enums.GetArbitraryValue(typeof(WrapAlgorithm))).ToString();
 
-            algorithms[NistObjectIdentifiers.IdAes128Wrap.Id] = "AESWRAP";
-            algorithms[NistObjectIdentifiers.IdAes192Wrap.Id] = "AESWRAP";
-            algorithms[NistObjectIdentifiers.IdAes256Wrap.Id] = "AESWRAP";
+            Algorithms[NistObjectIdentifiers.IdAes128Wrap.Id] = "AESWRAP";
+            Algorithms[NistObjectIdentifiers.IdAes192Wrap.Id] = "AESWRAP";
+            Algorithms[NistObjectIdentifiers.IdAes256Wrap.Id] = "AESWRAP";
 
-            algorithms[NttObjectIdentifiers.IdCamellia128Wrap.Id] = "CAMELLIAWRAP";
-            algorithms[NttObjectIdentifiers.IdCamellia192Wrap.Id] = "CAMELLIAWRAP";
-            algorithms[NttObjectIdentifiers.IdCamellia256Wrap.Id] = "CAMELLIAWRAP";
+            Algorithms[NttObjectIdentifiers.IdCamellia128Wrap.Id] = "CAMELLIAWRAP";
+            Algorithms[NttObjectIdentifiers.IdCamellia192Wrap.Id] = "CAMELLIAWRAP";
+            Algorithms[NttObjectIdentifiers.IdCamellia256Wrap.Id] = "CAMELLIAWRAP";
 
-            algorithms[PkcsObjectIdentifiers.IdAlgCms3DesWrap.Id] = "DESEDEWRAP";
-            algorithms["TDEAWRAP"] = "DESEDEWRAP";
+            Algorithms[PkcsObjectIdentifiers.IdAlgCms3DesWrap.Id] = "DESEDEWRAP";
+            Algorithms["TDEAWRAP"] = "DESEDEWRAP";
 
-            algorithms[PkcsObjectIdentifiers.IdAlgCmsRC2Wrap.Id] = "RC2WRAP";
+            Algorithms[PkcsObjectIdentifiers.IdAlgCmsRC2Wrap.Id] = "RC2WRAP";
 
-            algorithms[KisaObjectIdentifiers.IdNpkiAppCmsSeedWrap.Id] = "SEEDWRAP";
+            Algorithms[KisaObjectIdentifiers.IdNpkiAppCmsSeedWrap.Id] = "SEEDWRAP";
         }
 
-        public static IWrapper GetWrapper(
-            DerObjectIdentifier oid)
+        public static IWrapper GetWrapper(DerObjectIdentifier oid)
         {
             return GetWrapper(oid.Id);
         }
 
-        public static IWrapper GetWrapper(
-            string algorithm)
+        public static IWrapper GetWrapper(string algorithm)
         {
-            string upper = Platform.ToUpperInvariant(algorithm);
-            string mechanism = (string)algorithms[upper];
-
-            if (mechanism == null)
-            {
-                mechanism = upper;
-            }
+            string mechanism = CollectionUtilities.GetValueOrKey(Algorithms, algorithm).ToUpperInvariant();
 
             try
             {
@@ -72,14 +61,14 @@ namespace Org.BouncyCastle.Security
 
                 switch (wrapAlgorithm)
                 {
-                    case WrapAlgorithm.AESWRAP:				return new AesWrapEngine();
-                    case WrapAlgorithm.CAMELLIAWRAP:		return new CamelliaWrapEngine();
-                    case WrapAlgorithm.DESEDEWRAP:			return new DesEdeWrapEngine();
-                    case WrapAlgorithm.RC2WRAP:				return new RC2WrapEngine();
-                    case WrapAlgorithm.SEEDWRAP:			return new SeedWrapEngine();
-                    case WrapAlgorithm.DESEDERFC3211WRAP:	return new Rfc3211WrapEngine(new DesEdeEngine());
-                    case WrapAlgorithm.AESRFC3211WRAP:		return new Rfc3211WrapEngine(new AesEngine());
-                    case WrapAlgorithm.CAMELLIARFC3211WRAP:	return new Rfc3211WrapEngine(new CamelliaEngine());
+                case WrapAlgorithm.AESWRAP:				return new AesWrapEngine();
+                case WrapAlgorithm.CAMELLIAWRAP:		return new CamelliaWrapEngine();
+                case WrapAlgorithm.DESEDEWRAP:			return new DesEdeWrapEngine();
+                case WrapAlgorithm.RC2WRAP:				return new RC2WrapEngine();
+                case WrapAlgorithm.SEEDWRAP:			return new SeedWrapEngine();
+                case WrapAlgorithm.DESEDERFC3211WRAP:	return new Rfc3211WrapEngine(new DesEdeEngine());
+                case WrapAlgorithm.AESRFC3211WRAP:		return new Rfc3211WrapEngine(new AesEngine());
+                case WrapAlgorithm.CAMELLIARFC3211WRAP:	return new Rfc3211WrapEngine(new CamelliaEngine());
                 }
             }
             catch (ArgumentException)
@@ -95,10 +84,9 @@ namespace Org.BouncyCastle.Security
             throw new SecurityUtilityException("Wrapper " + algorithm + " not recognised.");
         }
 
-        public static string GetAlgorithmName(
-            DerObjectIdentifier oid)
+        public static string GetAlgorithmName(DerObjectIdentifier oid)
         {
-            return (string) algorithms[oid.Id];
+            return CollectionUtilities.GetValueOrNull(Algorithms, oid.Id);
         }
 
         private class BufferedCipherWrapper