android - Cannot authenticate a sector in mifare card with correct key in android
问题描述
I have a mifare classic 1K card and custom Key. But unable to read/write using it. Need help to find my mistake.
I have identified the key that is used to read/write the mifare card using NXP Taginfo and Mifare Classic Tool. It shows access bits as FF078000 and Key B is 222222222222 Now I am using Key B to read the data from the mifare classic 1K card. Below is the code.
NXP Taginfo tool output is here.
byte[] newkey = {(byte)0x00, (byte)0x33,(byte)0xBD,(byte)0x7A,(byte)0x03,(byte)0x8E};
boolean authB = taskTag.authenticateSectorWithKeyB(6, newkey);
Log.i("New Key"+ new BigInteger(newkey).toString(), "authB : " + authB) ;
But authB is returning false. what is wrong here?
Any help is much appreciated.
Edit-1:
After extensive reading I figured I may have interpreted the access conditions wrongly. I think I may need to authenticate with Key A. But as per the access conditions key A is not readable. Am I correct here?
Edit-2
How come nxp tag editinfo/Mifare Classic Tool are able to read the data with the key as 222222222222 but I cannot?
解决方案
I figured that the problem was with the key. I have to use 222222222222 as the key not it's hex form. so changing the key to the below line resolved the issue.
newkey = {(byte)0x22, (byte)0x22,(byte)0x22,(byte)0x22,(byte)0x22,(byte)0x22};
推荐阅读
- node.js - 在linux centos上找不到现有的模块节点js
- javascript - 带有 slug 值的动态下拉菜单和子菜单 php mysqli
- node.js - 我的请求代码没有打印 API 的正文
- java - 偶尔获取 JDBC 开始事务失败,然后自动恢复
- asp.net-core - 我们如何在扩展结果中使用子查询获得 Odata $expand 结果
- r - 关联图。相关错误:“x”必须是数字。所有字段都是数字
- javascript - 如何为 [ 和 { 和 ' 和 " 获取不同的 javascript 键码
- c++ - 递归函数计算序列中的平方和(并输出过程)
- java - java --version 中看不到采用openjdk-8-hotspot
- vue.js - 未设置组件复选框(vue、vee 验证)