我可以恢复 MIFARE Classic 卡吗? [英] Can I recover a MIFARE Classic card?

查看:34
本文介绍了我可以恢复 MIFARE Classic 卡吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是我使用Arduino上的读写"示例逐块重写RFID卡(MIFARE Classic 1K).我从第 4 块开始写入.在第 7 块它停止了,现在我无法读取任何扇区.我给每个块都写了零.

My problem is that I used the "read and write" example on the Arduino to re-write an RFID card (MIFARE Classic 1K) block by block. I started writing at block 4. At block 7 it stopped and now I can't read any sector. I wrote zeros to each block.

DumpToSerial 函数只是为每个扇区打印

The DumpToSerial function just prints for every sector

PCD_Authenticate() 失败:通信超时.

PCD_Authenticate() failed: Timeout in communication.

它仍然可以读取 UID、SAK 和 PICC 类型.

It can still read the UID, the SAK, and the PICC type.

我是否销毁了卡,或者我可以恢复它?

Did I destroy the card or can I recover it?

更多信息:

  • 卡片:MIFARE Classic 1K
  • 来自 Elegoo 的 Arduino Mega2560
  • 入门套件中的 RC522

推荐答案

在 MIFARE Classic 1K 中,每 4 个块是扇区尾部(每 4 个块组成一个扇区).扇区尾部包含扇区的访问密钥(字节 0..5 上的密钥 A,字节 10..15 上的密钥 B)和访问条件(字节 6..8 上的访问位).

With MIFARE Classic 1K, every 4th block is the sector trailer (each 4 blocks are grouped into one sector). The sector trailer contains the access keys (key A on bytes 0..5, key B on bytes 10..15) and access conditions (access bits on bytes 6..8) for a sector.

访问条件受冗余机制保护,其中每个访问位在正逻辑和负逻辑中多次出现.MIFARE Classic 卡允许使用无效值(访问位的不可能组合)覆盖这些访问条件.但是,一旦访问条件设置为这样一个无效值,芯片的安全逻辑将禁止对 wole 扇区的所有访问.因此,将无效访问条件写入扇区尾部会导致整个扇区不可用.此状态永久且无法恢复.

The access conditions are protected by a redundancy mechanism where each access bit is present multiple times in positive and negative logic. A MIFARE Classic card allows overwriting these access conditions with invalid values (impossible combinations of access bits). However, once the access conditions are set to such an invalid value, the security logic of the chip will disable all access to the wole sector. Consequently, writing invalid access conditions to the sector trailer renders the whole sector unusable. This state is permanent and cannot be reverted.

您编写了从块 4 开始的所有块全为零.因此,您编写了扇区 1(在块 7 中)的扇区尾部,并将访问条件设置为全零.这是访问条件的无效值.因此,扇区 1 永久不可用.由于您表示在写入块 7 后立即收到错误,您可能很幸运并且没有覆盖其他扇区尾部(例如,扇区 2 的块 11).在这种情况下,那些其他扇区应该仍然可用.同样,由于您从块 4 开始写入,因此第一个扇区(扇区 0,块 0..3)也应该仍然可以访问.

You wrote all blocks starting at block 4 with all-zeros. Consequently, you wrote the sector trailer of sector 1 (in block 7) with the access conditions set to all-zeros. This is an invalid value for the access conditions. Therefore, sector 1 is permanently unusable. Since you indicated that you immediately received errors after writing block 7, you might be lucky and did not overwrite other sector trailers (e.g. block 11 for sector 2). In that case, those other sectors should still be usable. Similarly, since you started writing at block 4, the first sector (sector 0, blocks 0..3) should also still be accessible.

这篇关于我可以恢复 MIFARE Classic 卡吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆