I’m working on a little app that can do simple and portable file encryption across different operating systems. Something I can put on a thumb drive to encrypt files so that when I inevitably loose the drive, all my documents aren’t public knowledge.

Most modern operating systems offer file encryption … a lot of new external drives and flash drives come with programs that will encrypt the filesystem … but all of those things are a huge pain when you live on multiple platforms. I move files around between my Windows, Mac, and Solaris computers at work and my Linux boxes at home. I need something simple to get the job done that works on all of the above. Java lets me do this pretty easily, let’s take a look …

Cryptography is still a bit of a black art, even when looking at high level API’s like we’ll see in this example. There are any number of different ways to do this using different types of keys and algorithms. In this example, I’ll be using a simple password based symmetric key with Triple DES (DESede) encryption (PKCS #5, RFC2898). Please see the RFC doc for a definition of terminology.

Creating the cipher

The first step is generating an encryption key and using it to create a cipher:

Update: The real beauty of using IO streams like this is that you do not have to worry as much about Java’s heap space. Your memory usage rarely grows past the chunk size specified in the “doCrypto()” function; even if you are operating on huge files.

Earlier today, I was attempting install Fedora 11 on a VMware virtual machine, but the boot process would hang with a black screen and a solid white curser at the top:

Fedora 11 LiveCD Hangs on Boot

After much whaling and gnashing of teeth, and a new download of the ISO because I thought it could be corrupted, I stumbled upon a quick fix. Add the line “noapic acpi=off” to the boot options like this:

Fedora 11 LiveCD boot options

And voila, your LiveCD boots!

Fedora 11 LiveCD boots!

I recall having this issue on an old Dell notebook with a previous version of Fedora, but I couldn’t remember the options I used to get it to work. Thanks to “dohnut” over here.