DESFire Applications, Files, and Keys: How the Card Stores Data
A DESFire card isn't a block of memory. It's a small file system: applications hold files, and keys decide who can read or write each one.
How does a DESFire card store data?
A DESFire card stores data in applications, which hold files, and keys control who can use each one. Unlike a sticker tag, it is a microprocessor card with its own operating system, closer to a tiny locked filing cabinet than a strip of memory. If you are still weighing card families, our DESFire vs MIFARE Plus comparison covers that choice. Here's the structure inside, using the EV1 generation as the reference.
The card as a small file system
A DESFire EV1 card comes with 2, 4 or 8 kB of memory. That memory is organized as a file system, not fixed blocks, so there are no sectors to address by number. You ask for an application, then a file inside it.
That's the biggest difference from a card like MIFARE Classic. You don't read block 4. You select an application, authenticate if the file asks for it, and read a file by its ID.
Applications and application IDs
According to NXP, an EV1 card holds up to 28 applications. Each one is a secured folder picked with a 3-byte application ID (AID), and 0x000000 is reserved for the card itself.
Applications are isolated from each other, so a transit operator, a gym and a campus can each keep their own application on one card, with their own keys, and none can read the others' files.
NXP lists EV1 as not recommended for new designs and names MIFARE DESFire EV3 as the replacement. Limits differ between versions, so check the datasheet for the chip in your hand.
File types
Each application can hold up to 32 files, and each file's size is fixed when it is created. EV1 offers five types:
| File type | What it holds |
|---|---|
| Standard data | Arbitrary bytes |
| Backup data | Like standard data, but a write completes fully or not at all |
| Value | An integer changed with credit and debit operations |
| Linear record | Fixed-size records, appended until the file is full |
| Cyclic record | Like linear, but when full the oldest record is overwritten |
A cyclic record file suits a ride history, because the newest entries replace the oldest. A value file suits a stored balance. Backup variants matter because of anti-tearing: all writes of a transaction are validated or cancelled as one unit, so pulling a card out of the field mid-write doesn't leave a half-updated file.
Keys and access rights
Keys come in two levels. A card master key governs card-level settings. Inside each application, up to 14 keys can be defined, and key 0 is the application master key.
The card and reader prove themselves with three-pass mutual authentication, which produces a session key. EV1 supports DES, 3DES and AES-128, and later messages can be signed with an 8-byte CMAC or encrypted. For anything new, AES-128 is the sensible pick.
Each file then names which key may read it, which may write it, which may do both, and which may change those rules. A right can also be set to free access or to never. By default, creating or deleting files needs the application master key.
Why your phone sees so little
Without a key, a phone can only reach what the card exposes freely. Most real cards lock their files, which is why a scan often shows a UID and little else. We explain the symptom in why a DESFire card shows no NDEF records on your phone, and what each platform can do in what iPhone and Android can read from a DESFire card.
Only inspect cards you own or are allowed to test. Keys are the whole security model, and the structure above tells you what a locked response means rather than how to get around it.
Conclusion
Think of DESFire in three layers: applications as folders, files as typed storage, keys as the locks. Once you see that, a scan makes sense. Usually you get the card's identity and perhaps an application list. The rest is closed on purpose.
To inspect tags you own, NFCore for iPhone and NFCore for Android read what a phone is allowed to see. iOS has limits that Android doesn't, so some details will stay hidden.
Frequently Asked Questions
How many applications can a DESFire card hold?
A DESFire EV1 card holds up to 28 applications, each selected by a 3-byte application ID. Later versions (EV2, EV3) change these limits, so check the datasheet for your exact chip.
Can I read a DESFire file without the key?
Only if the file's access right is set to free access. Otherwise the card refuses until you authenticate with the key named in that file's access rights.
What is the difference between a standard and a backup data file?
A backup data file adds a transaction mechanism: a write either completes fully or not at all. A standard data file has no such protection.