是否有可靠的方法来确定 RFID 卡是 Mifare Ultralight 还是 Mifare Ultralight C?
到目前为止,我发现的唯一方法是利用这两张卡的大小差异,发出超出较小卡边界的读取命令。但它看起来确实像一个黑客,我假设如果卡使用 Ultralight C 身份验证机制,读取命令可能会失败。
const char* mifare_ultralight_identification(const nfc_target_info_t nti)
{
byte_t abtCmd[2];
byte_t abtRx[265];
size_t szRxLen;
abtCmd[0] = 0x30; // MIFARE Ultralight READ command
abtCmd[1] = 0x10; // block address (1K=0x00..0x39, 4K=0x00..0xff)
if (!nfc_initiator_transceive_dep_bytes(pnd,abtCmd,2,abtRx,&szRxLen)) {
// READ command of 0x10 failed, we consider that Ultralight does have 0x10 address, so it's a "simple" Ultralight (i.e. not a Ultralight C)
// When a READ failed, the tag returns in HALT state, so we need to reselect tag
nfc_initiator_select_passive_target(pnd, NM_ISO14443A_106, nti.nai.abtUid, nti.nai.szUidLen, NULL);
return "";
}
return " C";
}