0

With reference to section 8.7.1 to 8.7.3 NFC Mifare Spec Doc. I need to know the bit order of the trailor sector bytes, i.e. byte 6, 7, 8. So that I can do further processing on the trailor Sector i.e. write new key with access bytes to trailor sector, because as I write to the trailor sector it becomes inaccessible.

For byte 6, I am not clear that either

bits 0,1,2,3,4,5,6,7 

or

 bits 7,8,6,5,4,3,2,1,0

of byte 6 of trailor sector means

~C10    ~C11    ~C12    ~C13    ~C20    ~C21    ~C22    ~C23 
Community
  • 1
  • 1

1 Answers1

0

Typically, your platform and the NFC/smartcard reader front-end will care about the transmission bit order. Hence, you don't really need to care about that.

Regarding the access bits, these map to the access bytes (bytes 6-8 of the sector trailer) like this (bit 7 is the most significant bit and bit 0 the least significant bit):

Bit:      7    6    5    4    3    2    1    0
Byte 6: ~C23 ~C22 ~C21 ~C20 ~C13 ~C12 ~C11 ~C10
Byte 7:  C13  C12  C11  C10 ~C33 ~C32 ~C31 ~C30
Byte 6:  C33  C32  C31  C30  C23  C22  C21  C20

Hence, in oder to set

  • C13 = 0 (=> ~C13 = 1)
  • C12 = 1 (=> ~C12 = 0)
  • C11 = 1 (=> ~C12 = 0)
  • C10 = 0 (=> ~C12 = 1)
  • C23 = 1 (=> ~C23 = 0)
  • C22 = 0 (=> ~C22 = 1)
  • C21 = 0 (=> ~C22 = 1)
  • C20 = 0 (=> ~C22 = 1)
  • C33 = 0 (=> ~C33 = 1)
  • C32 = 0 (=> ~C32 = 1)
  • C31 = 1 (=> ~C32 = 0)
  • C30 = 1 (=> ~C32 = 0)

You would use set byte 6 = 0x79, byte 7 = 0x6C, byte 8 = 0x38 (note that those values were chosen to make it clear how the bits map to the bytes and that those values do not necessarily make any sense in practice).

Michael Roland
  • 39,663
  • 10
  • 99
  • 206
  • I am lost. The higher sectors have 16 blocks. How is the access bits configured for a sector with 16 blocks?? – daparic Feb 02 '21 at 10:14
  • @eigenfield Coding is the same. CX_3 is exactly the same as for 4-block sectors (sector trailer access). The other flags apply to groups of 5 blocks: CX_0 applies to blocks 0..4, CX_1 applies to blocks 5..9, and CX_2 applies to blocks 10..14. – Michael Roland Feb 02 '21 at 20:36
  • Thank you. I also figured it out and answered my own question https://stackoverflow.com/questions/66007809/mifare-4k-access-bits-on-higher-sectors-with-16-blocks/66010202#66010202 – daparic Feb 04 '21 at 10:37