Vault is a command line utility for encrypting & decrypting things. Those things are stored on disk in hidden files, meaning in *nix they simply have a ‘.’ in front and don’t show up unless you type ls -la 😉 But anyway, who cares if someone can locate the files ! They are AES encrypted !
I wrote Vault for a couple of reasons.
- To learn how to use encryption in Python
- To store passwords for stuff
- To turn Vault into methods in my Utilities class that I use for my daily programming activities. First write a command line utility, then write a class 🙂
I literally wrote vault earlier today and even though it is super simple, I still find it cool & useful so I had to share. Here’s a demo on it’s simple usage !
AES / Vault supports 16, 24, or 32 byte encryption keys. A byte is one character. Your key should be something ambiguous that you can remember and you should not use the ‘0123…’ example below. What would really be paranoid is to encrypt your keys in a separate vault somewhere 🙂 Note, you will need to use the same key to encrypt as decrypt for a given stored piece of encrypted data.
➜ vault git:(master) python store.py --name tuxlabs -t 'Well I could store a password or b00bs, cause everyone likes b00bs even the newbs' --key 01234567890987654321abcd p/hvz1hf9RIyBeyMmgL2CILvlM20vU72E075K+32tysNU8dIJOcX/gVmRISYQTp0tHZ/W+qL2mCvMFrMP3rGAV2kCNNjGQNnbUSgPibPGiqfwMrQm3/EhH/f18dZofDGTwcMmHZ3LiERuIZt1toU0w== was stored as tuxlabs ➜ vault git:(master) ✗
Can You Read The File Contents ?
➜ vault git:(master) ✗ cat .tuxlabs p/hvz1hf9RIyBeyMmgL2CILvlM20vU72E075K+32tysNU8dIJOcX/gVmRISYQTp0tHZ/W+qL2mCvMFrMP3rGAV2kCNNjGQNnbUSgPibPGiqfwMrQm3/EhH/f18dZofDGTwcMmHZ3LiERuIZt1toU0w==% ➜ vault git:(master) ✗
➜ vault git:(master) ✗ python retrieve.py --name tuxlabs --key 01234567890987654321abcd Well I could store a password or b00bs, cause everyone likes b00bs even the newbs ➜ vault git:(master) ✗
Alternatively, you can hide the key from the command line, by not specifying it.
➜ vault python store.py --name JimmyJohns --text 'Really Fast' Key: 1HHF5TPl0cklDU/TXjMQ8nFeqK4zULQ50dVpJ+apgzQ= was stored as JimmyJohns ➜ vault python retrieve.py --name JimmyJohns Key: Really Fast ➜ vault cat .JimmyJohns 1HHF5TPl0cklDU/TXjMQ8nFeqK4zULQ50dVpJ+apgzQ=% ➜ vault
Clone Vault on github