5
votes

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

1
+1 because I didn't know what this thing was before I read your questionThomas Dignan
you know mifare classic 1k card have 16 sectors and 4 block in each sector, 4th block in each sector is trailer which contain authentication key A and B and key B is 16 byte about which 6-8 bytes contain Access bits which determined the read/write authentication. So I want to authenticate the read/write operation in mifare classic 1k card. I hope you understand my questionQaiser Mehmood

1 Answers

9
votes

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};