比尔盖子 博客

GnuPG 2.1.18 不识别智能卡的解决方法

如果你通过 PC/SC 访问 OpenPGP Card,在升级到 GnuPG 2.1.18 后,你的智能卡将会停止工作。智能卡将无法被 gpg --card-status 正常识别,提示各类错误,例如:

gpg: selecting openpgp failed: No such device
gpg: OpenPGP card not available: No such device

在 GnuPG 中,本身就通过 ccid 支持了标准的 OpenPGP Card,一张标准的智能卡和兼容的读卡器可以直接和 GnuPG 一起工作,无需修改任何配置或安装任何程序。

但是,很多 OpenPGP Card 并非完全遵守 v2 标准,例如开发版本的 gnuk(遵守 v3 标准);或者 Yubikey(带有扩展特性),我们就需要通过 PC/SC 作为中间层访问智能卡。

这时,竟态条件就产生了。初次使用智能卡时,GnuPG 会和 PC-SC 抢占智能卡设备的控制权,过去 PC-SC 总是赢家,偶然,如果 GnuPG 赢了,智能卡就会无法正常工作。

因此,可以通过禁用 GnuPG 内建的智能卡支持,解决这个问题。

echo "disable-ccid" >> ~/.gnupg/scdaemon.conf

重启 pcscdgpg-agentscdaemon 后见效。如果你是 PC-SC 用户,建议总是禁用 ccid 避免冲突。

那么为何升级到 2.1.18 之后才会出现这个问题?日本 FSIJ 的 Niibe Yutaka,也就是 gnuk 的核心开发者主动跳出来表示,他把一个 bug 添加进了 scdaemon。以前,scdaemon 发现内建的 ccid 无法识别智能卡后,会顺便调用 PC/SC 再试试看,但重构代码时忘记保留这个特性,他已经编写了这个补丁修复了问题,而且已经被 Debian 采纳。

来源:https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=852702

Categories: 未分类

x86 的六种重启方法 » « 最近的 OpenSSH 漏洞究竟有多大危害?

1 Comment

  1. disable掉ccid后不需要指定pcsc-driver吗?

发表评论

Your email address will not be published.

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax

Copyright © 2023 比尔盖子 博客

Theme by Anders NorenUp ↑