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.

I assume that GPG is very strong to crack, guess, etc. Since I have confidence in GPG, would it be appropriate to use my GPG key as the master key for a password manager or generator?

share|improve this question
why vote down? noobish question? –  ttouch Mar 5 '13 at 15:07
There is no practical usage for using your private key to decrypt a password manager with GPG. Plus it sounds like a product recommendation. –  Lucas 'Paul' Kauffman Mar 5 '13 at 15:09
It sounds clever and secure to me. What's wrong with product recommendation? I've seen other questions about password managers etc. –  ttouch Mar 5 '13 at 15:11
@ttouch Ah see, that to me part is the key point. –  Terry Chia Mar 5 '13 at 15:13
Well, it makes some sense. GPG is a trusted, vetted product that you have a reliance on. That's one of the greater tenets in choosing a security product. This is why we seek experts to answer these questions, because unless you've spent a lot of time and are well-versed, that's all you have to rely on. So, after some thought, +1 from me. –  Jeff Ferland Mar 5 '13 at 15:26

2 Answers 2

up vote 8 down vote accepted

GPG encrypts your data with a symmetric key, then encrypts that symmetric key with / for the public / private keypair. That keypair is usually kept safe by symmetrically encrypting it.

What you're asking for is a program that would diagram as such:

Symmetric -> Asymmetric -> Symmetric

What you should use is a password manager that does the following step:


The job of a password manager is as much one of not placing your data in cleartext as it is simplicity. GPG's job is to allow communication of a key exchange across a clear channel. Since you'll be the only one encrypting / decrypting your passwords, symmetric encryption is just fine. Cryptographically speaking. GPG uses OpenSSL for the backend anyway as a great number of freely available password managers most likely do.

Now, with all that said, it makes good sense to do this on your computer if your GnuPG key is held on an external smartcard, and it'd work with a phone if there were an NFC version of the card. You could use git for synching various password files.

share|improve this answer

I'll start with the quick answer to your question (which has two parts). First off, yes, GPG is suitable as a password manager in terms of having strong encryption. It is very unlikely (most would say impossible) that the password would get cracked using asymmetric encryption.

The second part of the answer is that, no, it's probably not suitable as a password manager. Having to manage keys can be irritating if you're using several machines, and if you lose your private key, you're liable to have to reset many, many passwords--a real pain.

The quick solution to the key management problem is to use gpg -c, which allows you to use symmetric encryption with gpg using a passphrase. This is great, but now we're getting into the territory of what I'd actually recommend for an alternate solution since you're not actually using the primary benefit of GPG anymore (public/private keys).

I'm not going to go into the full details of my current setup, but I can outline it quickly: rather than using gpg to manage a text file of credentials, I use openssl. The reasoning behind this is simple: almost every Linux (and, I believe, OS X) system comes pre-installed with openssl. It's universal, which makes portability very easy if I'm carrying my encrypted file around with me on a flash drive (a copy of it, of course). There are no keys to manage, and I can easily choose which encryption method to use.

I tend to prefer something like this: openssl aes-256-cbc -salt -in passwords.txt -out passwords.aes to encrypt my password database. Don't forget to rm the plaintext! From there, I can easily just run openssl aes-256-cbc -d -in passwords.aes and grep for the creds I'm using. Adding things can get a little bit trickier--I generally have to print out to stdout, or append a temp file then re-encrypt--but it's worth it to me for the portability that openssl provides.

share|improve this answer
very smart! is the aes strong enough? –  ttouch Mar 6 '13 at 13:43
AES-256-CBC should be strong enough for any feasible purpose. The real risk would lie in brute-forcing the password, rather than breaking the crypto itself. Using a long, complicated passphrase is the way to go on this one. –  dshaw Mar 7 '13 at 23:47

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.