To my amazement, that post still gets tons of hits and it’s linked to from lots of different places. The problem, it’s a bit crusty and I really don’t like it that much. So, here’s a much needed update:

I’m not going to spend much time explaining everything here. Hopefully the comments in the code will do that. This example uses AES, but could be easily modified to use other encryption algorithms.