Take the 2-minute tour ×
Information Security Stack Exchange is a question and answer site for Information security professionals. It's 100% free, no registration required.

So, I want to start using pass, but I need a GPG key for this. This application will store all of my passwords, which means it's very important that I don't lose my private key, once generated.

Hard disks break, cloud providers are generally not trusted. Not that I don't trust them to not mess with my key, but their security can be compromised, and all my passwords could be found.

So, where can I safely store my GPG private key?

share|improve this question
Mine is simply stored in the OpenPGP application. –  Steve Feb 19 at 8:38
I keep my private key store on the cloud and on a thumbdrive that I usually have with me. Of course it has a good passphrase. It's really about balancing risk and accessibility. I could easily imagine a situation in which I'd handle my keys very differently. –  Dominykas Mostauskis Feb 21 at 10:24

10 Answers 10

up vote 66 down vote accepted

I like to store mine on paper.

Using a JavaScript (read: offline) QR code generator, I create an image of my private key in ASCII armoured form, then print this off. Note alongside it the key ID and store it in a physically secure location.

If you have a large key or lots of keys I recommend paperbak, although be sure to write down instructions on how to recover the data later. Just as important as how you back it up is how you restore it from a backup. I'd probably try this with dummy data just to be sure you know exactly how it works.

Worth noting you can protect your private key with a passphrase, so even if it's hosted with a cloud provider they can't see your private key, but then all your password security is reduced to that passphrase rather than the full private key, not to mention cloud providers can disappear overnight.

share|improve this answer
+1. Paper in a safe. Delightfully simple. –  RJFalconer Feb 18 at 10:56
Of all the answers, this seems the least risky to me. –  zigg Feb 18 at 13:48
I do the same. Go the extra mile and think about how paper can degrade, e.g. If an inkjet print gets wet -- put the paper in a ziplock bag, put a second copy in a safe or safety deposit box etc. –  Chris Johnson Feb 18 at 20:01
Just as an option, paperkey also exists: jabberwocky.com/software/paperkey –  Florian Margaine Feb 19 at 9:03
@crdx This question was asked from a back-up point of view. For real time usage the most secure method would be an OpenPGP smart card with hardware pin entry. –  deed02392 Feb 21 at 9:13

You can keep your private key in a flash drive and keep this drive in a locker. Also, ensure that you don't use this flash drive for activities which might cause infecting it with some malware.

share|improve this answer
So, the day I need my key because I lost my computer, I go get the flash drive, and finds it's corrupted. What do I do? –  Florian Margaine Feb 18 at 9:52
I'm asking this question because I've stopped counting the number of USB keys I've seen corrupted. –  Florian Margaine Feb 18 at 9:58
@FlorianMargaine raises a great point. USB keys—and, for that matter, WORM (a.k.a. WORN—the N stands for "never") optical media—have bad track records. That said, I might consider using this in addition to another, less-convenient method of backup such as the paper methods presented in other answers. –  zigg Feb 18 at 13:45
Actually, considering malware, SD card might be safer. And the small ones (up to 2GB) are quite reliable. –  tohecz Feb 18 at 20:12
What I do is to store the key on a flash drive and paper. If I'm lucky, the flash drive just works. If not, then the key recovery is just a bit more inconvenient. Also, like with any important data, consider having more than one backup. –  Miikka Feb 19 at 8:07

One option is to encrypt your key using a passphrase, and store the encrypted key on a cloud service.

I have the key on my laptop (hardware encrypted drive) and on a Truecrypt container on an external hard drive as backup. Ok, it's not zero risk of data loss, but it's down to a level that is acceptable to me.

share|improve this answer
As mentioned in another answer, this is very convenient, but you reduce the security of all items protected by your key to the passphrase. You also run the very real risk that your cloud service is going to find itself with different business priorities someday (cf. ourincrediblejourney.tumblr.com) which could leave you high and dry. –  zigg Feb 18 at 13:47
@zigg - if you use a decent passphrase then a cloud compromise is far from "high and dry" –  paj28 Feb 18 at 13:49
"High and dry" wasn't about compromise. There are two different points being made here, broken by "You also…" –  zigg Feb 18 at 16:26

I keep the key (and other sensitive data like a username / password list) encrypted in a truecrypt container. This container is protected by a massive passphrase. The container is also backed up on cloud storage so edits by any of my computers will be sync'd.

It's not perfect, but if the cloud provider dies, I still have it sync'd on my computers. If the file itself is compromised, they'd have to crack the truecyrpt phrase and the key passphrase.

share|improve this answer

I have two keys, one less secure stored on the computer and another one in an OpenPGP Card. The latter is as safe as it possibly gets because the private key never leaves the chip on the card. (Though, years ago, for best security I had to slightly modify gpg to use my card reader's secure keypad instead of getting the card's PIN from the PC's keyboard which may be prone to keylogger attacks.)

share|improve this answer

I would use steganography to place the encrypted key in a series of 100 photos that I upload on several cloud storage (box, dropbox and ovh) for example.
So first you need to know there is something on those picture, find out what and decrypt it.
It's a bit extreme but it resist fire better than paper.

share|improve this answer
+1 for "it resist fire better than paper." I still think a clustered cloud service is better then paper. –  EaterOfCode Feb 20 at 10:42
If you've encrypted the secret key, you could just as well print it and store a PDF on a cloud service. Standardisation is a big problem with steganography - you may find the application you used has gone missing when you come to needing your key back. –  deed02392 Feb 20 at 10:44
@deed02392 Well the method I propose is definitely extreme but was more here to show that if your want to hide things you have to be really careful. Also a readable pdf could be decrypted easily with a bit of brutforce while steganography implies to first find the information. but yes tools are rare and you better code your own. –  Kiwy Feb 20 at 10:50
Whilst I love the principle behind steganography, I've lost count of the number of files that have gone missing because I couldn't remember what picture I stored it in. –  deed02392 Feb 20 at 10:52

On the days when my paranoia is like a ripe tomato, begging me to pick it, I split the private key (naturally it is already passphrase-protected) in half, then make a 3rd string by XOR-ing them together. Then I use simple password encryption (gpg --symmetric) on each string, and put each on a remote server on a different continent. Ideally, each remote server is with a different ISP or cloud provider.

But as the medicine was working -- at least until I realized how ambitious the NSA has been -- what I've actually done in the past is merely encrypted the (whole) private key (again using gpg --symmetric) and put it on my smartphone.

Now, having read the other answers, I'm finding the idea of three QR codes, embedded into three family photos, blindingly attractive. Time for stronger medicine?

share|improve this answer

I store mine inside a KeePassX encrypted file, this file is saved inside a git repository which I clone on all machines I need to use the passwords. The added benefit is that I can keep passwords synchronized while if the server for some reason destroys the file I can always use any of the cloned repositories. If I am paranoid I can put a truecrypt volume containing the KeePassX encrypted file.

Git also gives me versioning so I can always get back to previous versions of my passwords file, that's preatty neet.

share|improve this answer
Yo dawg‌​, I heard you like encrypted files, so I... –  IQAndreas Sep 2 at 11:36

You could try memorizing it...

It might be possible to use a gzip like algorithm for humans to compress and memorize. You could encode into a tune and memorize that,

share|improve this answer
Sounds easier to encode a tune you already know into a key. :) –  bzlm Feb 19 at 20:16

Encode with a strong password and use it as signature on every forum you use. maybe there are mailinglists for such keys too.

share|improve this answer
This has got to be one of the worst ideas I have ever seen. –  Qwertie ϟ Jun 5 at 8:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.