5
votes

I'm trying to authenticate a Mifare Ultralight C (ISO/IEC 14443-2 and 14443-3 type A compatible) tag.

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()).

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".

Also, if I try it with NfcA the same problem happens.

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()?<<

(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.

Thanks in advance!

1
My guess is that response (the second send) doesn't authenticate properly and the tag never responds, thus looking to the phone like the tag was lost. Try writing (4 byte writes) a number of times and see if that works. It would be transcieve(0xA2, 0x06, 0x01, 0x02, 0x03, 0x04) where the 0x06 is the page number. If that works then your attempt at authenticating would be what's wrong.Ben Ward
First, thanks for your reply :). After reading it I think that you could be right and the problem could be that my reply to the authentication is incorrect, so I'll try what you suggested me to know if this makes sense. But, seems to be a good point of view. Thanks again! ;) I'll post here if writing a number of times was ok as soon as I implement it.Miguel
Yes, after making several writings it works, so it seems to be a problem with my authentication request. Thanks for your help, I'll check my request procedure to find which's the problem. Thanks for your help! :)Miguel
I was reviewing my authentication algorithm and I found one premise which could be wrong. I use as the default authentication key all "0h". Could that be the problem? - Thanks in advance!Miguel
I have been unable to find information about communicating with Mifare Ultralight C on transceive level or authenticating. Can anyone post some material?endre

1 Answers

3
votes

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.