A sample demonstrates the PGP Encryption/Decryption in pipelines.
You can download code here.
A sample is based on a sample by Brian Jones See original code here
The main additions to original code:
· Single pipeline component was separated to two Encrypt and Decrypt pipeline components. It simplifies the pipeline configurations.
· Configuration parameters are stored in SSO, which, I hope, improves security.
· 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:
· Send and Receive pipelines for Encryption
· 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:
· Encryption on a Receive port:
RP::GLD.Samples.Pipelines.Encrypt.Encode ( PgpEncryptReceive pipeline )
è SP:: GLD.Samples.Pipelines.Encrypt.PassThru
· Encryption on a Send port:
è SP:: GLD.Samples.Pipelines.Encrypt.Encode ( PgpEncryptSend pipeline )
· Decryption on a Receive port:
RP:: GLD.Samples.Pipelines.Decrypt.Decode ( PgpDecryptReceive pipeline )
è SP:: GLD.Samples.Pipelines.Decrypt.PassThru
· Decryption on a Send port:
è SP:: GLD.Samples.Pipelines.Decrypt.Decrypt ( PgpDecryptSend pipeline )
To test pipelines:
· Use test text files in a Tests\TestData folder
· To test encryption:
1. Copy test files to a Tests\Encrypt\In folder
2. Encrypted files are created in a Test\Encrypt\Out folder.
· 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.
| posted on Sunday, December 25, 2011 8:47 PM