无法构造 VERIFY_PIN_DIRECT 控制命令

Unable to construct VERIFY_PIN_DIRECT control command

我正在编写一个 JAVA-app 来访问我的 OpenPGP-Card V2.0。我使用的卡终端是“REINER SCT cyberJack RFID 标准”,仅支持 OSX 下的 PC/SC,现在我想执行 PC/SC 2.0-命令“VERIFY_PIN_DIRECT ".

我尝试了以下控制序列,|之后的字节是 APDU 字节(我的测试引脚是“140396”):

Index: 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 | 19 20 21 22 23 24 25 26 27 28 29
Seq 0: 0F 0F 88 86 14 08 04 02 01 09 04 00 00 00 00 0B 00 00 00 | 00 20 00 81 06 FF FF FF FF FF FF

一些重要的字节含义(有用的文档:http://www.acs.com.hk/download-manual/1207/API-ACR83-1.06.pdf):

Index 02: PIN format options
Index 03: PIN-block format
Index 04: Position of PIN-length information in the APDU-command
Index 15 - 18: APDU-length
Index 19 - end: APDU-command

但是如果我发送这个命令,我总是得到 69 82 这意味着 OpenPGP-Card datasheet (PDF):

Security status not satisfied:

PW wrong

PW not checked (command not allowed)

Secure messaging incorrect (checksum and/or cryptogram)

APDU 命令似乎是正确的,因为如果我向卡发送以下命令 00 20 00 81 06 31 34 30 33 39 36,PIN 码就会被接受。所以看来我的控制命令是错误的。我的错误在哪里?

更新:

一个工作命令是:

Index: 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 | 19 20 21 22
Seq 0: 0F_0F 02_0F_00 0F_06 02 01 09_04 00 00_00_00 04_00_00_00 | 00 20 00 81

0F_06(在索引 05 处)更好的值是 20_06,因为 OpenPGP 卡支持最长 32 个字符的 PIN,但我的卡终端抱怨Invalid Value...

P.S.: 下划线表示相关字节,在解析时当然会被去掉。

OpenPGP 使用可变长度的 PIN 并且 PIN 块必须按照流行的约定(这种情况未包含在 CCID 规范中)作为 empty APDU 发送,只有 APDU header.

请参阅此处获取提示:https://github.com/OpenSC/OpenSC/blob/master/src/libopensc/reader-pcsc.c#L1391

另外,你的应用是开源的吗?也许您想贡献一些我尚未写入 apdu4j 的 CCID 控制块代码:https://github.com/martinpaljak/apdu4j