简体   繁体   English

我如何阅读Nexus的mifare经典1k卡

[英]How Can i read mifare classic 1k Card by Nexus s

am working with NFC Android programming and I want to read Mifare Classic cards. 我正在使用NFC Android编程,我想阅读Mifare Classic卡。 Does anybody know how to read the sectors off such a card? 有人知道如何阅读这种卡片上的扇区吗?

Authentication method returns true which means that authentication is done. 身份验证方法返回true,表示身份验证已完成。 After authentication, sector should be ready for any IO action but whenever i use readBlock() method or transceive() method, I get exception with IOException("transceive failed"). 在身份验证之后,扇区应该为任何IO操作做好准备,但每当我使用readBlock()方法或者transmitive()方法时,我都会遇到IOException异常(“收发失败”)。 I can not find any example which uses the Mifare Classic, so i want to know if it is possible to read the Mifare Classic with this API or not. 我找不到任何使用Mifare Classic的例子,所以我想知道是否可以用这个API阅读Mifare Classic。

My code like this boolean success = m1tag.authenticateSectorWithKeyB(0,MifareClassic。KEY_DEFAULT) int index = m1tag.sectorToBlock(0) byte[] content = m1tag.readBlock(index) 我的代码像这样boolean success = m1tag.authenticateSectorWithKeyB(0,MifareClassic。KEY_DEFAULT) int index = m1tag.sectorToBlock(0) byte[] content = m1tag.readBlock(index)

success is true,but when i read content from card,throw IOException("transceive failed") 成功是真的,但是当我从卡片中读取内容时,抛出IOException(“收发失败”)

You won't be able to readBlock() or writeBlock() after using authenticateSectorWithKeyB() . 使用authenticateSectorWithKeyB()后,您将无法readBlock()writeBlock() authenticateSectorWithKeyB() If it is a new tag with default access bits access to the tag will be blocked. 如果它是具有默认访问位的新标记,则将阻止对标记的访问。 If the access conditions have be changed then readBlock() and writeBlock() will throw an exception. 如果访问条件已更改,则readBlock()writeBlock()将引发异常。 You will have to perform reading of the tag using KeyA authentication. 您必须使用KeyA身份验证执行标记的读取。

You can not read the Block of a mifare card by authonticating with keyB. 您无法通过使用keyB进行身份验证来阅读mifare卡块。 To read the block of Mifare card, you will have to aunthenticae with key A ie use authenticateSectorWithKeyA() instead of authenticateSectorWithKeyB() . 要读取Mifare卡的块,您必须使用密钥A进行aunthenticae,即使用authenticateSectorWithKeyA()而不是authenticateSectorWithKeyB()

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

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