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/security/CipherUtilities.cs | |
parent | Delete experimental code (diff) | |
download | BouncyCastle.NET-ed25519-6d442f9319a857fe483af22d67bbd1677b0991a1.tar.xz |
Use generics in Enums
Diffstat (limited to 'crypto/src/security/CipherUtilities.cs')
-rw-r--r-- | crypto/src/security/CipherUtilities.cs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/crypto/src/security/CipherUtilities.cs b/crypto/src/security/CipherUtilities.cs index 929040e2c..8fbf19218 100644 --- a/crypto/src/security/CipherUtilities.cs +++ b/crypto/src/security/CipherUtilities.cs @@ -118,9 +118,9 @@ namespace Org.BouncyCastle.Security static CipherUtilities() { // Signal to obfuscation tools not to change enum constants - ((CipherAlgorithm)Enums.GetArbitraryValue(typeof(CipherAlgorithm))).ToString(); - ((CipherMode)Enums.GetArbitraryValue(typeof(CipherMode))).ToString(); - ((CipherPadding)Enums.GetArbitraryValue(typeof(CipherPadding))).ToString(); + Enums.GetArbitraryValue<CipherAlgorithm>().ToString(); + Enums.GetArbitraryValue<CipherMode>().ToString(); + Enums.GetArbitraryValue<CipherPadding>().ToString(); // TODO Flesh out the list of aliases @@ -358,7 +358,7 @@ namespace Org.BouncyCastle.Security CipherAlgorithm cipherAlgorithm; try { - cipherAlgorithm = (CipherAlgorithm)Enums.GetEnumValue(typeof(CipherAlgorithm), algorithmName); + cipherAlgorithm = Enums.GetEnumValue<CipherAlgorithm>(algorithmName); } catch (ArgumentException) { @@ -531,7 +531,7 @@ namespace Org.BouncyCastle.Security { try { - cipherPadding = (CipherPadding)Enums.GetEnumValue(typeof(CipherPadding), paddingName); + cipherPadding = Enums.GetEnumValue<CipherPadding>(paddingName); } catch (ArgumentException) { @@ -632,7 +632,7 @@ namespace Org.BouncyCastle.Security { CipherMode cipherMode = modeName == "" ? CipherMode.NONE - : (CipherMode)Enums.GetEnumValue(typeof(CipherMode), modeName); + : Enums.GetEnumValue<CipherMode>(modeName); switch (cipherMode) { |