BizTalk: Sample: PGP Encryption/Decryption Pipeline Components

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:
**RP::GLD.Samples.Pipelines.Encrypt.PassThru    è 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:
**RP:: GLD.Samples.Pipelines.Decrypt.PassThru  è 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:

  1.        Copy test encrypted files from a Test\Encrypt\Out folder to a Tests\Decrypt\In folder

  2.        Decrypted files are created in a Test\Decrypt\Out folder.

Print | posted on Sunday, December 25, 2011 8:47 PM

This article is part of the GWB Archives. Original Author: Leonid Ganeline

New on Geeks with Blogs

  • We Won The One Award I Actually Care About

    Full Scale made the Inc. 5000 for the fifth year straight, the 12th listing across my three companies. Here is why the one award you cannot buy is worth stopping for.

  • Your Customers Build the Features Now

    I let a tool I liked sit dead for a year rather than build the features I wanted. An MCP server meant I never had to, and your customers can do the same to your product.

  • Get the Size of a Directory in Linux the Easy Way

    du -sh for the quick answer, ncdu for the cleanup, df for the disk itself: every command for checking directory size in Linux, plus why du and df never agree.

  • Vim Search and Replace: The Ultimate Guide

    One :%s command replaces every match in a file before a find dialog would even open. The Vim substitute patterns worth the muscle memory: flags, ranges, capture groups, and multi-file edits.