How to encrypt string in servicenow

sajan0192
Giga Expert

I am using below code to encrypt string but it is not supported in service now I guess.
var encrypted = CryptoJS.AES.encrypt(myString, myPassword);

 

Is there any method encrypt the string in service now ?

 

 

Regards,

Sajan

 

 

 

1 ACCEPTED SOLUTION

sajan0192
Giga Expert

I have used below code for my req

 

var mac = new GlideCertificateEncryption;

mac.generateMac("sample_key", "HmacSHA256", "sample_data");

 

Thanks,

Sajan

View solution in original post

5 REPLIES 5

Mahendra RC
Mega Sage

Hi

Please use the below script, if may help you,

var enc = new GlideEncrypter();
var myPassword= "datapass";
var encypted_myPassword = enc.encrypt(myPassword);
gs.info(encypted_myPassword);

Please mark it correct, if it resolves your problem.

Thanks

Hi Sajan,

Could you please mark it correct, if it resolved your problem.

Thanks

Ujjawal Vishnoi
Mega Sage
Mega Sage

Hi Sajan,

 

Please refer the example script given in link belo.

https://docs.servicenow.com/bundle/kingston-application-development/page/app-store/dev_portal/API_reference/GlideEncrypter/concept/GlideEncrypterAPI.html

Hope this helps.

 

Regards

Ujjawal

sajan0192
Giga Expert

I have used below code for my req

 

var mac = new GlideCertificateEncryption;

mac.generateMac("sample_key", "HmacSHA256", "sample_data");

 

Thanks,

Sajan