Page MenuHome GnuPG

Kleopatra: Add card action to restore gpgsk backup file to a new card
Open, HighPublic

Description

We have a backup format for secret (sub)keys sk_keyID.gpg which is generated when you create a key on a smart card and choose to make a backup of the encryption key.

Now we want to add a card action in Kleopatras smart card window (could maybe be named "Generate Keys using Backup"). It should only be executed on an empty smart card and in the end there should be as many subkeys as are generated by the "Generate New Keys" action (3).

These are the steps you have to do on the command line for restoring the encryption key backup to a new smart card (in GPD 5.0.2):

gpg/card> generate --algo=brainpoolP256r1 OPENPGP.1 # create signing key
gpg --full-gen-key  # create public key for the signing key
    (14) Existing key from card
gpg --edit-key NAME # given in last step
gpg> bkuptocard /path/sk-backupdatei.gpg # copy encrypt key to card
   (2) Encryption key
gpg> addkey  # add encryption key zu public key
    (14) Existing key from card
   (2) F431A26E54E99AC04E8BEABED9701A955B93E382 OPENPGP.2 brainpoolP256r1 (encr*)
save

Or, if you have generated keys for all key slots in the first step (like in "Generate New Keys"):

gpg --edit-key NAME
key 2  # select encryption key
delkey # delete the encrypt key, because otherwise the pubkey has a no longer existing key listed after the next step
bkuptocard … # copy encrypt key to card
  (2) Encryption key
addkey # add encryption key zu public key
  (14) Existing key from card
   (2) F431A26E54E99AC04E8BEABED9701A955B93E382 OPENPGP.2 brainpoolP256r1 (encr*)
save

Event Timeline

ebo renamed this task from Kleopatra: Import function for gpgsk files to Kleopatra: Import of gpgsk files.Feb 15 2024, 9:01 AM
ebo reopened this task as Open.
ebo assigned this task to TobiasFella.
ebo updated the task description. (Show Details)
ebo added a project: vsd33.
ebo edited projects, added gpd5x; removed Restricted Project.Dec 12 2025, 3:45 PM
ebo renamed this task from Kleopatra: Import of gpgsk files to Kleopatra: Add card action to restore gpgsk backup file to a new card.Tue, Jun 30, 1:38 PM
ebo raised the priority of this task from Normal to High.
ebo updated the task description. (Show Details)