TL;DR: The next few paragraphs are mindless rants on the chicken-egg safety problem, any sane person - you I presume - is better off not reading them and directly going to here
I’m very paranoid when it comes to managing private information like GPG Keys, SSH Keys, and other sensitive information. (What I call private information is essentially arbitrary, I tend to use the thumb rule that any kind of key, its meta-data and other information that I wouldn’t want people reading is private). At the same time, I’m also paranoid of my beloved computer crashing on me - I know, the thought itself is terrifying but a harsh reality that we need to face. A very nice quote which is vaguely relevant to this topic by Leslie Lamport:
You know you have a distributed system when the crash of a computer you’ve never heard of stops you from getting any work done.
After a lot of soul searching – on Google lasting for 10 minutes, I found
blackbox, a set of git hooks used by the holy
monks of StackExchange to encrypt all data using GPG Keys before adding it version control.
I suddenly felt complete, I was in bliss; I created a git repo, loaded it with all the
private information I wanted and pushed it to git (a private git hosting service and not
GitHub, just for an extra bit of security). I thought that I was done for life, and then
it suddenly struck me, the problem of encryption is essentially a chicken-egg problem. I
still needed a way to secure my GPG Keys and make copies.
Detested, I went in for another round of soul searching and now I just AES256 encrypt my GPG Keys,
Base64 encode it (to make them look all nice and clean) and store them in LastPass. (Still stuck in
the chicken-egg problem). The steps have bee illustrated below for the curious.
Encryption
Decryption
Update: Three years down the line and this still proves to be an effective solution. The only issue has been incompatibilities between openssl library which leads to the following error in Ubuntu 18.04:
After going down the rabbit hole of the internet, the solution is a simple addition of a md5 flag on the decryption encantation as follows: