Card emulation via software NFC
Asked Answered
F

3

6

After reading a lot of questions, i decided to post this one. I read that stock version of android does not support API's for card emulation. Also, we cannot write custom applications to secure element embedded in nfc controllers due to keys managed by google/samsung.

I need to emulate a card (mifare or desfire etc). The option i can see is doing it via software. I have a ACR122U reader and i've tested that NFC P2P mode works fine with the Nexus-S that i have.

1) I came across a site that said that nexus s's NFC controller (pn532) can emulate a mifare 4k card. If this is true, can i write/read apdu commands to this emulated card? (Probably if i use a modded rom like cyanogenmod)

2) Can i write a android application that reads apdu commands sent from the reader and generate appropriate responses (if not fully, then upto some extent only). To do so, i searched that we need to patch nexus s with cynagenmod. Has someone tried emulating card via this method?

I see that this is possible since we have products from access control companies offering mobile applications via which one can open doors e.g. http://www.assaabloy.com/en/com/Products/seos-mobile-access/

Fearfully answered 20/6, 2013 at 17:56 Comment(0)
P
4

Some facts that may be of help in your quest:

  • The NFC controller in the Nexus S (and Galaxy Nexus, Nexus 7 and quite a few other Android devices) is the PN544
  • Card emulation can be done either by the secure element connected to the NFC controller or by the host device (=Android device in this case). The Nexus S has a secure element that could be used for that (used in Google Wallet). Card emulation from the host device is not a feature of the PN544 NFC controller, although some claim that they have managed to get it working.
  • You can turn on card emulation by the secure element by rooting your device and following the instructions at https://mcmap.net/q/906009/-secure-element-access-control-on-ics-4-0-4 (haven't tried this with 4.x JB, but I assume that it still works).
  • Emulating a MIFARE Classic card can be done by the secure element in the Nexus S, but not by the host device. Emulating a DESFire card is not supported by the secure element in the Nexus S.
  • I have investigated a similar doorlock product that used card emulation itself to communicate to an NFC mobile device, while using card reader/writer mode to communicate to access control cards.

IMO, the 2 simplest options are: use P2P communication (Android Beam) or use card emulation in a reader device (if it supports it). All the other options require things like rooted devices and custom ROMs, which are not future-proof and have no possibility to be translated to a real product.

Parabola answered 21/6, 2013 at 21:7 Comment(1)
Thanks for the reply. So, by reading the answers i've got, P2P is the way to go. So can i write an android application which (using Android beam), in a single tap on the reader, sends the relevant data to the reader to grant/deny access to door? Can i exchange multiple NDEF messages in a single tap? I wanted to know the amount of data that i can send/receive on a single tap. I'm currently using NPP for P2P mode. Should i switch to SNEP in case i have more data to exchange?Fearfully
T
2

Card emulation via software is now available with Android 4.4. http://developer.android.com/guide/topics/connectivity/nfc/hce.html

Tripura answered 1/11, 2013 at 15:50 Comment(1)
You answer is too vague. You are not answering specifically the OP questions. Spend just a little more time to explain and do not just vomit links. Moreover, if this link breaks in the future, the answer will be truncated. At least write the important things from that link that sum up and answer the questions. Kind regards!Shivery
W
0

2) Card emulation by software should definitely be possible, but not exposed in current Android APIs. You will have to dig deeper into the libnfc-nxp (and possibly below). This might be a difficult one though. This feature is offered on Inside Secure's chips, as shown in their OpenNFC reference implementation. The only question is whether it requires a CLF firmware change. If not, then you can hack it into a software image.

The caveats are, however, that you will lack the following features : - security (an Android app is not as secure as a smartcard) - fast and predictable response times (well, depends how you code it probably) - card emulation running when phone is off

I believe SEOS is based on ISO14443-4 and not Mifare. This means you would need a secure element to run it.

1) Not too sure about this one, my guess is that this will still be hardware-based (e.g. depend on an embedded secure element such as NXP's SmartMX.

The other alternative is to start developing on a secure element. The most straightforward way would be to get some sample test SIMs with SWP/HCI support. There is a free dev kit called IzyNFC which you can use for the javacard, and GSMA and AFSCM technical documents for the Android application side.

Waspish answered 21/6, 2013 at 15:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.