Skip to content

Commit bc41ff6

Browse files
committed
Refactored method to use convertted keys method
1 parent bfd88a1 commit bc41ff6

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

Encrypt/AesEncryption/AesEncryption.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@ public byte[] AesDecrypt(byte[] data, byte[] secretKey, byte[] iv)
1414

1515
public byte[] AesEncrypt(string data, string secretKey, string iv)
1616
{
17-
NullChecks(data, secretKey, iv);
17+
NullChecks(data, secretKey, iv);
18+
19+
var convertedKeys = ConvertKeysToBytes(secretKey, iv);
20+
21+
var aesKey = convertedKeys.Item1;
22+
var aesIv = convertedKeys.Item2;
1823

19-
var aesKey = Encoding.UTF8.GetBytes(secretKey);
20-
var aesIv = Encoding.UTF8.GetBytes(iv);
2124
var aesData = data.HexadecimalStringToByteArray();
2225

2326
return EncryptAES(aesData, aesKey, aesIv);

0 commit comments

Comments
 (0)