I having trouble decrypting AES-CTR payloads in Node-RED.
As an example I am encoding "Message" here -> https://cryptii.com/pipes/aes-encryption - and then decrypting that result in Node-RED.
Crytii Site Results:
Input: 4d657373616765
Algorithm: AES-128
Mode: CTR
Key: 000102030405060708090a0b0c0d0e0f
IV: 101112131415161718191a1b1c1d1e1f
Output: 4a9b9c0780b266
When decrypting the output payload from Cryptii (4a9b9c0780b266) in Node-RED I am getting a "" returned in the debug widow.
var cryptojs = context.global.cryptojs;
var key = '000102030405060708090a0b0c0d0e0f';
var iv = '101112131415161718191a1b1c1d1e1f';
var data = msg.payload;
var message = cryptojs.AES.decrypt(
data,
key, {
mode: cryptojs.mode.CTR,
iv: iv }
);
msg.payload = message.toString();
return msg;
This is the libary used: https://www.npmjs.com/package/crypto-js and required changes made to settings.js for Node-RED.
My understanding of the subject matter is limited and any guidance would be appreciated. TIA