- Mark as New
- Follow
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report
Hello,
I know your post is a year old, but I managed to get some result with the cryptString function.
First and as you mentionned, the key must be passed in base 64 format.
The salt parameter must be set to false.
Also, the result of the cryptString starts with the '@' character. When I try to decrypt it on the web page "https://www.devglan.com/online-tools/aes-encryption-decryption" (with empty Initial Vector of course), the "@" character doesn't seem to be a problem (and works also without), but with CryptoJS, you must delete this '@'.
Here an example :
//Adobe Campaign JS CODE to crypt 'Hello my friend' with 'CF12D5998AE799C6' key :
var key = "CF12D5998AE799C6";
var mBuffer = new MemoryBuffer(); mBuffer.fromString(key);
var b64Key = mBuffer.toBase64();
logInfo(cryptString("Hello my friend",b64Key, false) ) ;
//display : @1EZr24+U+KslB6s+5HSqjw==Try to decrypt on devglan.com page :
Mode : CBC
IV : empty
Key Size in Bits: 128
Secret Key : CF12D5998AE799C6
AES Decrypted String : SGVsbG8gbXkgZnJpZW5k
Decoded Plain Text : Hello my friend
CryptoJS Example:
var CryptoJS = require("crypto-js");
const cryptkey = CryptoJS.enc.Utf8.parse('CF12D5998AE799C6'); //The key used, in text format
crypted = "1EZr24+U+KslB6s+5HSqjw=="; //Notice that the '@' IS DELETED
var decrypt = CryptoJS.AES.decrypt( crypted, cryptkey, {
iv: CryptoJS.enc.Hex.parse('00000000000000000000000000000000'),
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
});
console.log("-- " + decrypt.toString(CryptoJS.enc.Utf8) + " --");
// display : -- Hello my friend --
Hope this could help.
Cédric