Classic Card returning bytes instead of tag lost on read operation.

Forum / MIFARE SDK / Classic Card returning bytes instead of tag lost on read operation.

Tagged: 

  • 2. January 2019 at 7:13
    Hi All,

    We've identified an issue with the android devices when communicating with Mifare classic cards using the taplinx library, it appears that when performing read operations on a specific block if the tag is removed we do not receive a tag lost exception or any other indication from taplinx library that the tag is no longer present.

    It appears that whilst the tag is in the NFC field of the phone we get a normal read (indicated by the 66,55 block shown in the images). However when the tag is removed we start seeing these bad blocks (-78,0) appear. However without any exception being thrown its impossible for us to tell if the -78,0 block is good or bad data which is causing issues with our app translating the information incorrectly.

    We tested this on a Samsung galaxy phone and it definitely worked as we expected (with an exception thrown when the card leaves the field).

    I've attached a link to a small test application we've made to test this issue it essentially will write to the block and then loop over reading the same block over and over again, in order to test with it you'll need to simply compile it and run it and test with a Mifare classic 1k card. You may need to change the authentication keys to test with your cards, simply remove the card from the reader and you should see the bad byte array being output in logcat.

    Application Link : https://drive.google.com/file/d/1JpGNHLbZiOXTF6MdiDvi93RhpPBwot4C/view?usp=sharing

    The value when the card is in the field.
    2018-12-31 12:17:08.609 1668-1682/com.example.antonskutov.testnfcapp D/ClassicCardOperations: Read block success 5 [66, 55, 44, 4, 44, 66, 66, 66, 77, 10, 11, 66, 13, 14, 15, 16]

    The value when card leaves the field.
    12-31 02:04:08.491 2220-2240/com.example.antonskutov.testnfcapp D/ClassicCardOperations: Read block success 5 [-78, 0, 44, 4, 44, 66, 66, 66, 77, 10, 11, 66, 13, 14, 15, 16]
    + 0  |  - 0

    Re: Classic Card returning bytes instead of tag lost on read operation.

    7. January 2019 at 13:04
    Hi Matthew,

    The MIFARE Classic is ISO14443-3 (part 3!) compliant. In part 3 there is no mechanism for error handling, e.g. if you make an authentication with the wrong key, the tag goes into an error state and stops communication. Take in mind, for ISO14443-4 (part 4!) you have an error handling.

    A “tag lost” is detected if a command fails. How this is handled, is defined in the middleware (the software inside of Android, between NFC library and NFC driver). As part 3-device have no error handling, therefore I assume a tag lost is handled in the same way and no response is generated.


    The TapLinx team

    + 0  |  - 0
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.