Ultralight C-lock Mifare

I am trying to block the Mifare Ultralight C label. I want to set the NDEF pages 0x04 to 0x27 for read only. I think this can be achieved with help Ndef.makeReadonly().

In addition, I would like to set the pages 0x29 to 0x2F for password protection (for reading and writing), so that they can only be obtained after successful authentication. I am trying to understand what bytes need to be set in lock bytes (page 0x28, bytes 0, 1), and if it is necessary to set sectors 0x2A and 0x2B as well.

+1
source share
1 answer

I am trying to set NDEF pages 0x04 to 0x27 for reading. I think this can be achieved with Ndef.makeReadonly ().

Optional, Ndef.makeReadonly()can only set the read-only flag in the capabilities container (according to the NFC Forum Type 2 Tag Operation specification).

If you want to set the actual lock bits, you must connect the tag as a tag technology NfcAor MifareUltralightinstead execute the write command for the lock bits.

NfcA nfcA = NfcA.get(tag);
nfcA.connect();

byte[] result1 = nfcA.transceive(new byte[] {
    (byte)0xA2,  /* CMD = WRITE */
    (byte)0x02,  /* PAGE = 2    */
    (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0xFF  /* DATA = lock pages 3..15 */
});

byte[] result2 = nfcA.transceive(new byte[] {
    (byte)0xA2,  /* CMD = WRITE */
    (byte)0x28,  /* PAGE = 40   */
    (byte)0x0F, (byte)0x00, (byte)0x00, (byte)0x00  /* DATA = lock pages 16..27 */
});

Also see Mifare Ultralight: Lock specific pages to encode the lock.

I would like to set the 0x29 pages to 0x2F for password protection (for reading and writing) so that they can only be retrieved after successful authentication.

, , 44..47. AUTH1 (. 43) . , AUTH0 (. 42) 0x29 0x00 0x00 0x00, 41 . 40 , . (.. 0x1F 0x0F 0x00 0x00 . 40), .

+3

Source: https://habr.com/ru/post/1619343/


All Articles