Mifare Change KEY A and B

僤鯓⒐⒋嵵緔 提交于 2019-12-04 19:17:34

问题


I have an ACR122U Contactless NFC reader. I bought a lot of blank RFID Mifare 4k tags. Their default Authentication KEY A and KEY B is FF FF FF FF FF FF.

Now I want to change them to something else. I'm using APDU structure. I'm sending commands like this and it works well:

byte[] baData = { 0x01, 0x00, (byte)i, 0x60, 0x00 };
APDUCommand apdux3 = new APDUCommand((byte)0xFF, (byte)0x86, (byte)0x00, (byte)0x00, baData, 0x05);

It works well. I don't know what this interface and model means, but using this type and structure, I want to change KEY A and KEY B.

Please help me. I can't find any document.

Regards


回答1:


That's true, chips are delivered with default key FF FF FF FF FF FF for key A and B.

To change them you have to authenticate the card with the correct access bits.

Note: the Mifare key is composed as follow:

  • 6 byte for key A
  • 4 byte for Access Bits
  • 6 byte for key B which is optional and can be set to 00 or any other value

To change your keys you have to authenticate the Sector Trailer and the write your new keys + new access conditions if you want to change them too.

Example

New key A = 00 11 22 33 44 55 Access bits not overwritten Key B not used (so FF FF FF FF FF FF)

=> Write to Sector Trailer 00 11 22 33 44 55 FF 0F 00 FF FF FF FF FF FF FF

Further details are on the NXP website available or directly at the following link: https://www.nxp.com/docs/en/data-sheet/MF1S50YYX_V1.pdf

A default Access Bits is usually FF 0F 00 that allow to write and read each block and to read and write key B.



来源:https://stackoverflow.com/questions/4842087/mifare-change-key-a-and-b

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!