Jotting down stuffs
Posts tagged cryptography
PGP Single Pass Sign and Encrypt .NET Stream
Mar 8th
In a recent software development project, I was required to be able to read PGP encrypted content, do something, and write PGP encrypted result. The project allowed calling of PGP (or GPG) command line to do the encryption and decryption needed. However that did not feel right to me. Googled a bit and then I found the Bouncy Castle C# Crypto APIs, that among everything else, included support for PGP without having any external dependency.
The compiled assembly for the Bouncy Castle APIs can be downloaded from the website, however it was compiled for the .NET 1.1 runtime version. You can easily download the source code instead and compile it for the other .NET versions if you want to. I managed to compile the source code for the .NET 2.0 runtime version without any changes to the original source code.
The bigger issue at using the Bouncy Castle APIs is that it does not seem to have any proper documentation for it. Read on to get the code for the .NET Stream >