Skip to content

Commit 3cf076d

Browse files
committed
used generic validator for encryption and decryption models
1 parent 3aa9a00 commit 3cf076d

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public static async Task<DecryptionData> DecryptFromHexStringAsync(DecryptionPar
2323
{
2424
var responseData = new DecryptionData();
2525

26-
Validators.ValidateNotNull(param);
26+
Validator<DecryptionParameters>.ValidateNotNull(param);
2727

2828
// validate is base64
2929
if (!Validators.IsBase64String(param.SecretKey))
@@ -52,7 +52,7 @@ public static async Task<DecryptionData> DecryptFromHexStringAsync(DecryptionPar
5252
{
5353
SecretKey = Convert.FromBase64String(param.SecretKey),
5454
IV = dataBytes,
55-
Data = param.DataToDecrypt.HexadecimalStringToByteArray()
55+
Data = param.Data.HexadecimalStringToByteArray()
5656
};
5757

5858
var response = await BaseAesEncryption.DecryptAsync(byteEncryptionParameters, mode);
@@ -79,7 +79,7 @@ public static async Task<DecryptionData> DecryptFromBase64StringAsync(Decryption
7979
{
8080
var responseData = new DecryptionData();
8181

82-
Validators.ValidateNotNull(param);
82+
Validator<DecryptionParameters>.ValidateNotNull(param);
8383

8484

8585
if (!Validators.IsBase64String(param.SecretKey))
@@ -100,7 +100,7 @@ public static async Task<DecryptionData> DecryptFromBase64StringAsync(Decryption
100100
{
101101
SecretKey = Convert.FromBase64String(param.SecretKey),
102102
IV = Convert.FromBase64String(param.IV),
103-
Data = Convert.FromBase64String(param.DataToDecrypt)
103+
Data = Convert.FromBase64String(param.Data)
104104
};
105105

106106
var response = await BaseAesEncryption.DecryptAsync(byteDecryptionParameters, mode);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public static async Task<EncryptionData> EncryptToHexStringAsync(EncryptionParam
4949
{
5050
SecretKey = Convert.FromBase64String(param.SecretKey),
5151
IV = dataBytes,
52-
Data = param.DataToEncrypt.ConvertToHexString().HexadecimalStringToByteArray()
52+
Data = param.Data.ConvertToHexString().HexadecimalStringToByteArray()
5353
};
5454

5555
var response = await BaseAesEncryption.EncryptAsync(byteEncryptionParameters, mode);
@@ -118,7 +118,7 @@ private static EncryptionData ValidateEncryptionParameters(EncryptionParameters
118118
{
119119
var responseData = new EncryptionData();
120120

121-
Validators.ValidateNotNull(param);
121+
Validator<EncryptionParameters>.ValidateNotNull(param);
122122

123123
// validate is base64
124124
if (!Validators.IsBase64String(param.SecretKey))

0 commit comments

Comments
 (0)