A sample demonstrates the PGP Encryption/Decryption in pipelines.
You can download a code here.
A sample is based on a sample by Brian Jones See original code here
The main additions to original code:
%u00b7
Single pipeline component was separated to two Encrypt and Decrypt pipeline components. It simplifies the pipeline configurations.
%u00b7
Configuration parameters are stored in SSO, which, I hope, improves security.
%u00b7
File names for temporary files are regenerated randomly each time. That eliminates errors in case when temporary file names are based on the inbound file names and pipelines are working simultaneously in several ports.
To build pipeline components you have to download a BouncyCastle.Crypto.dll assembly from
http://www.bouncycastle.org/csharp
.
The solution includes two pairs of the PGP keys. You can generate yours pairs using, for example, PortablePGP utility
http://primianotucci.com
Configuration includes a config file for a SSO Config Store utility created by Richard Seroter.
The test pipeline project includes four pipelines:
%u00b7
Send and Receive pipelines for Encryption
%u00b7
Send and Receive pipelines for Decryption.
To test these pipelines I’ve created four receive ports and four send ports. They create four test workflows:
%u00b7
Encryption on a Receive port:
RP::GLD.Samples.Pipelines.Encrypt.Encode ( PgpEncryptReceive pipeline )
%u00e8
SP:: GLD.Samples.Pipelines.Encrypt.PassThru
%u00b7
Encryption on a Send port:
RP::GLD.Samples.Pipelines.Encrypt.PassThru
%u00e8
SP:: GLD.Samples.Pipelines.Encrypt.Encode ( PgpEncryptSend pipeline )
%u00b7
Decryption on a Receive port:
RP:: GLD.Samples.Pipelines.Decrypt.Decode ( PgpDecryptReceive pipeline )
%u00e8
SP:: GLD.Samples.Pipelines.Decrypt.PassThru
%u00b7
Decryption on a Send port:
RP:: GLD.Samples.Pipelines.Decrypt.PassThru
%u00e8
SP:: GLD.Samples.Pipelines.Decrypt.Decrypt ( PgpDecryptSend pipeline )
To test pipelines:
%u00b7
Use test text files in a Tests\TestData folder
%u00b7
To test encryption:
1.
Copy test files to a Tests\Encrypt\In folder
2.
Encrypted files are created in a Test\Encrypt\Out folder.
%u00b7
To test decryption:
3.
Copy test encrypted files from a Test\Encrypt\Out folder to a Tests\Decrypt\In folder
4.
Decrypted files are created in a Test\Decrypt\Out folder.