Scdaemon 不会在 Windows 10 上检测到 Yubikey

vag*_*erg 4 windows gpg4win windows-10 yubikey

这是最近在我更新到 Windows 10 1803 (x64) 后开始的。我已将 Gpg4Win 更新到最新版本 (3.1.2),但这并没有解决任何问题。

我尝试了以下方法:

这些都没有解决它,我现在几乎没有想法。这是我机器上唯一的智能卡读卡器(除了 TPM),并且 Yubikey 已经过测试,可以在 Linux 上与 gpg 一起使用。

Yubikey 显示为 Identity Device (NIST SP 800-73 [PIV])

一些日志:

GPG 返回:

$ gpg --card-status
gpg: selecting openpgp failed: No such device
gpg: OpenPGP card not available: No such device
Run Code Online (Sandbox Code Playgroud)

Certutil 返回:

$ certutil -scinfo


=======================================================
Analyzing card in reader: Yubico Yubikey 4 OTP+U2F+CCID 0

--------------===========================--------------
================ Certificate 0 ================
--- Reader: Yubico Yubikey 4 OTP+U2F+CCID 0
---   Card: Identity Device (NIST SP 800-73 [PIV])
Provider = Microsoft Base Smart Card Crypto Provider
Key Container = (null) [Default Container]

Cannot open the AT_SIGNATURE key for reader: Yubico Yubikey 4 OTP+U2F+CCID 0
Cannot open the AT_KEYEXCHANGE key for reader: Yubico Yubikey 4 OTP+U2F+CCID 0

--------------===========================--------------
================ Certificate 0 ================
--- Reader: Yubico Yubikey 4 OTP+U2F+CCID 0
---   Card: Identity Device (NIST SP 800-73 [PIV])
Provider = Microsoft Smart Card Key Storage Provider
Key Container = (null) [Default Container]

Cannot open the  key for reader: Yubico Yubikey 4 OTP+U2F+CCID 0

--------------===========================--------------

Done.
CertUtil: -SCInfo command completed successfully.
Run Code Online (Sandbox Code Playgroud)

Scdaemon 的日志显示了一些(我认为)可能很有趣的东西,因为它似乎检测到了读者:

2018-07-26 18:13:36 scdaemon[13612] detected reader 'Windows Hello for Business 9'
2018-07-26 18:13:36 scdaemon[13612] detected reader 'Yubico Yubikey 4 OTP+U2F+CCID 0'
2018-07-26 18:13:36 scdaemon[13612] reader slot 0: not connected
2018-07-26 18:13:36 scdaemon[13612] DBG: leave: apdu_open_reader => slot=0 [pc/sc]
2018-07-26 18:13:36 scdaemon[13612] DBG: enter: apdu_connect: slot=0
2018-07-26 18:13:36 scdaemon[13612] pcsc_control failed: insufficient buffer (0x80100008)
2018-07-26 18:13:36 scdaemon[13612] pcsc_vendor_specific_init: GET_FEATURE_REQUEST failed: 65538
2018-07-26 18:13:36 scdaemon[13612] reader slot 0: active protocol: T1
2018-07-26 18:13:36 scdaemon[13612] slot 0: ATR=3B 8D 01 80 FB A0 00 00 03 97 42 54 46 59 04 01 CF
2018-07-26 18:13:36 scdaemon[13612] DBG: pcsc_get_status_change:  changed present excl inuse
2018-07-26 18:13:36 scdaemon[13612] DBG: leave: apdu_connect => sw=0x0
2018-07-26 18:13:36 scdaemon[13612] DBG: send apdu: c=00 i=A4 p1=00 p2=0C lc=2 le=-1 em=0
2018-07-26 18:13:36 scdaemon[13612] DBG:   PCSC_data: 00 A4 00 0C 02 3F 00
2018-07-26 18:13:36 scdaemon[13612] DBG:  response: sw=6A82  datalen=0
2018-07-26 18:13:36 scdaemon[13612] DBG: send apdu: c=00 i=A4 p1=04 p2=00 lc=6 le=-1 em=0
2018-07-26 18:13:36 scdaemon[13612] DBG:   PCSC_data: 00 A4 04 00 06 D2 76 00 01 24 01
2018-07-26 18:13:36 scdaemon[13612] DBG:  response: sw=6A82  datalen=0
2018-07-26 18:13:36 scdaemon[13612] can't select application 'openpgp': Not supported
2018-07-26 18:13:36 scdaemon[13612] DBG: enter: apdu_close_reader: slot=0
2018-07-26 18:13:36 scdaemon[13612] DBG: enter: apdu_disconnect: slot=0
2018-07-26 18:13:36 scdaemon[13612] DBG: leave: apdu_disconnect => sw=0x0
2018-07-26 18:13:36 scdaemon[13612] DBG: leave: apdu_close_reader => 0x0 (close_reader)
2018-07-26 18:13:36 scdaemon[13612] DBG: chan_0x00000188 -> ERR 100696144 No such device <SCD>
Run Code Online (Sandbox Code Playgroud)

vag*_*erg 6

问题似乎是安装 Office365 添加了一个虚拟智能卡阅读器Windows Hello for Business,这是一种基于 Microsoft Passport 的身份验证机制。

我认为(基于日志)这会导致scdaemon崩溃,因为它可以找到两个读者:这个和 Yubikey;但它没有尝试初始化后者,在尝试Windows Hello for Business虚拟阅读器后立即失败。certutil 的日志还显示无法为我机器上的 Windows Hello 虚拟读取器检索证书,因此这可能是导致scdaemon崩溃的原因。

通过Yubico Yubikey 4 OTP+U2F+CCID 0在智能卡选项卡下的 Kleopatra 设置上设置(我从日志中获得的名称)解决了该问题。

YMMV,但我建议如下:

  • 将调试级别设置为 4,并smartcards在 Kleopatra 中的选项卡上设置日志文件的路径
  • 在日志文件中查找您的 Yubikey 智能卡的名称:应该有一行以 开头detected reader,在我的例子中说明detected reader 'Yubico Yubikey 4 OTP+U2F+CCID 0'
  • 将该名称复制到Connect to reader at port NKleopatra的字段中
  • 您现在可以再次禁用日志记录以减少生成的垃圾。

请查看图片以供参考:

截屏