Search code examples
nfcrfidmifare

Distinguish Mifare Ultralight from Mifare Ultralight C


Is there a reliable way to find out if an RFID card is either a Mifare Ultralight or a Mifare Ultralight C?

The only way i found so far is utilizing the difference in size of those two cards issuing a read command beyond the boundaries of the smaller one. But it does look like a hack and i assume the read command might fail if the card uses the Ultralight C authentication mechanism.

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";
}

Source


Solution

  • Yes, it is possible if you have the documentation on how the MIFARE Ultralight C authentication mechanism works. MIFARE Ultralight does not support this, so it will raise an error condition.