Thursday, January 24, 2013

Re: [android-developers] NFC Card Emulation on android

Hi Eliseo,

> What I want to do is to use the UID received from the phone to read/write
> the tag emulated on the phone. Another application possible is to use the
> phone in access control applications, but a fixed UID is necessary. The UID
> is random for security reasons? How Card Emulation can be used if the UID is
> random?

Typically, if you receive a random UID from the NFC phone you detected the phone's peer-to-peer mode (i.e. the phone listening in passive mode at 106kbps) or -- if the phone supports it -- software card emulation mode. If it's peer-to-peer mode, the random UID (btw. the first byte of a random UID is 0x08, except for some weird cards from NXP ;-) ) is actually an NFCID1. Most secure elements on the other hand provide a static UID. (At least the one that is embedded into the Nexus S/Galaxy Nexus/Galaxy SIII).

You can determine if the detected target supports peer-to-peer mode or if it is in card emulation mode by the value of the SAK byte (in ISO 14443 language or SEL_RES in ISO 18092 language).
If the bits of SAK are numbered from 7 downto 0 and bit 2 = 0:
 - Bit 6 = 1 denotes that the target supports NFC-DEP (i.e. peer-to-peer mode as defined in ISO 18092).
 - Bit 5 = 1 denotes that the target supports ISO-DEP (i.e. the smartcard transport protocol from ISO 14443-4).
If none of those two bits is set then the target supports only some proprietary protocol.

So if you detected that it's peer-to-peer mode, then there is NO tag to read/write from. However, you could use some library like ismb-snep-java to exchange data through Android Beam.

Regarding fixed UIDs with Android NFC phones: At least phones based on the NXP chipset (i.e. PN544) can only have a fixed UID in combination with a secure element that has a fixed UID. For software card emulation mode, the NFC controller will always use a random UID.

br,
Michael


--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
 
 

No comments:

Post a Comment