May 15, 2007

PGPBlackBox Decryption Memory Issue

I'm using EldoS PGPBlackBox to decrypt a PGP file in a BizTalk pipeline. A pipeline component at the Decode stage calls the DecryptAndVerify(stream, count) method of PGPBlackBox to decrypt the stream, and returns that decrypted stream.

It works fine until the incoming file is > 15 Mb or so, then the call to DecryptAndVerify causes a System.OutOfMemoryException. One of the tech support suggestions from EldoS was to try to reproduce the issue using their PGPFilesDemo app. The first run through did not reproduce the error, however in the demo app, it is decrypting to a FileStream by default, not a MemoryStream. If no target file is selected when running the app however, it does try to use a MemoryStream and the error is reproduced - it causes a System.OutOfMemoryException. (Not selecting a target file causes the pgpReader_OnCreateOutputStream() event handler to execute the else{} clause).

So for now decrypting to a FileStream gets around the OutOfMemory exception, but unfortunately the workaround will be having a separate receive port for decrypting to a file, then picking that decrypted file up by another port for the rest of the processing.

The ticket's still open so hopefully we can improve the workaround...


Share |