What are the requirements to support extended length APDUs and which smartphones support it?
When I first tried to send an APDU command and got an "above supported length" error, I assumed it was just a limitation of the NFC chip itself - not around in any way. However, this site suggests it might be a software issue in the Android OS:
many currently available smartphones can transmit 261 bytes [2] via NFC without major operating system changes .
Does anyone know more about how to work around this issue and how the "major" changes are exactly?
Also, do you have a list that supports extended APDU length phones? If not, we should probably start one as you really won't find much on google.
I know the Samsung Galaxy Note II supports it, while the Samsung Galaxy S3, Nexus 5 and Galaxy Nexus don't.
source to share
See this site: https://code.google.com/p/android/issues/detail?id=76598
What you need to do:
- Download Android Sources
- Change "261" to "2462" on the line in NativeNfcManager.java (as shown on the site linked above).
- Build Android
- Run a flash version of the modified version of Android on your phone.
A tutorial on building Android for Nexus 5 can be found here: http://nosemaj.org/howto-build-android-kitkat-nexus-5
This works for your smartphone's read mode, I don't know yet how to get it to work in card emulation mode.
source to share
A better / lighter / more portable solution is to send only 261 bytes (or less) and return ISO7816-4 SW1-SW2 = 0x61xx status codes with xx reporting the number of data bytes available. The reader will send the ISO7816-4 GET RESPONSE command to request the remaining bytes.
For example, if you wanted to send 300 bytes from Android HCE, you would start responding:
- HCE:
sendResponseApdu({ 250 first bytes of data + 0x6132 })
(0x32 means 50 bytes remaining) - The NFC card reader should send:
GET RESPONSE
- HCE:
sendResponseApdu({ last 50 bytes of data + 0x9000 })
source to share