Mifare emulation MF_Password
843851May 14 2009 — edited Jun 23 2010Using the G&D JCSuite toolkit I'm developing an applet which reads/writes data to the MIfare emulation element. The problem I'm getting is that when I set the sector trailer to some specific keys, I cannot read/write data to data-blocks within the sector - I effectively lock the sector even though I know the keys.
So, from the MF_Password generation document:
http://www.nxp.com/acrobat_download/other/identification/067512.pdf
There are examples of generating the MF_Password for 3 different keys, and I can verify my applet generates the same correct password. When I set the keys:
KeyA: A0 A1 A2 A3 A4 A5 KeyB: B0 B1 B2 B3 B4 B5
i.e. a write-block of 16 bytes:
A0A1A2A3A4A4FF078040B0B1B2B3B4B5
Into block 7 (Sector 1 Block 3).
If I read back the data from Block 4, I get no error & valid data - everything works as expected.
If however (and unexplicably) I write the keys:
KeyA: 4D 3A 99 C3 51 DD KeyB: 1A 98 2C 7E 45 9A
i.e. the write-block of 16 bytes:
4D3A99C351DDFF0780401A982C7E459A
Into the same block, and then try to read back the corresponding block (like the example above). I get a security error as if I specified the wrong keys.
How can the keys function correctly for one set, but not another. When I can verify that MF_Password is being generated correctly (using the JCSuite debugger).
James