När jag måste skriva, så skriver jag.

2 dec. 2010

Biztalk and encryption

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.

23 nov. 2010

Omstart?

Det händer inte så mycket här.

Jag ville dock få nedskrivet att det är trevligt att promenera hem genom nyfallen snö samtidigt som Jocke Berg sjunger en sång för vår elit i hörlurarna. Det är 5 grader kallt men det känns som plusgrader.

En kväll med mina arbetskamrater på puben. Trevlig. Jag har dock insett att jag förmodligen är den enda i sällskapet som inte kan säga varken bu eller bä om en viss Metallica-skiva, eller har sett Pulp Fiction tillräckligt många gånger för att känna igen enskilda repliker. Jag kommer knappt ihåg vad den handlar om. Jag uppskattar Tarantinos hantverk, men det är kanske inte riktigt vad jag helst ser om jag får välja. Å andra sidan, den enda gången jag sett Pulp Fiction var i mitten av 90-talet. Det kanske vore hälsosamt med ett återseende...?

En annan sak jag vill få nedskrivet är att min Frida har gjort en "mobilvärmare" åt mig. Den är jättefin och jag vill verkligen använda den. Men den ryms ju inte i framfickan på jeansen...

Så kan det vara.