SOLVED:GPG requires exclusive access to the reader, and was somehow locking itself from accessing the card?
I had to add "card-timeout 1" to my scdaemon.conf file
UPDATE:I'm not sure why but every once in a while GnuPG is still convinced that it can't get exclusive access to the card...
However it seems that just opening and closing that
Yubico Authenticator fixes the problem. (I have the "kill scdaemon on show" option checked in settings)
It's strange, because it fixes the problem even if I don't have the kill scdaemon option checked.
It's like whatever the Yubico Authenticator does when it exits releases the card properly or something.
Also worth noting, manually killing gpg-agent or scdaemon does NOT fix the problem.
The only thing that does (on the rare occasion it pops up again) is opening and closing the Yubico Authenticator
ORIGINAL QUESTION:I am getting the following error when trying to use the gpg to access the openpgp applet on my new Yubikey 4:
Code:
gpg: selecting openpgp failed: Card error
gpg: OpenPGP card not available: Card error
The strange thing is the version returned by sending the apdu 00 f1 00 00 command (via opensc since gnupg isn't working) returns version 4.2.7 which is the firmware version of my yubikey.
According to
this page the latest version is 1.0.11
I tried the
delete all entries from device manager trick with no effect
Any ideas why gpg isn't working?
running windows 7 64bit [Version 6.1.7601]
gpg (GnuPG) 2.0.29 (Gpg4win 2.3.0)
yubikey firmware version 4.2.7
below is the full output of my gpg/opensc commands:
Code:
C:\Program Files (x86)\GNU\GnuPG>gpg2 --version
gpg (GnuPG) 2.0.29 (Gpg4win 2.3.0)
libgcrypt 1.6.4
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Home: C:/Users/tmg/AppData/Roaming/gnupg
Supported algorithms:
Pubkey: RSA, RSA, RSA, ELG, DSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: MD5, SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2
C:\Program Files (x86)\GNU\GnuPG>gpg2 --card-status
gpg: selecting openpgp failed: Card error
gpg: OpenPGP card not available: Card error
C:\Program Files\OpenSC Project\OpenSC\tools>opensc-tool.exe -l
# Detected readers (pcsc)
Nr. Card Features Name
0 Yes Yubico Yubikey 4 OTP+U2F+CCID 0
C:\Program Files\OpenSC Project\OpenSC\tools>opensc-tool.exe -vv -c openpgp -s 00f10000
2016-02-22 15:48:44.199 [opensc-tool] reader-pcsc.c:301:refresh_attributes: returning with: 0 (Success)
2016-02-22 15:48:44.199 [opensc-tool] reader-pcsc.c:377:pcsc_detect_card_presence: returning with: 1
Using reader with a card: Yubico Yubikey 4 OTP+U2F+CCID 0
2016-02-22 15:48:44.215 [opensc-tool] reader-pcsc.c:301:refresh_attributes: returning with: 0 (Success)
2016-02-22 15:48:44.215 [opensc-tool] reader-pcsc.c:377:pcsc_detect_card_presence: returning with: 1
Connecting to card in reader Yubico Yubikey 4 OTP+U2F+CCID 0...
2016-02-22 15:48:44.215 [opensc-tool] card.c:148:sc_connect_card: called
2016-02-22 15:48:44.215 [opensc-tool] reader-pcsc.c:301:refresh_attributes: returning with: 0 (Success)
Using card driver OpenPGP card.
Sending: 00 F1 00 00
Received (SW1=0x90, SW2=0x00):
04 02 07 ...
2016-02-22 15:48:44.231 [opensc-tool] ctx.c:799:sc_release_context: called
C:\Program Files\OpenSC Project\OpenSC\tools>