Decrypt PGP encrypted files in ServiceNow

marcelorsc
Kilo Expert

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

16 REPLIES 16

jarodm
Mega Guru

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


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


Oops, that like is currently only available to K17 attendees.



Some similar threads:



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


Hey Marcelo,

 

Were you able to crack this? Just wondering how you went through with this. 

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