Skip to content

Commit 3ae1cc4

Browse files
authored
Encrypt and Decrypt Non-Password Fields (#1561)
1 parent db65e15 commit 3ae1cc4

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//For Non-password fields Encryption syntax using Key Management Framework Cryptographic module
2+
3+
var password = "Hello World";
4+
var encryptOp = new sn_kmf_ns.KMFCryptoOperation("global.vamsi_glideencrypter", "SYMMETRIC_ENCRYPTION")
5+
.withInputFormat("KMFNone");
6+
var encryptedText = encryptOp.doOperation(password); //Encrypting Hello world
7+
gs.info("After Encryption: " + encryptedText);
8+
9+
10+
//For Non-password fields Decryption syntax using Key Management Framework Cryptographic module
11+
12+
var encryptOp = new sn_kmf_ns.KMFCryptoOperation("global.vamsi_glideencrypter", "SYMMETRIC_DECRYPTION")
13+
.withOutputFormat("KMFNone");
14+
var clear_text = encryptOp.doOperation('91ddbb5d47c012101b589d2f316d438012p3lgrR72vEQW5yLk-WXKQ==aGqxYzUXuyLt3HTqcW6-HA=='); //Pass Cipher text of Hello World (Which is the output of first script)
15+
gs.info("After decryption: " + clear_text);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Generally when you want to encrypt or decrypt any Non-password fields earlier we have Glide Encrypter API methods for encryption and decryption.
2+
The GlideEncrypter API uses 3DES encryption standard with NIST 800-131 A Rev2 has recommended against using to encrypt data after 2023.
3+
ServiceNow offers alternative cryptographic (Key Management Framwork) solutions to the GlideEncrypter API.
4+
5+
Note: ServiceNow recommending to deprecate GlideEncrypter API with in the instances as soon as possible. The actual dead line is September 2025.
6+
7+
These are the sample scripts I ran in my PDI: For Non-password fields. I used AES 256 algorithm for Symmetric Data Encryption/Decryption.
8+
9+
To test the scripts you need to create Cryptographic module and generate the key.
10+
11+
"global.vamsi_glideencrypter" is my cryptographic module name.

0 commit comments

Comments
 (0)