i have to covert text to aes encryption format the value to be passes is bidder1 and output should be {"ct":"69T9esuwyphNortVglpUVg==","iv":"c82b4f9c27ab62290efa7c76ad73107e","s":"984eaac5980778c1"} what i tried? i wrote a code
var txtUserName = context.variable("Login");
var txtpassword = context.variable("Password");
var bidder1 = context.variable("Bidder1");
var key,iv;
key= CryptoJS.enc.Utf8.parse(Bidder1.toString());
iv = CryptoJS.enc.Utf8.parse(Bidder1.toString());
var encryptedlogin = CryptoJS.AES.encrypt(CryptoJS.enc.Utf8.parse(txtUserName), key,
{
keySize: 192 / 8,
iv: iv,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
});
context.variable("LoginEnc") = encryptedlogin;
log.message(encryptedlogin);
var encryptedpassword = CryptoJS.AES.encrypt(CryptoJS.enc.Utf8.parse(txtpassword), key,
{
keySize: 192 / 8,
iv: iv,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
});
context.variable("PasswordEnc") = encryptedpassword;
log.message(encryptedpassword);
but the response i got is eFAfRYOyfAc3yid2injLDw== where as i need in this format {"ct":"69T9esuwyphNortVglpUVg==","iv":"c82b4f9c27ab62290efa7c76ad73107e","s":"984eaac5980778c1"} Can anyone helpme on this
Aucun commentaire:
Enregistrer un commentaire