problem description
since all the code in the front end H5 can be seen in the browser, the AES encrypted key will be exposed, so is it necessary to encrypt ?
the environmental background of the problem
the front end H5 uses AES encryption to transmit data to the background, and the background gets the data through decryption.
related codes
// AES
function aesEncrypt(value){
var key = "abcdefg"
var encryptedData = CryptoJS.AES.encrypt(CryptoJS.enc.Utf8.parse(value), CryptoJS.enc.Utf8.parse(key), {
mode: CryptoJS.mode.ECB,
padding: CryptoJS.pad.Pkcs7
});
return encryptedData.ciphertext.toString();
}