4

I am using a Mifare classic 1k reader, and it comes with the default key A and B which is:

FFFFFFFFFFFF

Using the Key A to read and write works. but I want to change the keys.

Is there anyway to get the correct access bits for the sector and what is the format?

What I have done now is,

<newKey>+ access bits + <oldKEY>
212121212121078069FFFFFFFFFFFF

The access bits 078069 I got from reading block 7 of sector 1, which is like this:

000000000000FF078069FFFFFFFFFFFF

But there is error.

Are the access bits incorrect or is the format wrong?

quamrana
  • 37,849
  • 12
  • 53
  • 71
Liban
  • 641
  • 5
  • 19
  • 32

2 Answers2

4

Depending on the access control settings of the sector trailer, you may need to authenticate with key A or key B to be able to write keys. See the section 8.7 (and specifically 8.7.2) of the datasheet at http://www.nxp.com/documents/data_sheet/MF1S70YYX.pdf on how to encode/decode the access control bits in the sector trailer.

NFC guy
  • 10,151
  • 3
  • 27
  • 58
  • Thanks. i managed to change keys using the default access bits for the trailer and it worked. but is there a way to change the access bits? i read access condition for the sector trailer, but i can't get the idea yet. btw, i m using mifare 1k, not 4k. – Liban Jan 09 '13 at 03:50
  • @Liban please don't ask additional question within a comment. Accept the answer and ask additional questions the usual way. – Maarten Bodewes Jan 10 '13 at 01:30
  • @MaartenBodewes I am having the same issue. can you please help me out – Gaurav Arora Aug 19 '23 at 10:43
  • This is not how [so] works. I don't provide individual help here. Furthermore, the time that I used MIFARE is now **far** in the past; I'd have to look it up myself, so sorry, no. – Maarten Bodewes Aug 19 '23 at 20:13
0

What you need to do is, if access bits have permission (and your's seems like they do), is to write:

AAAAAAAAAAAA078069BBBBBBBBBBBB

where AAAAAAAAAAAA and BBBBBBBBBBBB are the NEW A & B keys, respectively. (You never write the old keys, you authenticate with onthem first).

When you read, using key A, you'll always get

000000000000078069BBBBBBBBBBBB

Key A will allways be masked

Vagner Gon
  • 595
  • 9
  • 23