从 mifare classic 读取特定扇区
如果我已经有密钥,我想读取 mifare classic 中的扇区 8。
从文档这里< /a> 上 authenticateSectorWithKeyA (intectorIndex, byte[] key)
失败的身份验证尝试会导致隐式重新连接到 标签,因此其他扇区的认证将会丢失。
听起来我必须向所有部门进行身份验证?我是否可以仅使用扇区 8 进行身份验证并仅从该扇区获取数据?
I would like to read sector 8 from mifare classic provided I already have the keys.
From documentation here on authenticateSectorWithKeyA (int sectorIndex, byte[] key)
A failed authentication attempt causes an implicit reconnection to the
tag, so authentication to other sectors will be lost.
It sounds like I have to authenticate with all sectors? Is it possible that I only authenticate with sector 8 and get the data only from that sector?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
是的,首先使用authenticateSectorWithKeyA()进行身份验证(如果您有密钥A,否则使用使用密钥 B 验证SectorWithKeyB()。如果返回 false,则身份验证失败(您的密钥不正确)。
成功后,您可以使用 readBlock() 读取数据(为了方便,可以使用 sectorToBlock() 从扇区索引转换为块索引)
不要担心身份验证失败:它不会影响您卡的操作。
Yes, first authenticate using authenticateSectorWithKeyA() (if you have key A, otherwise use authenticateSectorWithKeyB() with key B). If this returns false, the authentication has failed (your key was incorrect).
When this succeeds you can use readBlock() to read the data (for convenience, you can use sectorToBlock() to convert from sector index to block index)
Don't worry about failed authentications: it will not affect the operation of your card.
您应该与读卡器建立新的连接,然后选择卡标签SN,登录到扇区0以外的扇区,如果程序返回代码0/成功,则可以按块(16字节/块)读取/写入数据。否则它会拒绝 R/W 操作,您需要重新开始。
you should make new connection to the reader, then select card tag SN, Login to sector other than sector 0, if program get return code 0/success, then you can read/write data by block (16 bytes/block). otherwise it deny R/W operation and you need to start over.
不,您只需验证您正在读取的扇区。但是,如果您尝试验证另一个扇区并失败,则必须重新验证已成功连接的扇区。
No, you only have to authenticate the sector you are reading from. But if you try to authenticate another sector and fail, you will have to re-authenticate the sector you have already successfully connected to.