MIFARE CLASSIC READ instruction

The MIFARE CLASSIC READ instructions retrieves data from a Mifare Classic card (e.g. Mifare 1K or Mifare 4K). It is also suitable to read data from a Mifare Plus card, provided that the card is in Security Level 1.

The difference with the READ BINARY instruction lies in the simplified implementation of the Mifare Classic authentication scheme (CRYPTO1). With READ BINARY, the authentication must be performed beforehand and explicitly using the GENERAL AUTHENTICATE instruction with a key previously provided thanks to the LOAD KEY instruction.

On the other hand, MIFARE CLASSIC READ provides two interesting shortcuts:

  • In “try all keys” mode, the authentication is either performed automatically by the SpringCore device, trying all the known key one after the other until success. This frees the application from the burden of trying every key one after the other.
  • In “use this key” mode, the applications provides the (expected) value of the key within the instruction. This is the same as LOAD KEY / GENERAL AUTHENTICATE / READ BINARY but in a single call.

Command format

‘Try all keys’ mode

Field Value Remark
CLA FF
INS F3
P1 00
P2 Block number
Lc absent
DataIn absent Can’t be empty
Le Number of bytes to read Possible values are 10, 30 or F0 only

‘Use this key’ mode

Field Value Remark
CLA FF
INS F3
P1 00
P2 Block Number
Lc 06
DataIn Key Value Can’t be empty
Le Number of bytes to read Possible values are 10, 30 or F0 only

In this mode the application specifies the value of the key.

The device tries to get authenticate with the supplied key with a type A authentication. Only if it fails it tries type B authentication.

About the Number of bytes to read parameter

Le (number of bytes to read) tells whether the application wants to read 1 block (16 bytes), 1 sector (3 blocks) or 1 large sector (15 blocks). This instruction can not cross the sector boundaries.

Reading a sector trailer is possible but with Le=10 (1 block) only, setting P2 to the address of the sector trailer.

Response

Success

Field Value
DataOut Control response (status and data)
SW 9000

Typical status words upon error

SW Explanation
6F01 The card has been removed / communication error
6F04 Authentication failed / no suitable key
6F12 Authentication OK but block not readable