How to decrypt an encrypted field (using script)

Takumi_
Tera Contributor

Hi All.

 

I want to know how to decrypt an encrypted field.

I made encrypted field on variable set.

But I can't decrypt the field at script.

 

getDecryptedValue()  doesn't work.

I want to know that if you know something.

-------------------------------------------------------------

I'm not good at English.

You don't know what I said, Please ask me.

3 REPLIES 3

Jitendra Diwak1
Kilo Sage

Hi @Takumi_,

 

Please try this below code amd replace the field name as per your requirement below

 

// Get the encrypted field value var encryptedValue = current.encrypted_field_name; // Decrypt the value var decrypter = new GlideEncrypter(); var decryptedValue = decrypter.decrypt(encryptedValue); // Use the decrypted value as needed gs.info("Decrypted value: " + decryptedValue);

 

Please accept my solution if it resolves your issue or thumps up

 

Thanks 

Jitendra 

Please accept my solution if it works for and thumps up.

Hi.

 

Thank you for your response.

 

Someone told me that GlideEncrypter doesn't work at Xanadu.

So I'm looking for other way.

Ted Norlander
ServiceNow Employee
ServiceNow Employee

Hi,

have a look at GlideCryptoModule and it's associated methods.

Using these methods you can decrypt encrypted fields if you have access to the CryptoModule.

 

BR Ted