Issue
I need to Encrypt some data in angularjs and Decrypt in nodejs. I've seen this stackoverflow answer:
Angular CryptoJs Encryption Not Decryption in Node JS CryptoJS
and tried to use CryptoJS in my angularjs app this way:
HTML
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/aes.js"></script>
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/enc-base64-min.js"></script>
JS
app.controller('test', function ($scope) {
var param = 'abc'
var encry = CryptoJS.AES.encrypt(param, 'key');
console.log(encry);
});
But getting this error:
CryptoJS is not defined
I'm new in angularjs so don't have much idea about how to use different libraries.
An example of encryption in angularjs and decryption in nodejs would be very helpful.
Solution
You could try to remove the two scripts associated with crypto-js that you already have in the HTML and replace them with:
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/crypto-js.min.js"></script>
I hope this works.
Answered By - Nikolay
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.