Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions Encrypt/AesEncryption/AesEncryption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ public byte[] AesEncrypt(string data, string secretKey, string iv)
public byte[] AesDecrypt(string data, string secretKey, string iv)
{
NullChecks(data, secretKey, iv);
var convertedKeys = ConvertKeysToBytes(secretKey, iv);
//var convertedKeys = ConvertKeysToBytes(secretKey, iv);

var aesKey = convertedKeys.Item1;
var aesIv = convertedKeys.Item2;
var (aesKey, aesIv) = ConvertKeysToBytesAndGetKeys(secretKey, iv);
//var aesKey = convertedKeys.Item1;
//var aesIv = convertedKeys.Item2;

var aesData = data.HexadecimalStringToByteArray();
return DecryptAES(aesData, aesKey, aesIv);
Expand Down Expand Up @@ -101,6 +102,13 @@ private void NullChecks(string data, string secretKey, string iv)

return (secret, iv);
}

private (byte[], byte[]) ConvertKeysToBytesAndGetKeys(string secretKey, string iv)
{
var convertedKeys = ConvertKeysToBytes(secretKey, iv);

return (convertedKeys.Item1, convertedKeys.Item2);
}
private void NullChecks(string data, string secretKey)
{
if (data == null || data.Length <= 0)
Expand Down