Alternative Encryption Products to GlideEncrypter

KaruppusamyN
Tera Contributor

We have Depreciate 3DES in our instance, i am trying to modify an existing script in my instance GlideEncrypter with solution provided by Knowledge Article, but the issue is the alternatives are not working for me. Kindly anyone have sample script for GlideEncrypter().encrpty(), share it with an example

5 REPLIES 5

Chaitanya ILCR
Mega Patron

Hi,

 

you can refer this 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1320986 

GlideElement API ,Key Management Framework (KMF) you can use these two alternatives

 

note: you can only decrypt password2 type fields 

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

Hi @Chaitanya ILCR ,

i got this script from that article, can you help me on how to create module to use on this code. Actually i am trying replacing encrypt script which i am using in script include.

 

Var encryptOp = new sn_kmf_ns.KMFCryptoOperation("< module_name >",
"SYMMETRIC_ENCRYPTION") .withInputFormat("KMFNone");
var encryptedText = encryptOp.doOperation(clear_text);

Bhimashankar H
Mega Sage

Hi @KaruppusamyN ,

 

GlideEncrypter Usage

  • GlideEncrypter() is a server-side API in ServiceNow for basic symmetric encryption and decryption.

  • The most commonly used method for encryption is .encrypt(), not .encrpty()—the latter is a typo.

  • By default, GlideEncrypter will use the most secure algorithm enabled (typically AES, after 3DES deprecation).

Example Script: Encrypting and Decrypting Text

var plainText = 'SensitiveData123';

// Create encrypter object
var encrypter = new GlideEncrypter();

// Encrypt the text (returns Base64-encoded encrypted string)
var encryptedValue = encrypter.encrypt(plainText);

// Decrypt the value back to plain text
var decryptedValue = encrypter.decrypt(encryptedValue);

// Output results for demonstration
gs.info('Encrypted: ' + encryptedValue);
gs.info('Decrypted: ' + decryptedValue);

 

Key Points

  • You do not need to specify the algorithm explicitly; ServiceNow will use the latest default configured algorithm (AES).

  • Both methods operate on strings.

  • The encrypted result is safe to store in database or transmit as needed.

 

See the below reference 

Snow Document 

 

Thanks,
Bhimashankar H

 

-------------------------------------------------------------------------------------------------
If my response points you in the right directions, please consider marking it as 'Helpful' & 'Correct'. Thanks!

Hi @Bhimashankar H,

So if i am using GlideEncrpty() in script there won't be any problem after deprecate DES?