11using System ;
22using System . Security . Cryptography ;
3+ using System . Threading . Tasks ;
34using SafeCrypt . AesEncryption ;
45using SafeCrypt . Helpers ;
56using SafeCrypt . Models ;
@@ -9,7 +10,7 @@ namespace SafeCrypt.AESEncryption
910 public class AesEncryption : BaseAesEncryption
1011 {
1112 /// <summary>
12- /// Encrypts the provided data using the specified secret key and initialization vector (IV).
13+ /// Asynchronously encrypts the provided data using the specified secret key and initialization vector (IV).
1314 /// </summary>
1415 /// <param name="parameters">The encryption parameters.</param>
1516 /// <returns>The encrypted data as a byte array.</returns>
@@ -22,7 +23,7 @@ public class AesEncryption : BaseAesEncryption
2223 /// <param name="secretKey">The secret key used for encryption.</param>
2324 /// <param name="iv">The initialization vector used for encryption.</param>
2425 /// <returns>The encrypted data as a byte array.</returns>
25- public EncryptionData EncryptToHexString ( EncryptionParameters param , CipherMode mode = CipherMode . CBC )
26+ public async Task < EncryptionData > EncryptToHexStringAsync ( EncryptionParameters param , CipherMode mode = CipherMode . CBC )
2627 {
2728 var responseData = new EncryptionData ( ) ;
2829
@@ -51,7 +52,7 @@ public EncryptionData EncryptToHexString(EncryptionParameters param, CipherMode
5152 Data = param . DataToEncrypt . ConvertToHexString ( ) . HexadecimalStringToByteArray ( )
5253 } ;
5354
54- var response = EncryptAES ( byteEncryptionParameters , mode ) ;
55+ var response = await EncryptAsync ( byteEncryptionParameters , mode ) ;
5556
5657 return new EncryptionData
5758 {
@@ -62,7 +63,7 @@ public EncryptionData EncryptToHexString(EncryptionParameters param, CipherMode
6263 }
6364
6465 /// <summary>
65- /// Encrypts the provided string data using the Advanced Encryption Standard (AES) algorithm.
66+ /// Asynchronously encrypts the provided string data using the Advanced Encryption Standard (AES) algorithm.
6667 /// </summary>
6768 /// <param name="dataToBeEncrypted">The string data to be encrypted.</param>
6869 /// <param name="base64secretKey">The Base64-encoded secret key used for encryption.</param>
@@ -83,7 +84,7 @@ public EncryptionData EncryptToHexString(EncryptionParameters param, CipherMode
8384 /// <exception cref="FormatException">
8485 /// Thrown if the base64secretKey is not a valid Base64-encoded string.
8586 /// </exception>
86- public EncryptionData EncryptToBase64String ( string dataToBeEncrypted , string base64secretKey , CipherMode mode = CipherMode . CBC )
87+ public async Task < EncryptionData > EncryptToBase64StringAsync ( string dataToBeEncrypted , string base64secretKey , CipherMode mode = CipherMode . CBC )
8788 {
8889 // validate is base64
8990 if ( ! Validators . IsBase64String ( base64secretKey ) )
@@ -103,7 +104,7 @@ public EncryptionData EncryptToBase64String(string dataToBeEncrypted, string bas
103104 Data = dataToBeEncrypted . ConvertToHexString ( ) . HexadecimalStringToByteArray ( )
104105 } ;
105106
106- var response = EncryptAES ( byteEncryptionParameters , mode ) ;
107+ var response = await EncryptAsync ( byteEncryptionParameters , mode ) ;
107108
108109 return new EncryptionData
109110 {
0 commit comments