Gpg: KEYTOCARD failed: Bad secret key

So, I have an issue exporting keys to librem key (which I got few years back).

gpg --export --key-edit email@address
gpg> key 1 #The encryption key
gpg> keytocard
#
# Selected (2) for the encryption key.
#
gpg: KEYTOCARD failed: Bad secret key

Examining the card status

Reader ...........: Purism, SPC Librem Key (0000000000000000000095F0) 00 00
Application ID ...: D2760001240103030005000095F00000
Application type .: OpenPGP
Version ..........: 3.3
Manufacturer .....: ZeitControl
Serial number ....: 000095F0
Name of cardholder: [not set]
Language prefs ...: de
Salutation .......: 
URL of public key : [not set]
Login data .......: [not set]
Signature PIN ....: forced
Key attributes ...: rsa2048 rsa2048 rsa2048   #<--- COULD THIS BE THE PROBLEM?
Max. PIN lengths .: 64 64 64
PIN retry counter : 2 0 3
Signature counter : 0
KDF setting ......: off
Signature key ....: [none]
Encryption key....: [none]
Authentication key: [none]
General key info..: [none]

All my (sub)keys are RSA size 4096.

Okay, my bad. I haven’t noticed that changing admin/user PINs was unsuccessful. When I fixed this, the transfer worked.

1 Like