Getting rid of key stub when moving key to new smart card?

Arthur Ulfeldt arthur at
Wed Mar 16 00:22:25 CET 2016

I am having the same problem. The only way to make it see the key on
the new card that I have come across is to completely remove the
entire .gnupg directory and not restore any of it, then import the
public key and only then run gpg --card-status.

If I don't completely wipe everything out (including all other keys
and signatures) then the stub (if thats the right term for this) seems
to survive.

On Tue, Mar 15, 2016 at 12:48 PM, Oliver Klee <gnupg at> wrote:
> Hi everybody,
> I'm using GnuPG 2.0.28 on Kubuntu 15.10.
> So far, I've been using a YubiKey Neo as a OpenPGP smart card. I've
> dutifully done all the steps including creating my key off-card, backing
> it up externally and then moving it to the YubiKey using keytocard.
> I've decided to move to a new YubiKey. I've deleted my secret key (i.e.
> more or less the stub) using --delete-secret-keys and re-imported the
> backup.
> Now when I try to do a keytocard to the new YubiKey, I get an error
> message that the key already is on a card. If I do a --list-secret-keys,
> I indeed see the reference to the card for my key.
> My (hopefully) educated guess is that the stub still is there even after
> I have deleted the secret key from my key chain.
> My questions:
> - How can I verify that the stub really is gone after deleting the
> secret key?
> - How can I really remove the stub?
> - Or how can I transfer my secret key to a new YubiKey?
> Thanks,
> Oliver
> _______________________________________________
> Gnupg-users mailing list
> Gnupg-users at

More information about the Gnupg-users mailing list