Blayter.com

Decrypting PGP files with GnuPG and ColdFusion

A few years ago I came up with a monster hack of automating the decryption of a PGP file with GnuPG. There are a bunch of limitations with CFEXECUTE so I turned to a VBS file and ADO to get the job done. The monster hack ran fine for a long time and just recently died when we upgraded to MSSQL 2005. After I was not able to fix the ADO connection properly I turned to some different solutions. What ended up working perfectly was using Java to execute a command line directly and just completely bypassing the CFEXECUTE. I stumbled upon System Command from Kevan Stannard and it worked perfectly. The same command line calls that I made to GnuPG now worked through CF using the System Command to do the execution. The trick to getting it to work is that GnuPG stores the PGP keys in relation to your user profile on the computer. So I ended up scripting out a batch file that added the keys into GnuPG, logging into the server as the same user that the ColdFusion service runs as and running the batch file to add the keys. After that the PGP decryption process has worked flawlessly.

In theory you could import the keys into the local system user but we already had a user for CF setup.

Comments
Unfortunately it is true that firefox 3 final is slower and even worse than 2.0.14. I used two copies of firefox 2.0.14 http://www.picktorrent.com on two computers, one is XP sp3, one is Vista sp1, both of them have plenty of unused memory.
# Posted By massesso | 8/12/09 9:49 AM
Are you using this to encrypt and decrypt? What is your call to decrypt? I am getting an error "Cannot run program "type":" when I try to run the following line: <cfset command = "type " & replace(thisPath,"\*.*","") & "\key.txt | gpg -u myUser --batch --passphrase-fd 0 --out " & variables.outfile & " -d " & encryptedfilename />
# Posted By Brandon Moser | 9/14/09 10:31 PM
There is a pgp project on RIAForge that I used for PGP.
It uses the open source bouncy castle libraries.
I used it with ColdFusion 8.

http://pgp.riaforge.com
# Posted By John | 2/8/10 3:24 PM
PGP file with GnuPG. There are a bunch of limitations with CFEXECUTE so I turned to a VBS file and ADO to get the job done. The monster hack ran fine for a long time and just recently died when we upgraded to MSSQL 2005. After I was not able to fix the ADO connection properly
# Posted By full download | 10/12/10 4:34 AM