September 20, 2011

Saving your passwords file using gpg

gpg provides a nice tool for encrypting and signing files. I am currently using gpg version 1.4.11 to save my passwords.It is available for most linux distros and is very easy to use.

For example if I have a plain text file with the names and passwords I used in various banks

bank: velma inc
login: scoobydoo
account: 112358
password: scoobysnacks

bank: haddock gmbh
login: snowy
account: 31415
password: tintin

I have this filed saved as finance-passwords. Then with gpg I encrypt it using the following command:
 > gpg  -c --force-mdc finance-password

This creates a file finance-password.gpg in the same folder. Note the --force-mdc which needs to be provided. --force-mdc is to use encryption with a modification detection code while -c is to encrypt with a symmetric cipher using a passphrase. Do a man gpg for further security stuff but for guys like me this is enough.

The encrypted file can be decrypted using the following command
 > gpg finance-password.gpg 

This creates the file finance-password. During decryption I get the warning
gpg: WARNING: message was not integrity protected

if the --force-mdc option is not used during encryption.

No comments: