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,
(byte)0x02,
(byte)0x00, (byte)0x00, (byte)0xFF, (byte)0xFF
});
byte[] result2 = nfcA.transceive(new byte[] {
(byte)0xA2,
(byte)0x28,
(byte)0x0F, (byte)0x00, (byte)0x00, (byte)0x00
});
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), .