Intro: QR Codes for Offline Encryption Key Storage
I use encryption on my hard drives at home and as part of my backup strategy. Encryption is great for security, but can be a nightmare for data recovery if the encryption keys are lost or forgotten. While online password managers could be used to store these keys (e.g. LastPass, 1Password), I wanted to store a copy of them offline, on paper.
Good security requires long and complex keys, which could then also make it annoying to retype those if one needs to resort to retrieving them from the hard copy. While the keys could be scanned and optically processed to turn them into character strings, there is a better way to store exactly that type of data--QR codes.
This Instructable describes the process I went through in turning my encryption keys into QR codes for easy reading if I ever needed them in the future.
Step 1: How to Make a QR Code
Making QR codes is easy, as there any many websites that allow one to enter in either a URL or a string of characters and the websites output an image file. I could have done this with each of my keys, put them in a document together, and then could have printed it out and secured the document.
What I didn't want to do though was input all my encryption keys into insecure websites operated by faceless and potentially malevolent people. I wanted a way to generate QR codes on my local machine so I could create them, print them, and then delete all the electronic remnants.
While there may be executables available to help with this, I sought out a Python package that could do the work--PyQRCode.
Step 2: PyQRCode Installation and Use
PyQRCode can be installed using pip (PyPa). On OS X, this is as simple as running the terminal command:
: sudo easy_install pip
Once that is installed, pip can be used to download PyQRCode by running:
: sudo pip install pyqrcode
For creating PNG files, one must also install pypng:
: sudo pip install pypng
Once the software is installed, Python can be used to create the QR codes
>>> import pyqrcode
>>> qrkey = pyqrcode.create('This is my encryption key!',error='H')
>>> qrkey.png('key1.png', scale=5)
The first line imports the python package for the current session. The second line creates a Python object that contains the character string, and optionally an error code that specifies how robust the QR code should be for error correction. The third line saves the QR code to a PNG file called, "key1.png", and scales it to a larger size.
This process can be repeated for each of the keys that one needs to safely store.
Step 3: Example Word Document
I then took each of the QR codes with my important keys and put them in a Word document I could print. Attached is an example PDF of such a document.
Step 4: Still to Do
While I can read these QR codes using an app on my phone, I may still want to use Python or a similar tool to read them back in to my computer, but I will save that for a future effort.