Saturday, September 22, 2012

logjammin update

I moved logjammin over to github from bitbucket. Had more to do with the usual social networking stuff -- people I wanted to work with are on github, don't really use bitbucket).

In addition to that, I have been doing some major surgery on the project to change out some of the dependencies. Specifically, I have switched out CryptoPP for the Nettle cryptography library, and I am eventually going to switch out OpenSSL for gnutls.

On the nettle front, I had a hard time finding good examples for the GCM mode encryption. I had to piece things together form the information in the Nettle documentation, source, and playing with results. You can see the resulting encrypt and decrypt methods in the lj::Document class.

The most confusing part, at least for me, was that in GCM mode, everything uses the encrypt function of the underlying cipher. If you don't pay attention and accidentally pass in a decryption function, it will not work as expected. I also, stupidly, thought I had to chunk my inputs into the block size. I didn't realize until the end that I could just pass the entire message in and get the expected result. You only need to chunk up the message if you need to call encrypt / decrypt multiple times.