summary refs log tree commit diff
path: root/crypto/src/security
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-07-17 18:55:46 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-07-17 18:55:46 +0700
commit67108e3c641758ebe98484cf52454471d9948e0d (patch)
treea9437e154bf3b71ed41591f94fbe65fa04891bed /crypto/src/security
parentRemove unused digest (diff)
downloadBouncyCastle.NET-ed25519-67108e3c641758ebe98484cf52454471d9948e0d.tar.xz
Utility method for selecting AES engine
Diffstat (limited to 'crypto/src/security')
-rw-r--r--crypto/src/security/CipherUtilities.cs6
-rw-r--r--crypto/src/security/MacUtilities.cs2
-rw-r--r--crypto/src/security/WrapperUtilities.cs2
3 files changed, 5 insertions, 5 deletions
diff --git a/crypto/src/security/CipherUtilities.cs b/crypto/src/security/CipherUtilities.cs
index a6849c102..8ed5d8d41 100644
--- a/crypto/src/security/CipherUtilities.cs
+++ b/crypto/src/security/CipherUtilities.cs
@@ -339,7 +339,7 @@ namespace Org.BouncyCastle.Security
                         "PBEWITHMD5AND256BITAES-CBC-OPENSSL"))
                     {
                         return new PaddedBufferedBlockCipher(
-                            new CbcBlockCipher(new AesEngine()));
+                            new CbcBlockCipher(AesUtilities.CreateEngine()));
                     }
                 }
             }
@@ -368,7 +368,7 @@ namespace Org.BouncyCastle.Security
             switch (cipherAlgorithm)
             {
             case CipherAlgorithm.AES:
-                blockCipher = new AesEngine();
+                blockCipher = AesUtilities.CreateEngine();
                 break;
             case CipherAlgorithm.ARC4:
                 streamCipher = new RC4Engine();
@@ -759,7 +759,7 @@ namespace Org.BouncyCastle.Security
         {
             switch (cipherAlgorithm)
             {
-            case CipherAlgorithm.AES: return new AesEngine();
+            case CipherAlgorithm.AES: return AesUtilities.CreateEngine();
             case CipherAlgorithm.ARIA: return new AriaEngine();
             case CipherAlgorithm.BLOWFISH: return new BlowfishEngine();
             case CipherAlgorithm.CAMELLIA: return new CamelliaEngine();
diff --git a/crypto/src/security/MacUtilities.cs b/crypto/src/security/MacUtilities.cs
index f9f586d29..9490616be 100644
--- a/crypto/src/security/MacUtilities.cs
+++ b/crypto/src/security/MacUtilities.cs
@@ -115,7 +115,7 @@ namespace Org.BouncyCastle.Security
 
             if (mechanism == "AESCMAC")
             {
-                return new CMac(new AesEngine());
+                return new CMac(AesUtilities.CreateEngine());
             }
             if (mechanism == "DESMAC")
             {
diff --git a/crypto/src/security/WrapperUtilities.cs b/crypto/src/security/WrapperUtilities.cs
index 983ff824c..48ffe3a96 100644
--- a/crypto/src/security/WrapperUtilities.cs
+++ b/crypto/src/security/WrapperUtilities.cs
@@ -67,7 +67,7 @@ namespace Org.BouncyCastle.Security
                 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.AESRFC3211WRAP:		return new Rfc3211WrapEngine(AesUtilities.CreateEngine());
                 case WrapAlgorithm.CAMELLIARFC3211WRAP:	return new Rfc3211WrapEngine(new CamelliaEngine());
                 }
             }