Vault
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 π
Vault Usage
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 !
Keys
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.
Encrypting
β 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) β
Decrypting
β 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
Enjoy !
Jason Riedel