Using smart card to access encrypted secret keyring

David Shaw dshaw at
Thu Dec 4 21:45:04 CET 2008

On Thu, Dec 04, 2008 at 07:32:36PM +0000, mikeb at wrote:

> The most obvious is that I have already got significant investment
> in my primary key which is DSA not RSA and therefore can never be
> moved to the card. It also has a number of subkeys which remain in
> use and they are not suitable for the card either.
> Also I have several other secret keys used for varying roles -
> personal, business, hobby and so on.  The card does not assist with
> these.
> However, if I could encrypt my secret keyring using the card key and
> then use those keys simply by inserting the card and entering its
> pin (i.e. the encrypted secret keyring is decrypted by gnupg for me)
> that would greatly assist. That would reduce the risks in having
> those keys on a less secure computer since they would be doubly
> protected; once by encryption and again by their passphrases.

It depends on how secure the "less secure" computer is.  The idea
behind a smart card is that the key itself lives on the card and can't
(by the nature of the card) be copied off.  Even if the host computer
is completely compromised, it cannot get the key off the card.  (It
can, however, remember your pin and use it to make some extra
signatures or the like when the card is in the reader and you're not
aware of it, but that's a different issue)

Hence the "it depends" answer: using a smart card to encrypt an
already encrypted secret key (that is, super-encrypting), doesn't
really give you much protection against a compromised machine.  Once
you decrypt the secret key for use, the compromised machine then has
it (remember that unlike the smart card key, the key we're decrypting
doesn't live on the card, so it's just a file on disk to the host
computer).  This is similar in effect to the "put the key on a USB
stick" idea.  The key is protected until you use it, after which is
isn't protected.

Another way to look at it is that if your computer is secure, you
don't need this, and if your computer is insecure, you can't use this.

I don't want to give the impression that doing this is useless.  It's
not, but it doesn't add very much protection above what GPG already
gives you with a straight passphrase.

A possibly better way to go about this is to make a new subkey or two
and store *them* on the card.  I know you have subkeys in use, but by
design, subkeys are easy to change.


More information about the Gnupg-devel mailing list