Clever Foo

Rafael Ferreira's life log

Archive for December, 2008

Simple secrecy

with one comment

So, let’s say you have a text file that you use to keep track of your account information as you zip along the internets. Let’s say you would like to keep that stuff safely encrypted in your lappy. Well, here’s a ridiculous simple way to encrypt and decrypt files on just about any OS that has access to the openssl library (I’ve tested it on OSX and Linux).

For example, let’s say you would like to encrypt a text file called secret.txt. As you can see below the unencrypted file is just plain text:

rafael-mb:tmp rafael$ file secret.txt
secret.txt: ASCII text
rafael-mb:tmp rafael$

But we can you OpenSSL to encrypt our file with the command below:

rafael-mb:tmp rafael$ openssl enc -aes-256-cbc -salt -in secret.txt -out secret.txt.encrypted
enter aes-256-cbc encryption password:
Verifying - enter aes-256-cbc encryption password:
rafael-mb:tmp rafael$

where -aes-256-cbc is just the algorithm to use and -in/-out represent the input and output file names. Now, after the encryption:

rafael-mb:tmp rafael$ file secret.txt.encrypted
secret.txt.encrypted: data
rafael-mb:tmp rafael$

And for the decryption:

rafael-mb:tmp rafael$ openssl enc -d -aes-256-cbc -in secret.txt.encrypted -out secret-new.txt
enter aes-256-cbc decryption password:
rafael-mb:tmp rafael$ file secret-new.txt
secret-new.txt: ASCII text
rafael-mb:tmp rafael$

Voila!

Written by raf

December 30th, 2008 at 10:00 pm

Posted in General

So this is what intelligent pragmatism looks like…

with 3 comments

After the last 8 years of partisan ideological extremism one can almost lose sensibility to such zany behavior.

Written by raf

December 7th, 2008 at 5:57 pm

Posted in General, Politics