77
88namespace SafeCrypt . AESEncryption
99{
10- public class AesEncryption : BaseAesEncryption
10+ public static class AesEncryption
1111 {
1212 /// <summary>
1313 /// Asynchronously encrypts the provided data using the specified secret key and initialization vector (IV).
@@ -23,7 +23,7 @@ public class AesEncryption : BaseAesEncryption
2323 /// <param name="secretKey">The secret key used for encryption.</param>
2424 /// <param name="iv">The initialization vector used for encryption.</param>
2525 /// <returns>The encrypted data as a byte array.</returns>
26- public async Task < EncryptionData > EncryptToHexStringAsync ( EncryptionParameters param , CipherMode mode = CipherMode . CBC )
26+ public static async Task < EncryptionData > EncryptToHexStringAsync ( EncryptionParameters param , CipherMode mode = CipherMode . CBC )
2727 {
2828 var responseData = new EncryptionData ( ) ;
2929
@@ -52,7 +52,7 @@ public async Task<EncryptionData> EncryptToHexStringAsync(EncryptionParameters p
5252 Data = param . DataToEncrypt . ConvertToHexString ( ) . HexadecimalStringToByteArray ( )
5353 } ;
5454
55- var response = await EncryptAsync ( byteEncryptionParameters , mode ) ;
55+ var response = await BaseAesEncryption . EncryptAsync ( byteEncryptionParameters , mode ) ;
5656
5757 return new EncryptionData
5858 {
@@ -84,7 +84,7 @@ public async Task<EncryptionData> EncryptToHexStringAsync(EncryptionParameters p
8484 /// <exception cref="FormatException">
8585 /// Thrown if the base64secretKey is not a valid Base64-encoded string.
8686 /// </exception>
87- public async Task < EncryptionData > EncryptToBase64StringAsync ( string dataToBeEncrypted , string base64secretKey , CipherMode mode = CipherMode . CBC )
87+ public static async Task < EncryptionData > EncryptToBase64StringAsync ( string dataToBeEncrypted , string base64secretKey , CipherMode mode = CipherMode . CBC )
8888 {
8989 // validate is base64
9090 if ( ! Validators . IsBase64String ( base64secretKey ) )
@@ -104,7 +104,7 @@ public async Task<EncryptionData> EncryptToBase64StringAsync(string dataToBeEncr
104104 Data = dataToBeEncrypted . ConvertToHexString ( ) . HexadecimalStringToByteArray ( )
105105 } ;
106106
107- var response = await EncryptAsync ( byteEncryptionParameters , mode ) ;
107+ var response = await BaseAesEncryption . EncryptAsync ( byteEncryptionParameters , mode ) ;
108108
109109 return new EncryptionData
110110 {
@@ -114,7 +114,7 @@ public async Task<EncryptionData> EncryptToBase64StringAsync(string dataToBeEncr
114114 } ;
115115 }
116116
117- private EncryptionData ValidateEncryptionParameters ( EncryptionParameters param )
117+ private static EncryptionData ValidateEncryptionParameters ( EncryptionParameters param )
118118 {
119119 var responseData = new EncryptionData ( ) ;
120120
@@ -134,7 +134,7 @@ private EncryptionData ValidateEncryptionParameters(EncryptionParameters param)
134134 return responseData ;
135135 }
136136
137- private void NullChecks ( string data , string secretKey )
137+ private static void NullChecks ( string data , string secretKey )
138138 {
139139 if ( data == null || data . Length <= 0 )
140140 throw new ArgumentNullException ( nameof ( data ) ) ;
@@ -143,7 +143,7 @@ private void NullChecks(string data, string secretKey)
143143 throw new ArgumentNullException ( nameof ( secretKey ) ) ;
144144 }
145145
146- private void AddError ( EncryptionData responseData , string error )
146+ private static void AddError ( EncryptionData responseData , string error )
147147 {
148148 responseData . HasError = true ;
149149 responseData . Errors . Add ( error ) ;
0 commit comments