How To Automatically PGP-Encrypt A File Upon Upload Using Triggers
Overview
OpenPGP encryption is an excellent way of securing sensitive files on a server. Even if the server is compromised, the information in those files can remain secret. On JSCAPE MFT Server, PGP encryption can be made to execute automatically. You can configure the server so that, as soon as a file is uploaded, the server will immediately encrypt it.
What we're trying to do
Find this interesting? Learn how to do it
There are two methods to achieve this. The first one involves triggers and is the method we'll be discussing on this post.
Launch the JSCAPE MFT Server manager and navigate to the Triggers module. Next, click the Add button to create a new trigger.
Once you get to the next screen, enter a name that would best describe this trigger. In our example, we entered "Auto PGP-encrypt File Upon Upload".
After that, expand the Event type drop-down list and select File Upload.
Click Next.
In the Trigger Conditions Expression box, enter the following expression:
Success = TRUE
Click Next to proceed.
Add a trigger action for this trigger by clicking the Add button.
From the Action drop-down list, select PGP Encrypt File.
Remember that, because of the event we selected earlier and the condition we specified after that, this trigger action will be performed as soon as a file is successfully uploaded.
Because you would want to encrypt the file that's just been uploaded, enter the variable %LocalPath% in the File field. The %LocalPath% variable holds the path of the file that was recently uploaded.
Next, make sure the Public Encryption Key checkbox is ticked and then select the PGP public key you would like to use in performing the encryption. If you don't have an existing PGP public key yet, I suggest you read the article "3 Ways To Generate OpenPGP Keys" first. You'll find a couple of instructions for generating OpenPGP keys there.
Note that, when JSCAPE MFT Server performs this trigger action, it will retain the source file by default. So, in effect, you'll end up with two files: the original (or source) file and the PGP-encrypted file. See the screenshot at the bottom of the article to see what we mean. The file that ends with .txt.pgp in that screenshot is the encrypted file.
Of course, that would mean the source file would still be easily accessible to whoever wants to view it. If you want to get rid of the source file, just tick the checkbox that says Delete Source.
As soon as you're done, click the OK button (as well as other OK buttons you may encounter) until you're back at the main screen.
Click Apply to finalize the trigger creation process.
That's it. Now you know how to automatically encrypt a file upon upload through the use of triggers. In our next post, we'll introduce you to another method of doing this.
Want to try this out yourself? Download a free evaluation edition of JSCAPE MFT Server now.