Decrypt PGP encrypted files in ServiceNow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2017 06:03 PM
I have a requirement where I need to import an encrypted csv file from an SFTP location into ServiceNow and then, in theory, decrypt the file and process its decrypted contents using a import set/transform map to create and maintain user records on the sys_user table.
The encrypted file needs to use PGP encryption.
I can generate the public/private pair of keys and provide the public key to have the file encrypted before that is posted on the SFTP.
I understand there is already transport encryption when using SFTP but the solution still requires the file to have its contents encrypted with PGP at the source, before it gets to ServiceNow.
I know if the file encryption was not a requirement, I could create a Data Source to get the file from the SFTP server and process its contents via import set/transform map.
My question is if there is any way this could be accomplished in ServiceNow or if I will have to decrypt the file outside of the platform and then retrieve its contents. I experimented a bit with the Encryption Support plugin but that doesn't appear to be an option. I also came across the post below but it doesn't appear to be a fit for the requirements I have.
https://community.servicenow.com/thread/226555
Any thoughts would be greatly appreciated.
Marcelo Correia

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2017 10:06 AM
It might be possible to import the JS code from https://openpgpjs.org/ into a Script Include. I haven't attempted this yet, but it's on my back-burner research list.
See Incorporating existing JavaScript libraries into your ServiceNow apps for more info.
JarodM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2017 10:16 AM
Thank you Jarod, this looks interesting.
I could not open the 2nd URL from your reply, I'm getting a message "Access to this place or content is restricted. If you think this is a mistake, please contact your administrator or the person who directed you here."
Is there any restriction accessing that post?
Marcelo

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2017 01:22 PM
Oops, that like is currently only available to K17 attendees.
Some similar threads:
- Mini-Lab: Adding Underscore.js Into ServiceNow
- [solved] Help with Uploading and Accessing a new Javascript Library
- https://community.servicenow.com/search.jspa?q=wrap+javascript+library+script+include
It involves putting the JS library into a script include, either via direct copy/paste or repacking it (and its dependancies) using a Node.js util.
Jarod
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2020 10:18 PM
Hey Marcelo,
Were you able to crack this? Just wondering how you went through with this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2020 05:47 AM
Hi prashantdharne,
Yes I was. I ended up implementing with the option via MID Server. I used WinSCP (adding some scripting) for retrieving the file from the SFTP server, then I generated the keys to encrypt/decrypt with Kleopatra (from GPG4Win).
I hope this helps.
Marcelo