summary refs log tree commit diff
path: root/crypto/src/openssl
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-10-05 23:03:16 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-10-05 23:03:16 +0700
commit6d442f9319a857fe483af22d67bbd1677b0991a1 (patch)
treef3356e473c23680d6675defe770532fbb5b42cdc /crypto/src/openssl
parentDelete experimental code (diff)
downloadBouncyCastle.NET-ed25519-6d442f9319a857fe483af22d67bbd1677b0991a1.tar.xz
Use generics in Enums
Diffstat (limited to 'crypto/src/openssl')
-rw-r--r--crypto/src/openssl/PEMUtilities.cs12
1 files changed, 6 insertions, 6 deletions
diff --git a/crypto/src/openssl/PEMUtilities.cs b/crypto/src/openssl/PEMUtilities.cs
index b58e5e765..332768083 100644
--- a/crypto/src/openssl/PEMUtilities.cs
+++ b/crypto/src/openssl/PEMUtilities.cs
@@ -16,8 +16,8 @@ namespace Org.BouncyCastle.OpenSsl
 		static PemUtilities()
 		{
 			// Signal to obfuscation tools not to change enum constants
-			((PemBaseAlg)Enums.GetArbitraryValue(typeof(PemBaseAlg))).ToString();
-			((PemMode)Enums.GetArbitraryValue(typeof(PemMode))).ToString();
+			Enums.GetArbitraryValue<PemBaseAlg>().ToString();
+            Enums.GetArbitraryValue<PemMode>().ToString();
 		}
 
 		private static void ParseDekAlgName(
@@ -31,16 +31,16 @@ namespace Org.BouncyCastle.OpenSsl
 
 				if (dekAlgName == "DES-EDE" || dekAlgName == "DES-EDE3")
 				{
-					baseAlg = (PemBaseAlg)Enums.GetEnumValue(typeof(PemBaseAlg), dekAlgName);
+					baseAlg = Enums.GetEnumValue<PemBaseAlg>(dekAlgName);
 					return;
 				}
 
 				int pos = dekAlgName.LastIndexOf('-');
 				if (pos >= 0)
 				{
-					baseAlg = (PemBaseAlg)Enums.GetEnumValue(typeof(PemBaseAlg), dekAlgName.Substring(0, pos));
-					mode = (PemMode)Enums.GetEnumValue(typeof(PemMode), dekAlgName.Substring(pos + 1));
-					return;
+					baseAlg = Enums.GetEnumValue<PemBaseAlg>(dekAlgName.Substring(0, pos));
+                    mode = Enums.GetEnumValue<PemMode>(dekAlgName.Substring(pos + 1));
+                    return;
 				}
 			}
 			catch (ArgumentException)