Created 05 Apr 2012
Modified 05 Apr 2012
Article 2657
How To automate transfer of PGP encrypted files
Goal
Automatically encrypt all files in a folder with a PGP public key before they are being uploaded. Alternatively also sign the encrypted files with a PGP private key.
Solution
Prerequisite
- Download and install the SmartFTP SDK
- Download and install Gpg4Win-Light
- License for SmartFTP Professional Edition or higher
Import the recepient's public key
- Start the the GNU Privacy Assisant
Start Menu: All Programs - Gpg4win - GPA
- Go to the menu Keys - Import Keys
- Select the PGP public key file
Setup Transfer Queue Item
- Start SmartFTP
- Stop the Transfer Queue
- Drag&Drop the folder you want to upload to the Remote Browser
- A new item is created in the transfer queue
- Right-click the item, select Properties from the context menu
- Go to the Script dialog
- Select the ApplyToFilesRecursively.js script from the SmartFTP SDK. Example:
C:\Program Files (x86)\SmartFTP Client SDK\Samples\TransferQueueItem\JScript\ApplyToFilesRecursively.js
- For the Arguments use:
"C:\Program Files (x86)\SmartFTP Client SDK\Samples\TransferQueueItem\JScript\PgpEncryptFile.js"
including the double quotes.
- Update the settings and paths in the PgpEncryptFile.js script
- Set the correct path to gpg2.exe
- Set the recipient key id
- Enable signature and set the signer if you also want to sign the encrypted file (Optional)
- Click OK
Setup Scheduled Task
- Right-click on the transfer queue item, select Schedule from the context menu
- Click OK
- Go to the Scheduler pane
- Run the scheduled task: Right-click on the scheduled task and select Run
- Go back to the Transfer Queue pane and start the queue
Notes
For debugging purpose you may want to disable the [ ] Use cached local folder tree option in the Queue Item action properties in the scheduled task.
Keywords
pgp