Skip to content

Commit c8195b3

Browse files
authored
Encrypt and Decrypt Password Fields (#1562)
* 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
1 parent 0e05c51 commit c8195b3

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//To Encrypt password field
2+
var grIncident = new GlideRecord('incident');
3+
if (grIncident.get('dc1c4143476202101b589d2f316d4390')) {
4+
grIncident.setDisplayValue('u_pass', 'demo@123');
5+
grIncident.update();
6+
}
7+
//NOTE: You can't use the setValue() API for the Password2 field
8+
9+
//To print cipher text
10+
var grIncident = new GlideRecord('incident');
11+
if (grIncident.get('dc1c4143476202101b589d2f316d4390')) {
12+
gs.info('Encrypted cipher test of password ' + grIncident.getValue('u_pass'));
13+
}
14+
15+
//To decrypt password field
16+
var grIncident = new GlideRecord('incident');
17+
if (grIncident.get('dc1c4143476202101b589d2f316d4390')) {
18+
var result = grIncident.u_pass.getDecryptedValue();
19+
gs.info("Decrypted password- " +result);
20+
}
21+
//NOTE: The getDecryptedValue() API isn't scoped. It's available globally.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Dear ServiceNow Community,
2+
3+
4+
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.
5+
6+
Glide Element API to encrypt/decrypt password2 values through GlideRecord.
7+
8+
Below are the sample scripts I ran in my PDI: For Password fields.
9+
10+
Note: 'u_pass' is Password (2 Way Encrypted) field.

0 commit comments

Comments
 (0)