Search code examples
nfcmifarendefcontactless-smartcardlib-nfc

Format/Read/Write NDEF Mifare 1K Card using libnfc


I am new to NFC and I want to learn more about this, so I bought a PN532 NFC shield from Adafruit and a couple of Mifare 1K Card.

Now I have installed successfully Libnfc on Windows 8 and it works fine, I can use nfc-list.

I have tried to install libfreefare but I have errors (I have posted a topic on that)

But I really need to be able to format cards to NDEF, and to read and write NDEF data on a MIFARE Classic 1K card.

Does anyone know how to do so? Is it possible to use the libnfc.dll to do so? Does anyone have exemple or tutorial on this?

For security matters, is it better to have DESFire 4k or 8k instead of MIFARE Classic 1k in order to be sure that my card is secure (can not be overwritten)?


Solution

  • Yes, you can use libnfc for that purpose. For an example of how to accesws MIFARE Classic cards see

    With regard to formatting MIFARE Classic cards with NDEF data, I suggest that you have a look at the application note from NXP on this topic:

    For security matters, is it better to have DESFire 4k or 8k instead of MIFARE Classic 1k in order to be sure that my card is secure (can not be overwritten)?

    Right. MIFARE Classic security is know to be completely broken since 2008/2009. This means that,

    • Anyone can easily find the access keys for your card. All an attacker needs for this is the card.
    • Anyone can read your card regardless of what access keys you set (though using it as NDEF tag implies that you want to have it world-readable anyways).
    • Unless you permanently write protect all sectors of your card (this means that you set the access conditions in a way that no block can be written with any access key), an attacker can easily overwrite any data. Depending on your requirements, digital signatures/cryptographic checksums may be suitable to overcome this issue.
    • It's rather easy to create perfect clones of MIFARE Classic cards.