This article will explore the benefits of using DidiSoft OpenPGP Library for .NET with “MoveIt Automation“(r), including how to integrate the library into your workflow, and how to use its features to enhance the security of your file transfers.
DidiSoft OpenPGP Library for .NET is a reliable and easy-to-use solution for implementing OpenPGP encryption in your .NET applications.
Table of Contents
- PGP Encrypting a file with MoveIt Automation
- PGP Signing and encrypting a file with MoveIt Automation
PGP encrypting a file with MoveIt Automation
In order to invoke the PGP API functions we will be using the PowerShell support built into MoveIt and the PowerShell module that ships with DidiSoft OpenPGP Library for .NET.
Assuming you have installed OpenPGP Library for .NET on the MoveIt Automaton Server machine, we can create a new script from the MoveIt Automaton Web Admin menu Resources > Scripts and clicking on “Create Script“.
We have chosen a name of “Encrypt-PGP-Task” and selected PowerShell as the script type. This is the full script in text format:
try { $sourceFile = $miaclient.MICacheFilename() $outputName = $miaclient.MIGetTaskParam('OutputName') ConvertTo-PgpEncryptedFile -Path $sourceFile -Key "C:\Keys\recipient_key.asc" -Output $outputName } catch { $miaclient.MISetErrorCode(10000) $miaclient.MISetErrorDescription("Error: " + $Error) } |
Setting up the Task
With our script now in place, we can go ahead and create an advanced task, which will pick up the PDF files from the source and pass them into the script.
Task Parameter
In our PowerShell code above, we reference a variable called ‘OutputName’, which is expected to be passed as named parameter. So, we have to create such parameter for our script:
The parameter value uses the [FullPath] MoveIt macro, which returns the full path and name of the input data, so if the input data is ‘c:\Data\Incomming.report001.txt‘ the OpenPGP encrypted output will be stored in ‘c:\Data\Incomming.report001.txt.pgp‘ .
Our script uses a hard coded public encryption PGP key, so we can expose this as a parameter too.
Running the PGP encryption task
All we have to do is place the input files inside the source folder and they will be picked by MoveIt Automation and encrypted.
PGP signing and encrypting a file with MoveIt Automation
This example uses PGP signing and encrypting in one pass.
For this example you should create two additional Task parameters: RecipientPublicKey and PrivateKey. (The private key password can also be exposed as Task parameter if needed)
try { $sourceFile = $miaclient.MICacheFilename() $outputName = $miaclient.MIGetTaskParam('OutputName') $publicKey = $miaclient.MIGetTaskParam('RecipientPublicKey') $privateKey = $miaclient.MIGetTaskParam('PrivateKeyKey') ConvertTo-PgpSignedAndEncryptedFile -Path $sourceFile -Key $privateKey -Password "my key password" -PublicKey $publicKey -Output $outputName } catch { $miaclient.MISetErrorCode(10000) $miaclient.MISetErrorDescription("Error: " + $Error) } |
The result file stored in the $outputName parameter will be PGP signed and encrypted.
Summary
MoveIt Automation(r), a product of Progress, is a popular file transfer and workflow automation solution used by many organizations to automate file transfers and business processes.
By incorporating DidiSoft OpenPGP Library for .NET into MoveIt Automation, users can easily encrypt and decrypt files in the OpenPGP format during file transfers, ensuring that sensitive information remains secure.