-
Notifications
You must be signed in to change notification settings - Fork 11
Exception thrown when using the EncryptToHexStringAsync #46
Copy link
Copy link
Closed
Description
the code below will generate an exception
var iv = KeyGenerators.GenerateRandomIVKeyAsString();
var secretKey = KeyGenerators.GenerateAesSecretKey(128);
//assigning values to the params
var encryptionParameters = new EncryptionParameters
{
DataToEncrypt = "YourDataToEncrypt",
IV = iv,
SecretKey = secretKey
};
var encryptionResult = await encryptor.EncryptToHexStringAsync(encryptionParameters);
The EncryptToHexStringAsync method needs to convert the IV key from Hex string to byte array
THE Cause of the error:
byte[] dataBytes = param.IV.ConvertKeysToBytes();
THE FIX: use the HexadecimalStringToByteArray() e=method to convert the IV to
byte[] dataBytes = param.IV.HexadecimalStringToByteArray();
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels