I work with mifare classic 1k card and I have a trouble. I want to rewrite access bits of the sector 0x23. Now sector trailer contain these bytes: 42 5a a8 b7 10 84 17 80 fe 0b c9 1e 70 e2 ef b0, where
Key A = 42 5a a8 b7 10 84
Key B = c9 1e 70 e2 ef b0
and
AccessBits = 17 80 fe 0b
I see that I need authenticate with key A if I want to write data in sector trailer. Ok, no problems, I know key A. After authentication, I build APDU for updating sector trailer:
FF D6 00 23 10 42 5A A8 B7 10 84 17 84 FA 0B C9 1E 70 E2 EF B0
And send it. But I have error with code 63 00. What am I doing wrong?
The access bits 17 80 FE
decode to C1 = 0x8
, C2 = 0xE
and C3 = 0xF
, so the access bits are:
1 1 1
0 1 1
0 1 1
0 0 1
Therefore, data block 0 permits read and decrement access with key A & B, data blocks 1 and 2 permit read and write access with key B. The secor trailer (block 3) is permanently write protected (only read access with key A & B to the access bits is permitted).
So you cannot update that secor's trailer block as it is permanently write protected.