I am using the PN532 NFC Board. It's connected via I2C to my Raspberry Pi.

I am looking for a library/Script which gives me any Sector of a Mifare Classic NFC card. I only can find the normal Tutorials, but these are only giving me the User ID and not the data of different Sectors. Like this tutorial: https://blog.stigok.com/2017/10/12/setting-up-a-pn532-nfc-module-on-a-raspberry-pi-using-i2c.html

I would appreciate if someone got any script to read out the Sectors of the Mifare Classic NFC Card with the PN532 connected with I2C!

Many thanks in advance

2 Answers 2


Found a Library which is working for me. With this Library I can authenticate with the right key and read out the Sectors/Blocks I want to read.


It is working totally fine with a Raspberry Pi.

Just clone the repo and install all necessary requirements. Easiest way to do this is just install with the requierements.txt

pip3 install -r requirements.txt

Then use the examples to create your own python script.

Offtopic: But now I am fucked because the guys at work want me to do the same things, which I did on a Raspi, on a Banana Pi M4. There's a Raspbian Linux Image but yeah.. Nothing is supported there and nothing works.. I hate my life.

Nevertheless thanks for helping and supporting guys


The Clssic 1/2/4K card storage is a hierarchy of fixed number of blocks of sectors of bytes each of which might be of type index, key, or data.

So it is like HDD's FAT/exFAT/NTFS format.

And like the HDD, data stored, say logical files, may be scattered in different physical sectors, sequential or indexed/hashed, and might be encrypted.

So I guess it is very difficult to read what is stored in a say, train fare card, unless you know all the detailed data declaration/encryption rules.

You might like to google to know more:

(1) How to configure MIFARE card memory layout - Holly Colbert 2006

(2) Logical Structure of the MIFARE Classic Tags, Section 3, Dismantling MIFARE Classic, FD Garcia etal, 2008.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.