How to migrate my key from card to file?

Olav Seyfarth olav at
Sun Sep 6 01:24:52 CEST 2020

Hi list,

I did search but did not find a useful answer to my question. In 2017 
someone else asked:

> During generating the keys on the GnuPG card, one can (and should) 
> create some backup of the secret key into a file. It is totally 
> unclear to me how to make something usefull out of this file, for 
> example import it into a "normal" secret keyring to use it in case of 
> the GnuPG card gets lost. 

The discussion that followed explained how to create another CARD based 
key from the backup. That is NOT my concern, I know how to do this. 
Thus, I'd like to put this more specifically:

I want to no longer use a card (e.g. in order to be able to read old 
messages on a mobile device, or in Thunderbird 78.2.1 WITHOUT the use of 
GnuPG) but want to use the OLD CARD KEY.

I did create the key "on card"* (with --card-edit/admin/generate, NOT as 
plain file and then with --keytocard). I do have a private_stub.gpg, 
pubkey.gpg and sk_xxx.gpg.

*As I read in the above thread, the code actually generates the key as a 
file, writes out a backup file and transfers it to the card. So maybe 
I'd rather have used file based creation+backup-my-key+keytocard in the 
first place, but I did not.

My question: Now that I have the above three files (and a working card 
with the secret key on it), how can I use these to create a plain file 
based private+public keypair from it?


More information about the Gnupg-users mailing list