我需要找到一个解决方案来编写带有自定义 key 的 Mifare Classic 1 K 标签。我无法编写它,我尝试了所有选项,但不幸的是,我一直收到错误“IOException:Transceive Failed”。
下面是我的代码 fragment :
byte custom_key[]={
(byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff
};
// 16 bytes of Data. Otherwise it was throwing IllegalArgumentException .
byte[] data="Hello world of N".getBytes();
getMfc().connect();
if(getMfc().authenticateSectorWithKeyA(4, custom_key)) {
getMfc().writeBlock(3, data); // Here I receive IOException all the time.
} else {
getMfc().close();
}
请在这方面帮助我。我需要用我自己的 key 编写 Mifare Classic 1 K 标签。
最佳答案
您对扇区 4 进行身份验证,然后尝试写入 block 3。 block 3 在扇区 0 中,因此这总是会失败。改为尝试对扇区 0 进行身份验证。
顺便说一句:请不要将随机数据写入扇区尾部(例如 block 3)。它可能会锁定该部门而无法恢复。
关于android - 如何使用自定义 key 编写 MifareClassic,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13154452/