AES-CTR decryption

I'm having problems decoding specific AES messages.

Used this site for testing... AES Encryption: Encrypt and decrypt online — Cryptii - result of encrypting (4d 65 73 73 61 67 65 = 4a 9b 9c 07 80 b2 66)

Setting:
Algorithm: AES-128
Mode: CTR
Key: 000102030405060708090a0b0c0d0e0f
IV: 101112131415161718191a1b1c1d1e1f

Key and IV from here... CryptoJS - CryptoJS

Here is my code from Node-RED...

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;

Decrypting 4a 9b 9c 07 80 b2 66 return "" from a debug node.

I feel like the format (HEX) of the imput might be a problem.

Disclaimer: Noob. TIA

[{"id":"380fc06d.ed624","type":"inject","z":"70a6ffe1.f9ce8","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"4a9b9c0780b266","payloadType":"str","x":160,"y":760,"wires":[["dfac1e54.967ca"]]},{"id":"3a32b386.be581c","type":"debug","z":"70a6ffe1.f9ce8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":550,"y":760,"wires":[]},{"id":"dfac1e54.967ca","type":"function","z":"70a6ffe1.f9ce8","name":"decrypt","func":"var cryptojs = context.global.cryptojs;\n\nvar key = '000102030405060708090a0b0c0d0e0f';\nvar iv = '101112131415161718191a1b1c1d1e1f';\nvar data = msg.payload;\n\nvar message = cryptojs.AES.decrypt(\n    data, \n    key, { \n        mode: cryptojs.mode.CTR, \n        iv: iv }\n    );\n\nmsg.payload = message.toString();\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":360,"y":760,"wires":[["3a32b386.be581c"]]}]

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.