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.
There are no comments for this entry.
[Add Comment]