I need to use AES ECB encryption to generate a parameter in my URL, but the CryptoJS module can not get the right result. Here is my code:
var plainText = "abcdefg1234567890abc" console.log(plainText) var key = "abcdefmiddleware"; var result = CryptoJS.AES.encrypt( CryptoJS.enc.Utf8.parse(plainText), key, { keySize: 128, mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 } ); var b64 = result.ciphertext.toString(CryptoJS.enc.Base64); console.log(b64) pm.collectionVariables.set("signature",encodeURIComponent(b64));
The output changes every time I run the request, and the correct result should be
“W30nAtv/zP0+oOYMbN1fP7cpAmVWG3Zr63As6vBqA3c=”
Does anyone know how to solve this? Thanks.