Android NFC- Mifare Classic Restore and Transfore无法正常工作

发布于 2025-02-03 00:43:00 字数 1053 浏览 3 评论 0原文

根据文件;

还原:将块的内容移至内部传输中 缓冲区

转移:将内部传输缓冲区的内容写入 值块

因此希望将一些数据从X块移动到Y块。

根据访问条件, sector 3 支持传输还原

块12 有一个数据QuickAppDemotest。我想通过使用Restore传输方法,将其从 Block 12 移动到块13 。工作。

MifareClassic mfc = MifareClassic.get(tag);
try {
    mfc.connect();
    boolean authA = mfc.authenticateSectorWithKeyA(3, MifareClassic.KEY_NFC_FORUM);
    if (authA) {
        mfc.restore(12);
        mfc.transfer(13);
    }
    mfc.close();
} catch (Exception e) {
    Log.d(TAG, "Error: " + e.getMessage());
}

它不会引发任何异常,但是在方法完成后,当我从应用程序中检查 block 12 QuickAppTestDemo数据时。

谁能给我线索?

According to documentation;

Restore: Moves the contents of a block into the internal Transfer
Buffer

Transfer: Writes the contents of the internal Transfer Buffer to a
value block

So want to move some data from x block to y block.

According to access conditions, Sector 3 supports transfer and restore.

enter image description here

Also Block 12 have a data quickappdemotest. I want to move it from Block 12 to Block 13 by using restore and transfer methods but somehow it did not work.

MifareClassic mfc = MifareClassic.get(tag);
try {
    mfc.connect();
    boolean authA = mfc.authenticateSectorWithKeyA(3, MifareClassic.KEY_NFC_FORUM);
    if (authA) {
        mfc.restore(12);
        mfc.transfer(13);
    }
    mfc.close();
} catch (Exception e) {
    Log.d(TAG, "Error: " + e.getMessage());
}

It does not throw any exception but after method completes, when I checked from the app only Block 12 have quickapptestdemo data.

Can anyone give me clue?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

苍景流年 2025-02-10 00:43:00

还原命令需要格式为值块
块12的示例:
ff000000000000000000000000000cf30cf3

restore command needs block formatted as value block
example for block 12:
FF00000000FFFFFFFF0000000CF30CF3

对风讲故事 2025-02-10 00:43:00

转移操作仅适用于价值块,必须填补两个条件:

  • 您需要许可进行转移,这取决于访问位,
  • 必须将块格式格式化为值块,您需要使用写入来初始化块的值在使用它之前的操作值阻止

值块格式看起来像这样:

例如,390的值看起来像这样(请注意,数字是小endian,lsb首先),

 value     ~value    value    address
|-------| |-------| |-------| |-------|
8601 0000 79fe ffff 8601 0000 00ff 00ff

地址的值并不重要,只要格式化是可以

的更多信息,查看第8.6.2.1章在这里

The transfer operation only works on value blocks, two conditions must be filled:

  • You need permission to do a transfer, this depends on the access bits
  • The block must be formatted as value block, you need to initialize the value of the block with a write operation before using it a value block

The value block format looks like this:
enter image description here

For example, a value of 390 would look like this (mind that numbers are stored as little endian, LSB first)

 value     ~value    value    address
|-------| |-------| |-------| |-------|
8601 0000 79fe ffff 8601 0000 00ff 00ff

The value of the address does not really matter, as long as the formatting is OK

For more info, check out chapter 8.6.2.1 here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文