Search code examples
formatnfcrfidmifarecontactless-smartcard

What and where are historical bytes in a MIFARE's ATS?


What are historical bytes, and, given an ATS value, how can you tell which bytes are "historical"?

In my particular case, I've got the ATS of a MIFARE DESFire card. The ATS is 75 77 81 02 80. From my understanding, DESFire should have no historical bytes, but if those bytes were present how would I identify their location in the ATS?


Solution

  • The historical bytes are all the remaining bytes of the ATS that follow the interface bytes (except for the CRC bytes of course). In your example, the ATS seems to decode to

    • T0 = 75h: Y(1) = 7h and FSCI = 5h, so there are three interface bytes, TA(1), TB(1), and TC(1).
    • TA(1) = 77h
    • TB(1) = 81h
    • TC(1) = 02h
    • Remaining byte(s) = 80h = Historical byte(s)

    A meaning for the historical bytes is defined in ISO/IEC 7816-4. For your case, that standard describes:

    If the first historical byte is set to [...] '80' the remaining historical bytes shall consist of optional consecutive COMPACT-TLV data objects; the last one may carry a status indicator in COMPACT-TLV format

    In your case, there are no such COMPACT-TLV encoded data objects.