Skip to content

Encrypt and Decrypt Non-Password Fields #1561

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//For Non-password fields Encryption syntax using Key Management Framework Cryptographic module

var password = "Hello World";
var encryptOp = new sn_kmf_ns.KMFCryptoOperation("global.vamsi_glideencrypter", "SYMMETRIC_ENCRYPTION")
.withInputFormat("KMFNone");
var encryptedText = encryptOp.doOperation(password); //Encrypting Hello world
gs.info("After Encryption: " + encryptedText);


//For Non-password fields Decryption syntax using Key Management Framework Cryptographic module

var encryptOp = new sn_kmf_ns.KMFCryptoOperation("global.vamsi_glideencrypter", "SYMMETRIC_DECRYPTION")
.withOutputFormat("KMFNone");
var clear_text = encryptOp.doOperation('91ddbb5d47c012101b589d2f316d438012p3lgrR72vEQW5yLk-WXKQ==aGqxYzUXuyLt3HTqcW6-HA=='); //Pass Cipher text of Hello World (Which is the output of first script)
gs.info("After decryption: " + clear_text);
11 changes: 11 additions & 0 deletions Background Scripts/encryptAndDecryptPasswordFields/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Generally when you want to encrypt or decrypt any Non-password fields earlier we have Glide Encrypter API methods for encryption and decryption.
The GlideEncrypter API uses 3DES encryption standard with NIST 800-131 A Rev2 has recommended against using to encrypt data after 2023.
ServiceNow offers alternative cryptographic (Key Management Framwork) solutions to the GlideEncrypter API.

Note: ServiceNow recommending to deprecate GlideEncrypter API with in the instances as soon as possible. The actual dead line is September 2025.

These are the sample scripts I ran in my PDI: For Non-password fields. I used AES 256 algorithm for Symmetric Data Encryption/Decryption.

To test the scripts you need to create Cryptographic module and generate the key.

"global.vamsi_glideencrypter" is my cryptographic module name.
Loading