Monday, 16 January 2017

Understanding the memory structure of MIFARE 1k and 4k Classic Smartcards

Understanding the memory structure of MIFARE 1k and 4k Classic Smartcards
This article shows the memory structure which is used in MIFARE 1k and 4k smartcards
Basically the MIFARE Classic card is a memory storage device. The memory is divided into sectors, which are also divided into blocks of 16 bytes.

MIFARE Classic 1K card

The MIFARE Classic 1K card has 16 sectors, each of which are divided into four blocks. If we do the math, we can figure out how the memory structure would be like: 16 bytes (1 block) * 4 blocks * 16 sectors = 1024 bytes.


 MIFARE 1K card memory structure
The above image shows the memory structure of MIFARE 1K card. From this we can clearly understand different blocks which are used for various purpose .
Here, the Block’s shows where we can write data in to the card. you have plenty of location in a card that you can write data. Also there are some restricted blocks you should not write in to.
Restricted blocks
Here the restricted blocks CSN,CIS,Site Key block’s. We cant write data in these blocks.



MIFARE Classic 4K card
The MIFARE Classic 4K card has 40 sectors, 32 of which are divided into four blocks and the remaining 8 are divided into 16 blocks. 16 bytes (1 block) * 4 blocks * 32 sectors + 16 bytes (1 block) * 16 blocks * 8 sectors = 4096 bytes. The memory structure is as follows:



MIFARE 4K card memory structure
The number on the blocks indicates its index. Each sector is protected by the site key written in the last block of the sector. For example, block 3 contains the site key for sector 1 and block 7 for sector 2. The last block in each sector also contains access conditions information such as "write", "read" and "read & write". The following figure demonstrates how the last block consists of:


 

No comments:

Post a Comment