Best way to encrypt and decrypt a string?

g_eggidio
Kilo Contributor

Hi to all,
I have an include script that generates a password automatically, I would like to save this value in a field of a custom table, but in encrypted way not visible to users who access the table.
Also I would also need to decrypt it later to send it via email notification.
What is the best way to perform encryption-decryption of an alphanumeric string?

1 ACCEPTED SOLUTION

Archana Reddy2
Tera Guru

Hi,

The below link may help you.

var encr = new GlideEncrypter(); 
var clearString = 'abcdefg'; 
var encrString = encr.encrypt(clearString);
var decrString = encr.decrypt(encrString);  
gs.print("Decrypted string = " + decrString);

LINK

Thanks,

Archana

View solution in original post

5 REPLIES 5

Archana Reddy2
Tera Guru

Hi,

The below link may help you.

var encr = new GlideEncrypter(); 
var clearString = 'abcdefg'; 
var encrString = encr.encrypt(clearString);
var decrString = encr.decrypt(encrString);  
gs.print("Decrypted string = " + decrString);

LINK

Thanks,

Archana

Hi Archana,

 

Is it possible to use the external library to encrypt and decrypt the data. like: use the 'cdn' files. If yes, Please let me know the process.

 

Thanks!

hii archna this api is out dated 
https://developer.servicenow.com/dev.do#!/reference/api/washingtondc/server/sn_kmf_ns-namespace/KMFC... 
by using this api  how will do the same thing 

 

how to use the same inside of a UI Macros function, i'm adding multiple credentials to a list using UI macro function and i need to encrypt the creds.