简体   繁体   English

Mifare Ultralight C Android(2.3.6)中的认证

[英]Mifare Ultralight C Authentication in Android (2.3.6)

I'm trying to authenticate a Mifare Ultralight C (ISO/IEC 14443-2 and 14443-3 type A compatible) tag.我正在尝试验证 Mifare Ultralight C(兼容 ISO/IEC 14443-2 和 14443-3 A 类)标签。

I send the authentication command with the MifareUltralight.transceive() function provided in Android. I have also checked NfcA.transceive() (IsoDep seems not to be compatible with this kind of tag because this object is for dealing with ISO/IEC 14443-4 tags and that's why I don't use IsoDep.transceive()).我使用 Android 中提供的 MifareUltralight.transceive() function 发送身份验证命令。我还检查了 NfcA.transceive() (IsoDep 似乎不兼容这种标签,因为这个 object 是用于处理 ISO/IEC 14443- 4 个标签,这就是我不使用 IsoDep.transceive() 的原因。

So, when I first send the authentication request command the tag answers the transceive() with AFxxxx..... where I process the tag answer and then I send another transceive() with the response to that answer but... just before sending the transceive() the tag is connected, when it's sent I get a "tag was lost" warning and a "transceive failed".因此,当我第一次发送身份验证请求命令时,标签用 AFxxxx 回答 transceive() ......我在其中处理标签答案,然后我发送另一个 transceive() 以及对该答案的响应但是......就在之前发送 transceive() 标签已连接,发送时我收到“标签丢失”警告和“收发失败”。

Also, if I try it with NfcA the same problem happens.此外,如果我尝试使用 NfcA,也会发生同样的问题。

Finally, if I try to send one authentication command after the first one response I get also a "Tag was lost" warning with the transceive fail.最后,如果我尝试在第一个响应之后发送一个身份验证命令,我还会收到一个“标签丢失”警告和收发失败。

So my question is:所以我的问题是:

Why does the NFC tag get lost when I send the second transceive()?为什么当我发送第二个 transceive() 时 NFC 标签丢失了? << <<

(It doesn't seem to be a timeout problem because just before sending the second transceive() the connection is open with the tag) I made all the stuff in a different Thread from the UI one. (这似乎不是超时问题,因为就在发送第二个 transceive() 之前,连接是用标签打开的)我把所有的东西都放在了与 UI 不同的线程中。

Thanks in advance!提前致谢!

Your approach seems to be correct. 你的方法似乎是正确的。 However, the tag's behaviour indicates that your response to the tag's answer was incorrect. 但是,标记的行为表明您对标记答案的响应不正确。 In that case, the tag refuses to answer. 在这种情况下,标签拒绝回答。 From the phone's point of view this is indistinguishable from the tag having disappeared, so you get a TagLostException . 从手机的角度来看,这与已消失的标签无法区分,因此您获得了TagLostException

For me It was the same issue,but then It solved in weird way对我来说这是同样的问题,但后来以奇怪的方式解决了

step 1: pass1 1A00 command to card第一步:pass1 1A00命令到卡

step 2: able to retrieve pass1 response challenge第 2 步:能够检索 pass1 响应挑战

step 3: Algo computation step Arbitrary (tag lost at this point assuming) and getting a sound kind of tag lost from device第 3 步:算法计算步骤任意(此时假设标签丢失)并从设备中获得一种合理的标签丢失

Step 4: pass 2 with AFxxxxx throws exception transceive failed, but by then If I check Tag lost already!!!第 4 步:通过 AFxxxxx 传递 2 抛出异常收发失败,但到那时如果我检查标签丢失了!!!

I after struggling few days, one of my collogue asked me to try to reduce any delay between pass1 to pass2, it was taking almost 1-1.5 sec and in between it was failing so.在挣扎了几天之后,我的一位同事让我尝试减少 pass1 到 pass2 之间的任何延迟,这花费了将近 1-1.5 秒,并且在这两者之间失败了。

I removed any logs writing in between and made simple quick call after pass1 within 500mili sec, here we go weirdo WORKING FINE !!!!我删除了中间写入的任何日志,并在 pass1 之后的 500 英里秒内进行了简单的快速调用,在这里我们 go 怪人工作正常!!!!

It could be having some reason in card technology has some security purpose or I don't know still trying to investigating.卡技术可能有某种安全目的,或者我不知道仍在尝试调查。

Hope this would be helpful.希望这会有所帮助。

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

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