[PATCH GnuPG 1/2] scd:piv: Keep the public key if a key import fails

Ingo Klöcker kloecker at kde.org
Sat Nov 14 22:23:36 CET 2026


On Freitag, 13. November 2026 14:23:34 Mitteleuropäische Normalzeit David 
Seifert via Gnupg-devel wrote:
> 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.)
> 
> 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?

I'll leave that to Niibe-san to decide.

Regards,
Ingo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 265 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.gnupg.org/pipermail/gnupg-devel/attachments/20261114/0e45deca/attachment-0001.sig>


More information about the Gnupg-devel mailing list