Monday, January 20, 2014

Encrypting and Decrypting local files

One thing that I love about living in the internet age is the fact that I can have access to my information from almost anywhere in the world on any device. Some benefits of this are being able to listen to my music or watch my movies on many devices any time. I'm able to use a password manager (like KeePass) so that I can use strong passwords and take them with me so I don't have to remember them.

Often I find that I want that same convenient access to files that contain sensitive information (like bank account numbers) and such. Of course I don't want these files readable and accessible to just anyone and I honestly don't trust putting them in something like DropBox where they're supposed to be encrypted but I don't know how well their security is managed.

Like my music and my movies the convenience of being able to access these files from anywhere is a must. So what I've chosen to do in order to keep these files secure and publicly available to me on the internet is to encrypt the individual files.

This is actually not a really difficult thing to do because of OpenSSL. OpenSSL is available on most (if not all) *nix distributions as well as being available as a Windows Package.

To encrypt a file using OpenSSL you would do the following:

$ openssl des3 -salt -in "SOME_FILE" -out "SOME_FILE.encrypted"

To decrypt that same file using OpenSSL you would do the following:

openssl des3 -d -salt -in "SOME_FILE.encrypted" -out "SOME_FILE"