简体   繁体   English

Android 4.4 hce(基于主机的卡仿真)“ processCommandApdu” apdu长度

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

I've tested my Android Java application with Nexus 4, Nexus 5 and Samsung Galaxy S4 phones. 我已经用Nexus 4,Nexus 5和Samsung Galaxy S4手机测试了我的Android Java应用程序。 In the test, the reader sends APDUs changing in length up to 252 bytes. 在测试中,读取器发送长度变化为252字节的APDU。 Nexus phones receive APDUs successfully. Nexus手机成功接收到APDU。 On the other hand the Galaxy S4 phone can't receive APDUs which contain more than 128 bytes. 另一方面,Galaxy S4手机无法接收包含超过128个字节的APDU。 It receives only the first 128 bytes of the sender's 252 bytes. 它仅接收发送方的252个字节中的前128个字节。

How can I determine a device's maximum receivable APDU size? 如何确定设备的最大可接收APDU大小?

Currently there is no method to find the maximum receivable APDU length (except for trial and error). 当前没有找到最大可接收APDU长度的方法(反复试验除外)。

Regarding maximum receivable APDU length there is an open AOSP bug report ( #69233 ). 关于最大可接收APDU长度,有一个未解决的AOSP错误报告( #69233 )。 This report explains that 该报告说明

  1. the Nexus 5 is capable of receiving command APDUs with an overall length of 255 byte. Nexus 5可以接收总长度为255字节的命令APDU。 A case 3 APDU can thus have at most 250 payload bytes. 因此,情况3 APDU最多可具有250个有效载荷字节。

  2. the Galaxy S4 is capable of receiving command APDUs with an overall length of 252 bytes. Galaxy S4能够接收总长度为252个字节的命令APDU。 A case 3 APDU can thus have at most 247 payload bytes. 因此,情况3 APDU最多可具有247个有效载荷字节。

i found out that galaxy s4 actually receives 252 bytes. 我发现银河s4实际上收到252个字节。 but in 2 consecutive chunks. 但连续2个区块。 it enters processCommandApdu function twice for apdus longer than 128 bytes. 对于长度超过128个字节的apdu,它将两次进入processCommandApdu函数。

I've got a Galaxy S4 myself and mit is capable of transmitting and/or receiving apdus up to 255 bytes. 我本人拥有Galaxy S4,并且MIT能够发送和/或接收255个字节的apdus。 I haven't tried extendedAPDU, but they should work as well. 我还没有尝试过ExtendedAPDU,但是它们也应该工作。

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). 可能是与读卡器(三星Galaxy S4和卡)的组合有关的问题。来自不同制造商的卡的行为不同(在ISO14443标准内)。 IMHO the Samsung Galaxy S4 doesn't provide enough energy for some cards (experienced this with Galaxy S4). 恕我直言,三星Galaxy S4不能为某些卡提供足够的能量(Galaxy S4对此有经验)。

There is nothing you can do about it, except using other transponders. 除了使用其他应答器外,您无能为力。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM