diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-10-05 23:03:16 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-10-05 23:03:16 +0700 |
commit | 6d442f9319a857fe483af22d67bbd1677b0991a1 (patch) | |
tree | f3356e473c23680d6675defe770532fbb5b42cdc /crypto/src/openssl | |
parent | Delete experimental code (diff) | |
download | BouncyCastle.NET-ed25519-6d442f9319a857fe483af22d67bbd1677b0991a1.tar.xz |
Use generics in Enums
Diffstat (limited to 'crypto/src/openssl')
-rw-r--r-- | crypto/src/openssl/PEMUtilities.cs | 12 |
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) |