I have an array of JSON arrays whose values I'm trying to encrypt using CryptoJS and then print for use in another file, where these values must be decrypted using a custom passphrase.
But I'm doing something wrong, and when decrypting the URL, I get the error message "Fault: invalid UTF-8 data."
encrypt.js:
var encrypted = CryptoJS.AES.encrypt(item[key], pass);
json[j] += encrypted.ciphertext.toString(CryptoJS.enc.Base64);
decrypt.js:
var decrypted = CryptoJS.AES.decrypt(item[key], pass);
html += '<a href="' + decrypted.toString(CryptoJS.enc.Utf8) + '" target="_blank" class="socialico ' + key + '">' + icons[key] + '</a>';
I followed this example ... Help, please, please?
source
share