[PATCH GnuPG 1/2] scd:piv: Keep the public key if a key import fails
David Seifert
soap at gentoo.org
Fri Nov 13 14:23:34 CET 2026
On Thu, 2026-11-12 at 16:29 +0100, Ingo Klöcker wrote:
> On Donnerstag, 12. November 2026 10:22:05 Mitteleuropäische
> Normalzeit David
> Seifert via Gnupg-devel wrote:
> > Clearing is not needed: writekey_rsa and writekey_ecc overwrite the
> > cert DO with the new public key after the card accepted the key.
> > do_genkey does the same.
>
> What happens when overwriting the cert DO fails? Do you then have a
> public key
> on the card which doesn't match the private key on the card? Isn't
> that worse
> than losing the public key on a failed import. You should have made a
> backup
> of the public key anyway. (How to get the backup of the public key
> back on the
> card is another story.)
>
> Regards
> Ingo
I looked into a recovery path, and it's just too messy, you're right.
On top of the fact that PIV technically has no import functionality,
all of this is already best effort. I'd drop that commit, but I would
keep the follow-on commit, namely allowing users to import keys without
maintaining a huge list of smartcards that support importing into PIV
slots? What do you think?
More information about the Gnupg-devel
mailing list