Skip to content

Commit 3b2c538

Browse files
committed
featL turned Decrypting class and methods to static
1 parent cc700d5 commit 3b2c538

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

src/SafeCrypt.Lib/Encryption/AesEncryption/Decrypting.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace SafeCrypt.AESDecryption
99
{
10-
public class AesDecryption : BaseAesEncryption
10+
public static class AesDecryption
1111
{
1212
/// <summary>
1313
/// Asynchronously decrypts data from a hexadecimal string using the specified decryption parameters and cipher mode.
@@ -19,7 +19,7 @@ public class AesDecryption : BaseAesEncryption
1919
/// The task result is a <see cref="DecryptionData"/> object containing the decrypted data, IV, and secret key.
2020
/// If decryption fails, the <see cref="DecryptionData"/> object will contain error information.
2121
/// </returns>
22-
public async Task<DecryptionData> DecryptFromHexStringAsync(DecryptionParameters param, CipherMode mode = CipherMode.CBC)
22+
public static async Task<DecryptionData> DecryptFromHexStringAsync(DecryptionParameters param, CipherMode mode = CipherMode.CBC)
2323
{
2424
var responseData = new DecryptionData();
2525

@@ -55,7 +55,7 @@ public async Task<DecryptionData> DecryptFromHexStringAsync(DecryptionParameters
5555
Data = param.DataToDecrypt.HexadecimalStringToByteArray()
5656
};
5757

58-
var response = await DecryptAsync(byteEncryptionParameters, mode);
58+
var response = await BaseAesEncryption.DecryptAsync(byteEncryptionParameters, mode);
5959

6060
return new DecryptionData
6161
{
@@ -75,7 +75,7 @@ public async Task<DecryptionData> DecryptFromHexStringAsync(DecryptionParameters
7575
/// The task result is a <see cref="DecryptionData"/> object containing the decrypted data, IV, and secret key.
7676
/// If decryption fails, the <see cref="DecryptionData"/> object will contain error information.
7777
/// </returns>
78-
public async Task<DecryptionData> DecryptFromBase64StringAsync(DecryptionParameters param, CipherMode mode = CipherMode.CBC)
78+
public static async Task<DecryptionData> DecryptFromBase64StringAsync(DecryptionParameters param, CipherMode mode = CipherMode.CBC)
7979
{
8080
var responseData = new DecryptionData();
8181

@@ -103,7 +103,7 @@ public async Task<DecryptionData> DecryptFromBase64StringAsync(DecryptionParamet
103103
Data = Convert.FromBase64String(param.DataToDecrypt)
104104
};
105105

106-
var response = await DecryptAsync(byteDecryptionParameters, mode);
106+
var response = await BaseAesEncryption.DecryptAsync(byteDecryptionParameters, mode);
107107

108108
return new DecryptionData
109109
{
@@ -121,7 +121,7 @@ public async Task<DecryptionData> DecryptFromBase64StringAsync(DecryptionParamet
121121
}
122122

123123

124-
private void NullChecks(string data, string secretKey, string iv)
124+
private static void NullChecks(string data, string secretKey, string iv)
125125
{
126126
if (data == null || data.Length <= 0)
127127
throw new ArgumentNullException(nameof(data));
@@ -133,13 +133,13 @@ private void NullChecks(string data, string secretKey, string iv)
133133
throw new ArgumentNullException(nameof(iv));
134134
}
135135

136-
private (byte[], byte[]) ConvertKeysToBytesAndGetKeys(string secretKey, string iv)
136+
private static (byte[], byte[]) ConvertKeysToBytesAndGetKeys(string secretKey, string iv)
137137
{
138138

139139
return (secretKey.ConvertKeysToBytes(), iv.ConvertKeysToBytes());
140140
}
141141

142-
private void AddError(DecryptionData responseData, string error)
142+
private static void AddError(DecryptionData responseData, string error)
143143
{
144144
responseData.HasError = true;
145145
responseData.Errors.Add(error);

0 commit comments

Comments
 (0)