简体   繁体   English

Mifare 1K写入块,但无法读取值块

[英]Mifare 1K write block but cannot read value block

For the last three days I have been looking for block and value blocks for Mifare 1K. 在过去的三天内,我一直在寻找Mifare 1K的区块和价值区块。

For example, I wrote data successfully 1. block with this APDU: 例如,我成功写入了此APDU的数据1.块:

< FF D6 00 01 10 61 79 79 69 6C 64 69 7A 66 61 74 69 68 31 31 31 
    - Start Block 01
    - Number of Bytes to Write: 16
    - Data: ayyildizfatih111
> 90 00
    - Write Binary Block Success

Then I can read as below APDU: 然后我可以阅读以下APDU:

< FF B0 00 01 10
    - Data Read at Start Block 01
    - Number of Bytes Read: 16
> 61 79 79 69 6C 64 69 7A 66 61 74 69 68 31 31 31 90 00 
    - ASCII Mode: ayyildizfatih111
    - Read Binary Block Success

But when I tried read value block it's giving this error. 但是,当我尝试读取值块时,会出现此错误。

< FF B1 00 01 04 
    - ACR122U Read Value Block
> 63 00
    - Operation failed

So my question is what is the difference? 所以我的问题是有什么区别? When I am writing data, should I use binary blocks or value blocks. 当我写数据时,应该使用二进制块还是值块。 Which one is better? 哪一个更好?

Reading the value block fails because your block 1 is not a value block. 读取值块失败,因为块1不是值块。 Binary data blocks and value blocks share the same memory, the difference is just how you format the contents of the block and how you set the permissions for the block. 二进制数据块和值块共享相同的内存,区别仅在于格式化块内容的方式以及设置块权限的方式。

In order to turn block 1 into a value block, you would set the blocks access bits to allow value block operations (decrement, transfer, restore, and (optional) increment). 为了将块1转换为值块,您需要设置块访问位以允许值块操作(减量,传输,恢复和(可选)递增)。 You would then write the block as a value block (with ACR122U V2.02: either using the Value Block Operation command or using a regular Update Binary Block command). 然后,您可以将该块写为值块(对于ACR122U V2.02:使用“值块操作”命令或常规的“更新二进制块”命令)。

The format of a value block (when using binary data block operations) is: 值块的格式(使用二进制数据块操作时)为:

     +----------+----------+----------+----+----+----+----+
Byte |   0..3   |   4..7   |   8..11  | 12 | 13 | 14 | 15 |
     +----------+----------+----------+----+----+----+----+
Data | xxxxxxxx | yyyyyyyy | xxxxxxxx | uu | vv | uu | vv |
     +----------+----------+----------+----+----+----+----+

Where xxxxxxxx is a 4 byte signed (2's complement) integer (LSB = byte 0), yyyyyyyy is the inverted value of xxxxxxxx , uu is an address byte (can be used when implementing a backup mechanism), vv is the inverted value of uu . 其中xxxxxxxx是一个4字节带符号的(2的补码)整数(LSB =字节0), yyyyyyyyxxxxxxxx取反值, uu是地址字节(可在实现备份机制时使用), vvuu取反值。

If you should use binary data blocks or should use the value format depends on your application. 是否应使用二进制数据块或应使用值格式取决于您的应用程序。 If you want to store a 4 byte integer value and wat to use value block operations, you may prefer to use the value block format. 如果要存储4字节整数值并使用wat进行值块操作,则可能更喜欢使用值块格式。 If you want to store other data, don't need the redundancy of the value block format, only want to use binary read/write operations, you may prefer to use a block as free-form binary data block. 如果要存储其他数据,则不需要值块格式的冗余,仅希望使用二进制读/写操作,则可能更喜欢将块用作自由格式的二进制数据块。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM