Skip to content

Commit

Permalink
Encrypt and Decrypt Password Fields (#1562)
Browse files Browse the repository at this point in the history
* Add files via upload

* Create encryptAndDecryptNonPasswordFields.js

Dear ServiceNow Community,

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 solutions to the GlideEncrypter API. 

Glide Element API to encrypt/decrypt password2 values through GlideRecord.

Below are the sample scripts I ran in my PDI: For Password fields. 

Note: 'u_pass' is Password (2 Way Encrypted) field.

* encryptAndDecryptNonPasswordFields

Dear ServiceNow Community,


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 solutions to the GlideEncrypter API. 

Glide Element API to encrypt/decrypt password2 values through GlideRecord.

Below are the sample scripts I ran in my PDI: For Password fields. 

Note: 'u_pass' is Password (2 Way Encrypted) field.

* Delete Background Scripts/encryptAndDecryptPasswordFields.js

deleting duplicate file

* Delete Background Scripts/readme.md

Deleting the duplicate file
  • Loading branch information
vamsi0777 authored Oct 31, 2024
1 parent 0e05c51 commit c8195b3
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//To Encrypt password field
var grIncident = new GlideRecord('incident');
if (grIncident.get('dc1c4143476202101b589d2f316d4390')) {
grIncident.setDisplayValue('u_pass', 'demo@123');
grIncident.update();
}
//NOTE: You can't use the setValue() API for the Password2 field

//To print cipher text
var grIncident = new GlideRecord('incident');
if (grIncident.get('dc1c4143476202101b589d2f316d4390')) {
gs.info('Encrypted cipher test of password ' + grIncident.getValue('u_pass'));
}

//To decrypt password field
var grIncident = new GlideRecord('incident');
if (grIncident.get('dc1c4143476202101b589d2f316d4390')) {
var result = grIncident.u_pass.getDecryptedValue();
gs.info("Decrypted password- " +result);
}
//NOTE: The getDecryptedValue() API isn't scoped. It's available globally.
10 changes: 10 additions & 0 deletions Background Scripts/encryptAndDecryptNonPasswordFields/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Dear ServiceNow Community,


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 solutions to the GlideEncrypter API.

Glide Element API to encrypt/decrypt password2 values through GlideRecord.

Below are the sample scripts I ran in my PDI: For Password fields.

Note: 'u_pass' is Password (2 Way Encrypted) field.

0 comments on commit c8195b3

Please sign in to comment.