0

Iam trying to read the Events_Data file on a digital tachograph smartcard which is documented in the EG Nr.1360-2002 (page 120). Its size can vary from 864 to 1728 bytes. Now iam trying to find out the exact size on a testcard. I tried following the steps descriped in this SO article, but the SELECT command for these kind of cards seems to only work with P2=0C (no response expected). Is there another way to find out the size of these files?

4

1 回答 1

1

根据我对规范的理解:

但此类卡的 SELECT 命令似乎仅适用于 P2=0C(预期无响应)

我同意。第 36 页声明它支持标准 ISO 7816,但第 105 页声明选择文件 APDU 是有限的(不能有响应数据,只有 SW=9000 或错误)

它的大小可以从 864 到 1728 字节不等。

基本上,有 6 个 CardEventRecord,每个由 n1(6 到 12)个 CardEventRecord(24 字节)组成。因此,该文件中有 36 到 72 个 CardEventRecord。

我尝试按照SO 文章中描述的步骤进行操作

在这种情况下,您可以读取前 864 个字节(为了加快速度,只需发送 4 个 APDU 即可读取第一个 255 个字节、接下来的 255 个字节、接下来的 255 个字节和接下来的 99 个字节)。之后,执行循环以每 24 个字节读取其余字节 (CardEventRecord),如果收到 SW 6B00 或 6700,则停止。

注意:您也可以对所有字节进行 255 字节的块读取,当您收到错误 6CXX 时,使用 XX 指示的短长度重新发送读取的 APDU。这应该更快,但卡可能会发送 SW 6700 而不是 6CXX,这不方便(取决于卡的实现)。

于 2013-07-09T09:04:15.003 回答