Using CryptoJS library server side

manasa ks
Tera Contributor

HI Team

Issue : Imported the CryptoJS AES library in script include  and facing below error " Evaluator: org.mozilla.javascript.EcmaError: "Link to Lib : https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/aes.min.js

Executed Below Script in Scoped App :

var wsClient = new x_snc_customEncryption.CryptoJS();
var enc_result = wsClient.AES.encrypt(current.short_description, "888888888888888888", {
iv: '888888888888888888'
});

gs.info(enc_result);

 Kindly assist in resolving issue ...as client side encryption and decryption is achievable but facing issue at server side.

 

Thanks

Manasa

1 ACCEPTED SOLUTION

It will save you time and grief if you just buy it.  I have gone down this road before DB Encryption and ultimately DB Encryption will save a lot of work and support headaches.

But if you really want to go there this is what I did 4 years ago before DB Encryption.
https://community.servicenow.com/community?id=community_question&sys_id=d0394fe1db5cdbc01dcaf3231f9619d5&view_source=searchResult

 

View solution in original post

6 REPLIES 6

Maik Skoddow
Tera Patron
Tera Patron

Hi @manasa ks ,

on server-side JavaScript cannot load additional JavaScript libraries from Internet. So if you want to load a JavaScript file on the server you have to include all additional required JavaScript files. Basically it should be possible to include all JavaScript files into one file, but it depends on how they are implemented.

And please consider that on server-side only ECMA 5.0 is possible (see https://docs.servicenow.com/bundle/quebec-application-development/page/script/JavaScript-engine-upgr...)

Kind regards
Maik

If my answer replied your question please mark appropriate response as correct so that the question will appear as resolved for other users who may have a similar question in the future.

DrewW
Mega Sage
Mega Sage

What is your overall goal that you are trying to achieve?  Its been a while since I have seen a need for this since SNC released DB encryption.

manasa ks
Tera Contributor

Was trying to implement encryption without the need of the plugin ..

 

Thanks

Manasa

 

It will save you time and grief if you just buy it.  I have gone down this road before DB Encryption and ultimately DB Encryption will save a lot of work and support headaches.

But if you really want to go there this is what I did 4 years ago before DB Encryption.
https://community.servicenow.com/community?id=community_question&sys_id=d0394fe1db5cdbc01dcaf3231f9619d5&view_source=searchResult