gpg: Fix edit-key bkuptocard
Testing, HighPublic

Assigned To
Authored By
• werner
Jul 10 2026, 9:46 AM

Description

The "bkuptocard" sub-command of gpg --edit-key does not anymore work as it used to work back then when we had a secring.gpg and a pubring.gpg. The problem is that no public subkey packet is created and one has to resort to generate subkey from card. This needs to be fixed.

And while at it: the gpg --card-edit generate command needs an option to only create the signing key, which is the first step in replacing a bricked card with a new card. After that bktocard can be used to restore the encryption subkey.

Event Timeline

• werner created this task.
• werner created this object with edit policy "Contributor (Project)".

Please see the rGf103eaee63f702278824967365de16b9757ecc83 for detailed comment on the (solved) problem.

• werner changed the task status from Open to Testing.Jul 15 2026, 10:55 AM

Restoring an encryption subkey is now easy if you have an sk_KEYID.gpg backup:

  1. Get a fresh card or factory-reset a card.
  2. gpg --card-edit, then "admin", then "generate primary"
  3. gpg --edit-key NEWKEYID, use "bkuptocard sk_KEYID.gpg"
  4. Optionally use gpg --edit-key to add a new authentication (ssh) key to the card.