Brainfish Eat Fishbrain

Monday, March 31, 2008

Heavy encrypting files on your linux box

After some nasty run-in with reality I decided to day to take better care of my passwords. By encrypting them with GnuPG, I thought I would stand a much better chance when my laptop gets stolen. I am lazy so I already have my HD encrypted, but, for the super paranoid, as I am becoming more and more, I now also have my passes seperate encrypted in a vault file with 4096 gpg encryption.

How? Very simple; first generate a pub/priv key pair;

gpg --gen-key

then add two files to your path;

enc;


#!/usr/bin/perl

$file = $ARGV[0];
$file1 = $ARGV[1];

if (!$file or !$file1) {
print "Usage: ./enc input output\n";
exit;
}

print `gpg --encrypt --recipient 'Your Name' -o $file1 $file`;


dec;


#!/usr/bin/perl

$file = $ARGV[0];

if (!$file) {
print "Usage: dec input\n";
exit;
}

print `gpg --decrypt $file`;


Then make sure you have zero writing tool to delete the original, to be encrypted, file and you're all done :)