After exporting my private key, I moved my private key on a smart card using keytocard. This worked fine, and I could sign and use GnuPG as expected.
Now I would like to go back to have the private key in my GnuPG data base. Since I have the private key backed up, I thought this should be easy, and tried to simply import it:
gpg --import-ownertrust mybackup
However, this seems not to help. The key has still the card-no attached, and when I try to sign something GnuPG asks for the card.
Even deleting the key and reimport seem not to help:
$ gpg --expert --delete-keys <KEYID> $ gpg --edit-key <KEYID> gpg (GnuPG) 2.1.11; Copyright (C) 2016 Free Software Foundation, Inc. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. gpg: key "<KEYID>" not found: No public key $ gpg --import-ownertrust mybackup gpg: key <KEYID>: secret key imported gpg: Total number processed: 5 gpg: imported: 1 gpg: unchanged: 1 gpg: secret keys read: 5 gpg: secret keys imported: 1 gpg: secret keys unchanged: 2
With that, it seems that GnuPG imported the key. But if I try e.g. signing, GnuPG still asks for the smart card. Also --edit-key still shows "card-no". It seems as if this information is not removed using the delete-key operation above. How can I restore the private key without a reference to the smart card?