Friday, 23 May 2014

Password protect files on fly using crypt-editor


I always wanted an editor which can help me edit text securely with password protection using which I can easily create, save, edit files on fly. I am sure that there are some editors which can do it. However I felt that instead of an editor, it is better to have an interface which will allow me to edit files using my favorite editor while password protecting it. So I wrote a script called crypt-editor which uses gpg/mcrypt to encrypt and decrypt files enabling users to edit files using any editor.


Fork me on Github

Usage

Say you want to create/open a file using gedit:
crypt-editor gedit [filename]
You will be asked to enter the passphrase. Then gpg/mcrypt decrypts the file (if already exists) and opens it with gedit. On closing the file gpg/mcrypt encrypts it back and deletes the decrypted file.
If you do not specify the editor, the file is opened in vi editor (my favorite so it is default :P)
crypt-editor [filename]
Complete option list of crypt-editor:
crypt-editor -help
crypt-editor [filename]
crypt-editor [editor] [filename]
crypt-editor [-k key] [filename]
crypt-editor [-k key] [editor] [filename]

To create new file with mcrypt instead of gpg use -m option
crypt-editor -m [filename]

Examples:
crypt-editor passwords
crypt-editor gedit passwords
crypt-editor -k pa$$word passwords
crypt-editor -k pa$$word gvim passwords


Installation

Setting up crypt-editor is simple and straight forward.
git clone https://github.com/alseambusher/crypt-editor
cp crypt-editor/crypt-editor /usr/bin
If you want to use mcrypt instead of gpg, you have to install mcrypt.
apt-get install mcrypt

No comments:

Post a Comment