Lately I've had the opportunity to do some Biztalk 2010 development, and amongst other things, creating an integration that needed PGP encoding.
For various reasons I chose to go with this one:
http://bajwork.blogspot.com/2007/08/pgp-pipeline-component-v11.html
It is pretty straight forward to use and relies on Bouncy Castle for the actual encryption.
However, after a while I discovered that it appeared to mess with some characters in the encrypted, namely our swedish å, ä and ö. But only when I tried to encrypt something else than UTF-8, which worked flawlessly. Also, if I MIME-encoded the message before encrypting it, it was also unaffected.
I've had very little contact with PGP previously, so I didn't really know where to start. Was this maybe some kind of PGP limitation? However, after a night of encrypting files of different formats and encodings, and trying other PGP software I realized that it must be this particular PGP component that's doing something wrong.
And it did, sort of. Before encrypting, it creates a temporary file so that it has something to encrypt. It turns out that this file was always created using the .Net default encoding (which is UTF-8). With Biztalk, you propably get pretty far with supporting just UTF-8 but if I have a windows-1252 file and writes it to disk as an UTF-8 file, the 7-bit ascii characters will look fine but anything from the extended area (>127) is lost.
I solved this problem by adding a new property to the component for TempFileEncoding.
However, there's a decrypt section which I havent really looked at yet, but I imagine the decrypted file is written as a binary file anyway which will preserve whatever encoding it may have.
När jag måste skriva, så skriver jag.
Visar inlägg med etikett PGP. Visa alla inlägg
Visar inlägg med etikett PGP. Visa alla inlägg
2 dec. 2010
Prenumerera på:
Inlägg (Atom)