简体   繁体   English

APDU使用ACR122U阅读器在mifare 1K上写入块命令

[英]APDU Write block commands on mifare 1K with ACR122U reader

Please, 请,

I am trying to write a simple Binary Block to mifare 1k tag with a ACR122U reader. 我正在尝试使用ACR122U阅读器编写一个简单的Binary Block来mifare 1k标签。

I am trying write to block 01, 5 bytes, text:'teste' and read it back. 我正在尝试写入块01,5个字节,文本:'teste',然后将其读回。

But I always get an error 6300 when update this block. 但是更新此块时总是出现错误6300。

Any thoughts? 有什么想法吗?

I am using windows 8.1/delphi xe8. 我正在使用Windows 8.1 / delphi xe8。

My log is: 我的日志是:

SCardEstablishContext succeeded.
Card State changed in ACS ACR122U PICC Interface 0 to available
New reader found: ACS ACR122U PICC Interface 0
Card inserted in ACS ACR122U PICC Interface 0
ATR = 3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 01 00 00 00 00 6A
SCardConnect (shared) succeeded.
Active Protocol: T=1
ISO 14443 A, Part3 Card Type: Mifare Standard 1K is detected
Sending APDU to card: FF 82 00 01 06 FF FF FF FF FF FF
SCardTransmit succeeded.
Card response status word: 9000 (OK)
Sending APDU to card: FF 86 00 00 05 01 00 01 60 01
SCardTransmit succeeded.
Card response status word: 9000 (OK)
Sending APDU to card: FF 86 00 00 05 01 00 01 60 01
SCardTransmit succeeded.
Card response status word: 9000 (OK)
Sending APDU to card: FF D6 00 01 05 74 65 73 74 65
SCardTransmit succeeded.
Card response status word: 6300 (State of non-volatile memory changed.)

This is easily resolved by reading the documentation. 通过阅读文档可以轻松解决此问题

在此处输入图片说明

You're writing to a block and you have to provide a complete block of information. 您正在写一个块,您必须提供一个完整的信息块。 The only option for Lc is x04 or x10 - four bytes or sixteen bytes. 对于唯一的选择Lcx04或者x10 -四个字节或十六个字节。 For the Mifare 1K, it's prettly clear that you need to supply 16 bytes. 对于Mifare 1K,很显然您需要提供16个字节。 You have only 5 bytes of data, so pad the rest with zeros. 您只有5个字节的数据,因此请用零填充其余数据。

|  CMD   | block1 | 16 bytes | data ... 
 FF D6 00    01       10       74 65 73 74 65 00 00 00 00 00 00 00 00 00 00 00

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

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