Ambimat GroupAmbimatAmbiSecureeSIM InitiativeEngineering BlogAhmedabad · India · Est. 1981
Technology · Smart cards

MIFARE DESFire — EV1, EV2, EV3.

DESFire is the contactless smart-card platform that powers most of the world’s closed-loop transit, building access, and stored-value applications. It is also one of the most misunderstood platforms in the field. Here is what each generation actually changed, where the architectural lines are drawn, and how authentication is meant to be designed — not how to break it.

Where DESFire fits

DESFire is an ISO/IEC 14443 Type A smart card with a proprietary application-layer command set. Where ISO 7816-4 gives you SELECT / READ BINARY / GET DATA, DESFire gives you a richer model: applications identified by AID, each containing files (Standard Data, Backup Data, Value, Linear Record, Cyclic Record), with per-file access rights referencing keys held inside the card. It is designed for transactional workloads — tap, debit, commit — under hard latency budgets at gates and validators.

For openness with telecom-grade ticketing, DESFire is paired with a Secure Access Module (SAM) in the reader so that issuer-level keys never sit in the validator firmware. The combined trust chain is documented at Card ↔ Reader ↔ SAM.

The three generations, side by side

EV1EV2EV3
Released~2008~2016~2020
Crypto suites3DES · 3K3DES · AES-128AES-128 (default), legacy 3DES carried for back-compatAES-128, with hardened side-channel countermeasures
AuthenticationNative, ISO, AES variants. Two-pass challenge / response with random A and random B.EV2 Secure Messaging (CMAC + AES-CBC). Transaction MAC (TMAC). Multi-key authentication for read & write separately.Same EV2-class secure messaging; refined countermeasures, broader command-level integrity.
Secure messagingOptional plain / MACed / fully enciphered modes per command.EV2-SM: per-session keys, command counter, integrated CMAC. Default for new deployments.EV2-SM · latency optimisations.
Transaction integrityPer-file commit / abort. Backup files for atomic update.+ Transaction MAC (TMAC) per commit. Issuer can verify transaction authenticity offline.+ Transaction Timer for replay-window control.
Key diversificationApplication-level key (one per slot).+ recommended diversified keys per UID.+ recommended diversified per UID with hardware-backed derivation in the SAM.
Capacity2 / 4 / 8 KB EEPROM2 / 4 / 8 KB2 / 4 / 8 KB; some variants higher.

All three generations remain in deployed production fleets. Practical migrations involve EV3 cards personalised in EV2 mode for back-compat with installed validator estates, with EV3-only features unlocked as the validator firmware and SAM stack catches up.

Application & file model

DESFire application and file model DESFIRE CARD PICC master key (slot 0) APPLICATION · AID 0x000001 App-master key Standard Data File 0 — keys 0/1 Value File 1 — debit/credit Cyclic Record File 2 — last 10 trips APPLICATION · AID 0x000002 App-master key Standard Data File 0 — profile Linear Record File 1 — audit log APPLICATION · AID 0x00000B App-master key Backup Data File 0 — atomic state
A DESFire card holds many independent applications; each application has its own file set and key set.

Authentication, in concept

Authentication on DESFire is a three-pass mutual challenge / response. The card and the reader (or SAM, in a closed-loop deployment) prove to each other that they share the application key, without ever transmitting the key itself. The session that follows is protected by per-session keys derived from random nonces both sides contributed.

The flow is shown at the conceptual level below. Real APDU values, byte-level encryption details, and exploitable nuances are deliberately not reproduced here — we educate engineers on the architecture, not on attack tooling.

DESFire EV2 mutual authentication — conceptual flow CARD READER · SAM 1. SELECT APPLICATION (AID) scopes the key set used for the rest of the session 2. AUTHENTICATE_EV2_FIRST(keyNo) reader picks which application key to authenticate against 3. card -> rndB (encrypted with K) card emits its random nonce, encrypted under the key 4. reader -> Enc(K, rndA || rndB') reader proves it has K by returning rndB' correctly + its own rndA 5. card -> Enc(K, rndA') card proves it has K by returning rndA' correctly SESSION KEYS DERIVED FROM (rndA, rndB) + COUNTER
EV2 mutual authentication, concept-level. EV1 is similar; EV3 hardens the same shape.

Secure messaging modes

After authentication, every command and response is wrapped in a Secure Messaging mode chosen per file:

  • Plain. No protection. Used only for non-sensitive data on isolated systems.
  • MACed. Integrity-protected with a CMAC. Useful when the data is not secret but must not be tampered with on the wire.
  • Fully enciphered. AES-CBC of the payload, with a CMAC for integrity, under per-session keys derived from the authentication. The default for closed-loop production.

EV2 and EV3 add a command counter that increments per APDU and is bound into the CMAC. A replay of a captured APDU is detected because its counter no longer matches the current session position.

Designing a DESFire deployment?

We have shipped DESFire-based access and ticketing systems for transit, enterprise access, and stored-value. Talk to engineers, not BDRs.

Talk to engineers