- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2017 03:10 PM
Hi Team,
I am trying to testing why the decrpytion of a password is failing.
I have a field in the sys_properties set as password2 for security purposes.
As per article below.
and this is the snip of code i have taken from the script include that decrypts it for rest messages.
which i have modified to test using background script.
Var userPass = "encrypted Sys_property"; // Decrypt password var Encrypter = new GlideEncrypter(); var encrText = userPass; // current.<<your field name>> var decrText = Encrypter.decrypt(encrText); gs.print(encrText); gs.print(decrText);
the two fields i have printed show exactly the same value and i get this error at the top of the background script.
Input length must be multiple of 8 when decrypting with padded cipher
any ideas why it seems like its no working?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2017 04:05 PM
Well this is sad,
it seems the encrypted password was encrypted twice over and broke.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2017 04:05 PM
Well this is sad,
it seems the encrypted password was encrypted twice over and broke.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2017 04:40 PM
hi Thai-An,
I think GlideEncrypter is to decrypt field/column value stored as "password2" type while sys_properties encrypted value are not stored as this type.
Instead, use "gs.getProperty('property_name')" to get the clear text value.
useful reference for forms contain password2 fields:
https://servicenowgems.com/2017/08/30/decrypting-password-fields-automatically/
hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2017 08:25 PM
The below thread could be of some help to you: Decrypting a value to set as password not working