Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Modify the access bits of the sector trailer Mifare Classic

Tags:

android

nfc

how to Modify the access bits of the sector trailer in Mifare Classic 1k. I want toauthenticate sector.

like image 739
Qaiser Mehmood Avatar asked Jul 01 '11 21:07

Qaiser Mehmood


1 Answers

Modifying access bits is carried out by the same methods as writing normal blocks. You only aim at block 3 of the sector you want to alter access to. Taking into account the specs of the access bits present in block 3 of each sector (see chapter 8.7.1 from spec). A valid control bits combination along with the desired keys (A + B) must be specified (read/write operations on Mifare Classic Cards are performed at a block level basis).

For example if you want keyA-or-keyB-read operations available on any block of the sector and keyB-only-write permissions you can use a combination of [C1, C2, C3] = [0x78, 0x77, 0x88]. As you have to specify A and B keys (assuming all 0xAA for A key and all 0xBB por B key) the block data to write would be (take into consideration that byte 9 is unused):

byte authBlockData[] = {(byte) 0xAA, (byte) 0xAA, (byte) 0xAA, (byte) 0xAA,(byte) 0xAA, (byte) 0xAA, 0x78, 0x77, (byte) 0x88, 0x00, (byte) 0xBB,(byte) 0xBB,(byte) 0xBB,(byte) 0xBB,(byte) 0xBB,(byte) 0xBB};

like image 194
Fernando Miguélez Avatar answered Sep 19 '22 12:09

Fernando Miguélez