如何确定智能卡 ATR 掩模?

发布于 2024-08-10 17:05:05 字数 321 浏览 4 评论 0原文

给定智能卡 ATR(重置应答);是否可以确定哪些字节可以变量来为特定卡创建 ATR 掩码?

ATR 示例可能如下所示(可以由 Ludovic Rousseau 的 ATR 解析器 解析):

3B FF 18 00 FF 81 31 FE 45 65 63 11 05 40 02 50 00 10 55 10 03 03 05 00 43

是否有任何通用的实现这个的方法?或者我是否必须联系特定卡的卡供应商?

Given a Smart Card ATR (Answer-To-Reset); Is is possible to determine which bytes that can be variable to create an ATR Mask for the particular card?

An example ATR might look like (which can be parsed by Ludovic Rousseau's ATR parser):

3B FF 18 00 FF 81 31 FE 45 65 63 11 05 40 02 50 00 10 55 10 03 03 05 00 43

Is there any generic way to accomplish this? Or do I have to contact the card vendor for the particular card?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

柠檬 2024-08-17 17:05:05

这取决于目标。如果您的目标是能够识别所有可能变化中的确切卡片类型,则 ATR 掩模无法为您做到这一点。如果您有一个想要关联的通用卡“家族”,您可以尝试屏蔽历史字节。如果您正在设置 Calais 注册表设置,我建议不要屏蔽任何内容,因为您可能会阻止另一个 CSP。除了 ATR 之外,请查看最新的 Microsoft Mini Driver 规范以了解识别卡的过程。

It depends on the goal. If your goal is to be able to identify that exact card type in all possible variations, there is no way an ATR mask will do that for you. If you have a general card "family" you want to associate, you might try masking out the historical bytes. If you are setting Calais registry settings, I suggest NOT masking out anything because you might block another CSP. Other than ATR, look at the latest Microsoft Mini Driver spec for a process to identify a card.

高速公鹿 2024-08-17 17:05:05

这些知识的应用是什么?

我不相信有一个标准,除了不同卡特性中的可变字节(如果知道给定卡有不同版本,例如具有不同的协议功能),或者如果您知道有该卡的不同版本。有时你可以从历史字节中找到有关卡的信息,例如爱沙尼亚 eID 卡有不同的供应商,但所有卡的历史字节都以 ASCII 读取“EstEID v1.0”。

因此,最有可能的答案是您需要联系制造商或阅读该卡附带的文档。

祝你好运!

What is the application of this knowledge?

I don't believe there is a standard for this, other than variable bytes in different card characteristics (if it is known that there are different versions of a given card, with different protocol capabilities for example), or if you know that there are different releases of the card. Sometimes you can find information about a card from the historical bytes, such as there are different vendors for Estonian eID card, but the historical bytes of all cards read "EstEID v1.0" in ASCII.

So the answer most probably is you need to contact the manufacturer or read the documentation that came with the card.

Good luck!

滥情哥ㄟ 2024-08-17 17:05:05

我通过ATR中的TA位找到掩码的类型。 TA 是 ATR 接口字节中的 0 位。然后我从卡的底部/结束地址开始8个字节找到掩码的制造商。我在 ATR 之后执行以下 APDU cmommand :

CommandApdu commandApdu = new CommandApdu(0xBC, 0xC0, 0x00, 0x00, data, 0x08);

然后我验证第二位和第三位(位 = 0, 1, admax[0]=2, admax[1]=3, 4, 5, 6, 7):

byte[] result8Bytes = responseApdu.getData()[2];
byte[] adMax = new byte[2];
adMax[0]=result8Bytes[2];
adMax[1]=result8Bytes[3];

if (ATR_TA == 0x0E) { //SCOT
    if (adMax[0] == 0x21 && adMax[1] == 0xA0) `
       typeMasque = SCOT_400_M9V1;`
    else if (adMax[0] == 0x21 && (adMax[1] == 0x19 || adMax[1] == 0x88))
       typeMasque = SCOT_400_MOT; 
    else if (adMax[0] == 0x88 && adMax[1] == 0x00)
       typeMasque = SCOT_400_STM;
    else if (adMax[0] == 0x19 && adMax[1] == 0x00)
       typeMasque = SCOT_300;
    else 
       typeMasque = SCOT_INCONNU;
}

if (ATR_TA == 0x0D) //IGEA
    if (adMax[0] == 0x20 && adMax[1] == 0xA0)
        typeMasque = IGEA_340_AMTEL;
    else if (adMax[0] == 0x21 && (adMax[1] == 0x20 || adMax[1] == 0x98))
        typeMasque = IGEA_440_BIS;
    else if (adMax[0] == 0x21 && adMax[1] == 0x20)
        typeMasque = IGEA_440_STM;
    else
        typeMasque = IGEA_INCONNU;
}

I find the type of mask by TA bit in ATR. TA is 0 bit in Interface bytes of ATR. Then I find the manufacturer of the mask by 8 bytes from the bottom/end address of card. I execute the below APDU cmommand after ATR :

CommandApdu commandApdu = new CommandApdu(0xBC, 0xC0, 0x00, 0x00, data, 0x08);

Then I verify the 2nd and 3rd bits (bits = 0, 1, admax[0]=2, admax[1]=3, 4, 5, 6, 7) :

byte[] result8Bytes = responseApdu.getData()[2];
byte[] adMax = new byte[2];
adMax[0]=result8Bytes[2];
adMax[1]=result8Bytes[3];

if (ATR_TA == 0x0E) { //SCOT
    if (adMax[0] == 0x21 && adMax[1] == 0xA0) `
       typeMasque = SCOT_400_M9V1;`
    else if (adMax[0] == 0x21 && (adMax[1] == 0x19 || adMax[1] == 0x88))
       typeMasque = SCOT_400_MOT; 
    else if (adMax[0] == 0x88 && adMax[1] == 0x00)
       typeMasque = SCOT_400_STM;
    else if (adMax[0] == 0x19 && adMax[1] == 0x00)
       typeMasque = SCOT_300;
    else 
       typeMasque = SCOT_INCONNU;
}

if (ATR_TA == 0x0D) //IGEA
    if (adMax[0] == 0x20 && adMax[1] == 0xA0)
        typeMasque = IGEA_340_AMTEL;
    else if (adMax[0] == 0x21 && (adMax[1] == 0x20 || adMax[1] == 0x98))
        typeMasque = IGEA_440_BIS;
    else if (adMax[0] == 0x21 && adMax[1] == 0x20)
        typeMasque = IGEA_440_STM;
    else
        typeMasque = IGEA_INCONNU;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文