Page MenuHome GnuPG

GnuPG: misleading error message keytocard
Open, NormalPublic

Description


If one gives a wrong Admin PIN when moving a key to a smartcard the error message states "invalid secret key"

Expected: wrong PIN

Event Timeline

werner triaged this task as Normal priority.Thu, Aug 4, 12:07 PM
werner added projects: gnupg (gpg22), Bug Report.

The problem seems to be that we don't return a status code with the
actual error via the --command-fd interface:

gpg: pinentry launched [...]
[GNUPG:] PINENTRY_LAUNCHED 24023 qt [...]
gpg: KEYTOCARD failed: Bad PIN

On the command line the correct code is returned. (tested with master)

With my patch I see the expected status message:

[GNUPG:] PINENTRY_LAUNCHED 25739 [...]
[GNUPG:] SC_OP_FAILURE 2
gpg: KEYTOCARD failed: Bad PIN

We need to check whether GPGME/kleopatra sees this too.

Looks good. After entering a wrong passphrase three times Kleopatra now reports

Moving the key to the card failed: Bad passphrase