1- using SafeCrypt . src . Encryption . AesEncryption . Models ;
1+ using SafeCrypt . Models ;
22using System ;
33using System . IO ;
44using System . Reflection ;
77
88namespace SafeCrypt . AesEncryption
99{
10- internal class BaseAesEncryption
10+ public class BaseAesEncryption
1111 {
1212 /// <summary>
1313 /// Encrypts the provided data using the Advanced Encryption Standard (AES) algorithm.
@@ -25,7 +25,7 @@ internal class BaseAesEncryption
2525 /// <exception cref="Exception">
2626 /// Thrown for general encryption-related exceptions.
2727 /// </exception>
28- internal static byte [ ] EncryptAES ( ByteEncryptionParameters param )
28+ internal static byte [ ] EncryptAES ( ByteEncryptionParameters param , CipherMode mode = CipherMode . CBC )
2929 {
3030 try
3131 {
@@ -35,6 +35,7 @@ internal static byte[] EncryptAES(ByteEncryptionParameters param)
3535 // Set the key and initialization vector
3636 aes . Key = param . SecretKey ;
3737 aes . IV = param . IV ;
38+ aes . Mode = mode ;
3839 // Create an encryptor using the key and initialization vector
3940 ICryptoTransform encryptor = aes . CreateEncryptor ( aes . Key , aes . IV ) ;
4041
@@ -73,7 +74,7 @@ internal static byte[] EncryptAES(ByteEncryptionParameters param)
7374 /// <exception cref="ArgumentNullException">
7475 /// Thrown if the input encrypted data, key, or initialization vector is null.
7576 /// </exception>
76- internal static byte [ ] DecryptAES ( ByteDecryptionParameters param )
77+ internal static byte [ ] DecryptAES ( ByteDecryptionParameters param , CipherMode mode = CipherMode . CBC )
7778 {
7879 try
7980 {
@@ -83,6 +84,7 @@ internal static byte[] DecryptAES(ByteDecryptionParameters param)
8384 // Set the key and initialization vector
8485 aes . Key = param . SecretKey ;
8586 aes . IV = param . IV ;
87+ aes . Mode = mode ;
8688
8789 // Create a decryptor using the key and initialization vector
8890 ICryptoTransform decryptor = aes . CreateDecryptor ( aes . Key , aes . IV ) ;
0 commit comments