Closed ronastlelobo closed 4 years ago
almost same here - encrypting private keys (ASCII) and get 1 time of each ~5 malformed utf-8 data while trying to decrypt
@ronastlelobo @kkrupovich I'm sorry for very late response. If you may, could you provide the steps to recreate the case? This may be a bug on byte arrays parsing when decrypting.
@danang-id
I have same problem:
JSON:
{"user_id":"127382173821","user_name":"Paulo","user_email":"paulo@gmail.com","user_avatar":"https://link.to.user.avatar.com/image.jpg","custom_data":{"Job_Role":"CEO","Plan":"Pro","teammates":"4","Monthly_Spend":"50 USD"}}
How i encrypt:
let simpleCrypto = new SimpleCrypto(process.env.SECRET_KEY);
let uri = simpleCrypto.encrypt(JSON.stringify('MY_JSON_HERE'));
update I solve problem with encodeURIComponent and decodeURIComponent.
Thanks encodeURIComponent worked for me too.
why can't encrypt in local storage be decrypted?
useEffect(() => { let data = localStorage.getItem("localStorage"); if (data) { console.log("localStorage", simpleCrypto.decrypt(data).toString()); } }, []);
@irfannurzaman Please make sure the data you are trying to get is an actual ciphered text. Otherwise, please open a new issue and provide a technical details or any log about the error.
I'll close the issue for now since it has been solved for a while.
I am reading a .mp4 file and encrypting it using the library and writing it as a .dat file. I am accessing the .dat file and streaming 4,000,000 characters at a time till the end. While streaming, i am decrypting the data on go. So, the first set of characters are decrypting succcessfully using this method
var decipherText = simpleCrypto.decrypt(chunk)
while the next set of characters throw
Malformed UTF-8 data
error.