Variable Encryption

PD6
Tera Contributor

We have set up integration between ServiceNow and an External System for automation. The requirement is that the user will enter the password in the ServiceNow catalog item, and it must be sent in the payload in an encrypted way to the external system (not ServiceNow). This allows the External System to decrypt it using the decryption key and use the same password for the reset. I can use the masked variable type to encrypt the password variable, but where do I get the decryption key to decrypt the password?

1 REPLY 1

Anand Kumar P
Giga Patron
Giga Patron

Hi @PD6 ,

You can store username and password in basic_auth_credentials table .

And in business rule script you can use below one

var Encrypter = new GlideEncrypter();  
var encrypted = current.u_password; // current.<<your field name>>  
var decrypted = Encrypter.decrypt(encrypted);  
gs.addInfoMessage("encrypted..   " + encrypted);  
gs.addInfoMessage("decrypted..   " + decrypted);

Please mark it as solution proposed and helpful if it serves your purpose.

Thanks,

Anand