使用HCE模式获取静态NFC标签ID [英] Get Static NFC Tag Id with HCE mode
问题描述
我是NFC的新手,所以我在HCE模式下通过调用getTagId()方法测试了几部手机,结果如下:
I'm new in NFC thing, so I tested several phones with calling getTagId() method in HCE mode, and this is the result:
device | UID
LG G2 | random
LG G3 | static
S4 | random
HTC One Mini | static
Xiaomi mi3 | static
我的问题:
- 为什么有些电话具有静态UID,而有些却没有?该芯片组相关吗?
- 是否可以获取固定的UID?我需要它来验证设备.
- 另一方面,我在Xperia M上使用Kitkat CyanogenMod 11,但是我没有设法将其用于HCE,为什么?
任何可以解释/支持答案的文件吗?
Any documents that can explain/support the answer?
推荐答案
为什么有些电话具有静态UID,而有些却没有静态UID?该芯片组相关吗?
这取决于芯片组和NFC堆栈的实现.据我所知,各种Android NFC设备使用三种不同的场景:
That depends on the chipset and the implementation of the NFC stack. As far as I'm aware of, there are three different scenarios used by various Android NFC devices:
- 该设备具有安全元素,并使用该安全元素的静态UID.
- 该设备在每次打开时都会生成一个新的随机UID.
- 该设备每次由外部读取器设备激活时都会生成一个新的随机UID. IE.每当将外部HF场应用于Android设备的NFC天线时.
- 该设备没有安全元素,但仍使用静态UID(通常不是 unique ),例如0x01020304. [感谢ErikM指出这一点.]
- The device has a secure element and uses the static UID of that secure element.
- The device generates a new random UID whenever it is turned on.
- The device generates a new random UID on every activation by an external reader device. I.e. whenever an external HF field is applied to the NFC antenna of the Android device.
- The device has no secure element but still uses a static UID (typically not unique), e.g. 0x01020304. [Thanks to ErikM for pointing this out.]
是否可以获取固定的UID?
通常,您不能对此产生影响.特别是在不修改Android设备固件(更改为NFC堆栈)的情况下,绝对不可能.有关通过修改libnfc-nci库在Broadcom芯片组上设置UID值的方法,请参见此答案.
Typically, you can't influence this. Specifically without modifying the Android device firmware (changes to the NFC stack) it's definitely not possible. See this answer for a method to set the UID value on Broadcom chipsets through modifying the libnfc-nci library.
我需要它来验证设备的身份.
不要这样做!有关此问题的更多信息,请参见此答案.
Don't do this! See this answer for more information on that.
这篇关于使用HCE模式获取静态NFC标签ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!