Android 4.4 hce (host-based card emulation) “processCommandApdu” apdu length

别来无恙 提交于 2019-12-05 04:36:05

问题


I've tested my Android Java application with Nexus 4, Nexus 5 and Samsung Galaxy S4 phones. In the test, the reader sends APDUs changing in length up to 252 bytes. Nexus phones receive APDUs successfully. On the other hand the Galaxy S4 phone can't receive APDUs which contain more than 128 bytes. It receives only the first 128 bytes of the sender's 252 bytes.

How can I determine a device's maximum receivable APDU size?


回答1:


Currently there is no method to find the maximum receivable APDU length (except for trial and error).

Regarding maximum receivable APDU length there is an open AOSP bug report (#69233). This report explains that

  1. the Nexus 5 is capable of receiving command APDUs with an overall length of 255 byte. A case 3 APDU can thus have at most 250 payload bytes.

  2. the Galaxy S4 is capable of receiving command APDUs with an overall length of 252 bytes. A case 3 APDU can thus have at most 247 payload bytes.




回答2:


i found out that galaxy s4 actually receives 252 bytes. but in 2 consecutive chunks. it enters processCommandApdu function twice for apdus longer than 128 bytes.




回答3:


I've got a Galaxy S4 myself and mit is capable of transmitting and/or receiving apdus up to 255 bytes. I haven't tried extendedAPDU, but they should work as well.

Probably it is an issue related to the combination of reader (Samsung Galaxy S4 and card) Cards from different manufacturers behave differently (inside the ISO14443 standard). IMHO the Samsung Galaxy S4 doesn't provide enough energy for some cards (experienced this with Galaxy S4).

There is nothing you can do about it, except using other transponders.



来源:https://stackoverflow.com/questions/23831830/android-4-4-hce-host-based-card-emulation-processcommandapdu-apdu-length

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!