iTextSharp instance of BouncyCastle conflicting with standalone BouncyCastle library
I am currently using the iTextSharp library (itextsharp.dll version 5.3) inside a DLL written in C#. I also have a need to include the BouncyCastle crypto library (BouncyCastle.CryptoExt.dll version 1.7.4114.6378) to the same project, for the purposes of encrypting non-PDF files. The reference to the DLLs are included via the .csproj file.
Come compile time I get the following error:
error CS0433: The type 'Org.BouncyCastle.Bcpg.OpenPgp.PgpLiteralDataGenerator' exists in both 'c:\Trunk\lib\BouncyCastle.CryptoExt.dll' and 'c:\Trunk\lib\itextsharp.dll'
The cause of this error is the copy of BouncyCastle embedded inside the iTextSharp library, which has the same namespace as the standalone version of BouncyCastle. Removing the reference to the standalone version of BouncyCastle fixes the error, but this is not my preferred solution - I do not want my file encryption/decryption code coupled to my PDF conversion code.
Is there a version of the iTextSharp library that doesn't include BouncyCastle , forcing it to use my external reference to the library? If that is not possible, the only alternative I can see is to refactoring my code to separate the PDF code from the file encryption/decryption code.