Java to JS and JS to Java encryption using cryptojs

自作多情 提交于 2019-11-30 09:49:49

Change

return CryptoJS.enc.Base64.parse(encrypted.toString()).toString();

to

return encrypted.ciphertext.toString(CryptoJS.enc.Base64);

The encrypted object usually stringifies into an OpenSSL format which might also contain the salt. If you're only interested in the actual ciphertext, then you need to stringify the ciphertext property.

Note that toString() takes an optional encoding function. Use the one that you need.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!