Android的HCE:对于AID有规则吗? [英] Android HCE: are there rules for AID?

查看:2683
本文介绍了Android的HCE:对于AID有规则吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用NFC ACR122读写器来选择模拟的应用
采用Android主机卡仿真台Nexus 5。然而,小助剂没有
认可。

I'm trying to use an ACR122 NFC reader to select an application emulated in one Nexus 5 using Android Host Card Emulation. However, small AIDs are not recognized.

我的目标是使用三字节长的帮助下,我在一个DESFIRE卡做。我的第一个目标
是只能够做一个SELECT命令。

My goal is to use a three byte long AID, as I do in a DESfire card. My first goal is only to be able to do a SELECT command.

我的测试程序使用了以下配置艾滋病:

My test app uses the following configuration for AIDs:

<host-apdu-service xmlns:android="http://schemas.android.com/apk/res/android"
android:description="@string/service_descr"
android:requireDeviceUnlock="false" >

    <aid-group
        android:category="other"
        android:description="@string/aid_descr" >
            <aid-filter android:name="A0A1A2" />
            <aid-filter android:name="B0B1B2B3" />
            <aid-filter android:name="C0C1C2C3C4" />
            <aid-filter android:name="D0D1D2D3D4D5" />
            <aid-filter android:name="E0E1E2E3E4E5E6" />
    </aid-group>

</host-apdu-service>

如果我运行下面的APDU:

If I run the following APDUs:

00 a4 04 00 03 a0 a1 a2 00
00 a4 04 00 04 b0 b1 b2 b3 00
00 a4 04 00 05 c0 c1 c2 c3 c4 00
00 a4 04 00 06 d0 d1 d2 d3 d4 d5 00
00 a4 04 00 07 e0 e1 e2 e3 e4 e5 e6 00

我总是得到以下响应:

I always get the following responses:

=> 00 a4 04 00 03 a0 a1 a2 00 
<= 6f 00 
=> 00 a4 04 00 04 b0 b1 b2 b3 00 
<= 6a 82 
=> 00 a4 04 00 05 c0 c1 c2 c3 c4 00 
<= 90 00 
=> 00 a4 04 00 06 d0 d1 d2 d3 d4 d5 00 
<= 90 00 
=> 00 a4 04 00 07 e0 e1 e2 e3 e4 e5 e6 00 
<= 90 00 

因此​​,只有艾滋病长度大于5个字节将与Android合作?还是我
做得真的错了?

So, only AIDs with length greater than 5 bytes will work with Android? Or am I doing something really wrong?

推荐答案

有关智能卡应用标识符的规则(艾滋病)在ISO / IEC 7816-4中定义。一个AID可以由多达16个字节。基于第一4比特,艾滋病被分成不同的组。在ISO / IEC 7816-4中定义的最相关的群体是:

The rules for smartcard application identifiers (AIDs) are defined in ISO/IEC 7816-4. An AID may consist of up to 16 bytes. Based on the first 4 bits, AIDs are divided into different groups. The most relevant groups defined in ISO/IEC 7816-4 are:


  • 艾滋病开始'A':国际注册的艾滋病

  • 艾滋病开始'D':国家注册艾滋病

  • 艾滋病开始'F':专有艾滋病(无需注册)

  • AIDs starting with 'A': internationally registered AIDs
  • AIDs starting with 'D': nationally registered AIDs
  • AIDs starting with 'F': proprietary AIDs (no registration)

有关(间)国家注册艾滋病,的AID被分成两部分,一个5字节强制RID(注册应用提供商标识符),和一个可选的PIX(专有应用标识符扩展)的高达11个字节。

For (inter)nationally registered AIDs, the AID is split into two parts, a 5-byte mandatory RID (registered application provider identifier), and an optional PIX (proprietary application identifier extension) of up to 11 bytes.

有关专利的艾滋病( F的)ISO / IEC 7816-4没有明确授权的任何最小长度的要求。

For proprietary AIDs (F...) ISO/IEC 7816-4 does not clearly mandate any minimum length requirements.

在除此之外,当涉及到HCE和卡仿真的通信路由从NFC控制器以固定的元件或应用程序处理器,有NFC论坛NCI规范。本规范要求的AID(基于AID的路由条目中使用)为5到16字节之间。顺便说一句。同样的限制适用于以下Java卡规范智能卡。

In addition to this, when it comes to HCE and routing of card emulation communication from the NFC controller to secure elements or the application processor, there is the NFC Forum NCI specification. This specification mandates an AID (used in AID-based routing entries) to be between 5 and 16 bytes. Btw. the same limitation applies to smartcards following the Java Card specifications.

当谈到到Android,也就是艾滋病SELECT命令得到了硬codeD要求至少包括5个字节:

When it comes to Android, there is a hard-coded requirement that AIDs received in a SELECT command consist of at least 5 bytes:


  • 在方法 resolveAid()在<一个href=\"https://android.googlesource.com/platform/packages/apps/Nfc/+/android-5.0.0_r7/src/com/android/nfc/cardemulation/RegisteredAidCache.java#142\"相对=nofollow>在线RegisteredAidCache.java 142

  • 在方法 findSelectAid()在<一个href=\"https://android.googlesource.com/platform/packages/apps/Nfc/+/android-5.0.0_r7/src/com/android/nfc/cardemulation/HostEmulationManager.java#390\"相对=nofollow>在线390 HostEmulationManager.java(这实际上导致古怪行为的4个字节AID被拒绝了文件或应用程序未找到( 6A82 )状态字的检查不正确地考虑勒个字节)

  • In method resolveAid() in RegisteredAidCache.java on line 142
  • In method findSelectAid() in HostEmulationManager.java on line 390 (which actually causes the odd behavior that the 4 byte AID is rejected with a "File or application not found" (6A82) status word as the check does not properly account for the Le byte)

这篇关于Android的HCE:对于AID有规则吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆