Knowledge Base

Home > How To > How To automate transfer of PGP encrypted files

Created
Modified

Print Article

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

  1. Download and install the SmartFTP SDK
  2. Download and install Gpg4Win-Light
  3. License for SmartFTP Professional Edition or higher

Import the recepient's public key

  1. Start the the GNU Privacy Assisant
    Start Menu: All Programs - Gpg4win - GPA 
  2. Go to the menu Keys - Import Keys
  3. Select the PGP public key file

Setup Transfer Queue Item

  1. Start SmartFTP
  2. Stop the Transfer Queue
  3. Drag&Drop the folder you want to upload to the Remote Browser
  4. A new item is created in the transfer queue
  5. Right-click the item, select Properties from the context menu
  6. Go to the Script dialog
  7. Select the ApplyToFilesRecursively.js script from the SmartFTP SDK. Example:
    C:\Program Files (x86)\SmartFTP Client SDK\Samples\TransferQueueItem\JScript\ApplyToFilesRecursively.js 
  8. For the Arguments use:
    "C:\Program Files (x86)\SmartFTP Client SDK\Samples\TransferQueueItem\JScript\PgpEncryptFile.js"
    including the double quotes.
  9. 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)
  10. Click OK 

Setup Scheduled  Task

  1. Right-click on the transfer queue item, select Schedule from the context menu
  2. Click OK
  3. Go to the Scheduler pane
  4. Run the scheduled task: Right-click on the scheduled task and select Run
  5. 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

Related Articles
icon PGP


Please choose 1 to 5 whether this article solves your problem.

1 No Help at all

5 Problem Solved

Saving...
Thank you for your feedback.

What do you think about this topic? Send feedback!