你好,
我正在开发 Pax 设备,并且想要管理Mifare ULTRALIGHT C (MF0ICU2) 卡。
Pax 设备使用定制的 PayDroid 操作系统,而不是标准的安卓系统,因此,我没有 NFC 安卓库。
我需要安装一个名为 NeptuneLiteAPI 的库,该库可以公开 IPCC。
首先,我对命名规则和标准有点困惑。API 指的是:
通常情况下,Ultralight C 是 14443 Type A,但我无法使用此选项读取我的卡,使用“M1 Card”选项可以成功读取。M1卡是什么?它是经典的1000K卡吗?
文档提到我需要使用 APDU 并公开一些命令来执行此类调用。
我成功地对卡进行了读写操作(使用 M1 函数),该库提供的默认读写方法使用了与我的卡兼容的兼容模式。
现在,我正在尝试配置身份验证,并通过 APDU 命令向芯片发送一些命令。
以下是我可以使用的代码的简化版本
iPicc = getDal().getPicc(piccType);
iPicc.open();
while(){
PiccCardInfo cardInfo = iPicc.detect(EDetectMode.ONLY_M);
if(cardInfo!=null){
//Read : works
byte[] page0=iPicc.m1Read((byte) 0);
// Write : works
iPicc.m1Write((byte)(13),hexStringToByteArray("AAAAAAAA000000000000000000000000"));
}
写作方面,我有三种方法:
如果我理解正确的话,Mifare Ultralight C 不支持 APDU,但 APDU 却是唯一的传输方式?
我在一些网站上发现,使用指令类“FF”,可以直接向芯片发送指令。
但我不知道该发送什么命令,我尝试了好几个。
我遇到了错误(不幸的是,它们是 NeptuneLiteAPi 而不是标准版本)。
但很奇怪,我之前明明能检测到这张卡,而且读写操作也成功了,所以这张卡应该是“连接正常”的。
我尝试了几个命令(直接指令、APDU 指令、CRC 计算),但都无效。
//byte[] cmd2 = iPicc.isoCommand(cardInfo.getCID(), CryptageUtils.hexStringToByteArray("30")); // PICC#97(unexpected error)
//byte[] cmd2 = iPicc.isoCommand(cardInfo.getCID(), CryptageUtils.hexStringToByteArray("3004")); // PICC#97(unexpected error)
//byte[] cmd2 = iPicc.isoCommand(cardInfo.getCID(), CryptageUtils.hexStringToByteArray("3000")); // PICC#97(unexpected error)
//byte[] cmd2 = iPicc.isoCommand(cardInfo.getCID(), CryptageUtils.hexStringToByteArray("3000A802")); // Avec CRC => No specific card in sensing area, or card is not activated PICC#3(not search card error)
//byte[] cmd2 = iPicc.isoCommand(cardInfo.getCID(), CryptageUtils.hexStringToByteArray("300002A8")); // Avec CRC inversé => No specific card in sensing area, or card is not activated PICC#3(not search card error)
//byte[] cmd2 = iPicc.cmdExchange(CryptageUtils.hexStringToByteArray("3000A802"),17); // Card is not activated. PICC#3(not search card error)
// byte[] cmd2 = iPicc.isoCommand(cardInfo.getCID(), CryptageUtils.hexStringToByteArray("30000000")); // No specific card in sensing area, or card is not activated PICC#3(not search card error)
//byte[] cmd2 = iPicc.isoCommand(cardInfo.getCID(), CryptageUtils.hexStringToByteArray("ff300000")); // No specific card in sensing area, or card is not activated PICC#3(not search card error)
//byte[] cmd2 = iPicc.isoCommand(cardInfo.getCID(), CryptageUtils.hexStringToByteArray("ff30000F")); // No specific card in sensing area, or card is not activated PICC#3(not search card error)
//byte[] cmd2 = iPicc.isoCommand(cardInfo.getCID(), CryptageUtils.hexStringToByteArray("FFCA00000004")); // No specific card in sensing area, or card is not activated PICC#3(not search card error)
//byte[] cmd2 = iPicc.isoCommand(cardInfo.getCID(), CryptageUtils.hexStringToByteArray("3000000004")); // No specific card in sensing area, or card is not activated PICC#3(not search card error)
//byte[] cmd2 = iPicc.isoCommand(cardInfo.getCID(), CryptageUtils.hexStringToByteArray("3001")); // No specific card in sensing area, or card is not activated PICC#3(not search card error)
如果有人能指点我一下或者给我指明正确的方向,我将不胜感激。
问候。
你好@thibaut @Antoine1 @Erableto ,
你找到解决这个问题的方法了吗?我也遇到了同样的问题:我无法读取 Mifare Ultralight EV1 上的计数器;我主要尝试使用 cmdExchange,但也尝试了 NeptuneLite 库提供的所有其他方法,但我总是收到类似 PICC#3 或 #97 的错误。
你找到问题的答案了吗?
因为我们这边也存在同样的问题。
此致问候
你好,Thibaut。你弄明白了吗?我和你做的一样,但我用的是 Mifare Classic 1k 卡,也遇到了同样的问题。我也需要帮助。
我会及时向您汇报任何进展。我希望我们能一起完成这件事。
此致问候