I am trying to decrypt a CSV using Coldfusion. The CSV has been encrypted using gpg4win. I have created a scheduled task in CF Admin which checks a folder for the encrypted file and if found, decrypts it and stores the result in another folder as a CSV file (Which will then be imported into a DB).

This is an excerpt of the code:

<cfparam name="Variables.InputFolderName" default="inputfolder" />
<cfparam name="Variables.OutputFolderName" default="outputfolder" />
<cfparam name="gKeyPassphrase" default="sampletestkey" /> <!--- Passphrase for gpg encryption --->
<cfparam name="gEncryptionKeyID" default="sampletestid" /> <!--- Encryption iD --->

<cfset inputFilePath = ExpandPath("/resources/uploads/csv/#Variables.InputFolderName#") />

<cfset outputpath = ExpandPath("/resources/uploads/#Variables.OutputFolderName#") />

    <cfdirectory directory="#inputFilePath#" name="Variables.EncryptedCSVFiles" filter="*.gpg" action="list" >

    <cffile action="read" file="#inputFilePath#\#name#" variable="Variables.EncryptedCSVData" />

    <cfexecute name="C:\Program Files (x86)\GNU\GnuPG\gpg2" arguments="--passphrase=#gKeyPassphrase# --batch -o #inputFilePath# -d -r #gEncryptionKeyID# ouputfile=#outputpath#/test.csv" timeout="300"></cfexecute>

 <cfcatch type="any">
    <!--- I tried emailing a cfdump of the error to myself but it didn't work --->

When I run the scheduler manually, the 'This scheduled task was completed successfully.' displays in CF Admin but the a decrypted file is not created and I don't get any error reporting email either.

Will be really grateful if anyone can help me out with this.

Thank you.

4 Years
Discussion Span
Last Post by paulkd

The scheduled task will point to a cfml file. Are you able to run the actual cfml file manually and if so do you see an error?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.