DESFire APDU Commands: Developer Guide
← Back to how to read MIFARE DESFire cards
What are DESFire APDU commands? MIFARE DESFire cards have their own native command set: one command byte, such as 60 for GetVersion or 5A for SelectApplication, followed by parameters. Through a PC/SC reader you normally send them wrapped in an ISO 7816-4 APDU: 90 [command] 00 00 [Lc] [data] 00. The card answers with data and a status word 91 xx, where 91 00 means success and 91 AF means another frame follows. DESFire cards also accept a small set of standard ISO 7816-4 commands with class 00, such as SELECT FILE and READ BINARY.
This page is a reference: every command code NXP has published, the framing options, the request and reply layouts that are public, the status codes and the differences between DESFire EV1, EV2 and EV3. Each row names its source. Where details are only in NXP's full DESFire data sheet, which NXP releases under a non-disclosure agreement (NDA), the page says so instead of guessing. For a worked, read-only example with ACS readers and C# code, see how to read MIFARE DESFire cards. BSD Infotech is an independent ACS supplier and integrator, not the manufacturer or NXP.
Reference from public documents; not yet tested by BSD. The codes and layouts below come from NXP's public documents and the ACS manuals, checked on 1 Dec 2026. BSD has not yet sent these commands to its own DESFire test cards; the planned checks are listed under what BSD still has to test.
Native vs ISO-Wrapped Framing
There are three ways to talk to a DESFire card through a PC/SC reader. The ACS manuals and NXP's public documents describe all three:
| Native | ISO-wrapped native | Standard ISO 7816-4 | |
|---|---|---|---|
| Command | [cmd] [params] | 90 [cmd] 00 00 [Lc] [params] 00 | 00 [INS] [P1] [P2] …, e.g. 00 A4 SELECT FILE |
| Reply | [status] [data], status first | [data] 91 [status] | [data] 90 00 or an ISO error such as 6A 82 |
| GetVersion example | 60, then AF, AF | 90 60 00 00 00, then 90 AF 00 00 00 twice | (no ISO equivalent) |
| More frames | Status AF; send AF | 91 AF; send 90 AF 00 00 00 | Per ISO 7816-4 |
| Byte order of parameters | Least significant byte first | Least significant byte first | Most significant byte first |
| When to use | Avoid on Windows (see below) | Applications on PC/SC readers | NFC Type 4 Tag (NDEF) reading, ISO-based systems |
Rules that matter in practice:
- The first command fixes the mode for that activation, native or wrapped (ACR122U manual, section 7.2).
- Windows Smart Card Plug and Play can send an APDU when a card arrives, which switches a DESFire card into ISO APDU mode, so native commands fail until the card is reset (ACR1552U Series Reference Manual, section 5.3.2). Wrapped commands avoid the problem.
- Le is always
00for wrapped commands, and the data field is limited to 255 bytes with short APDUs (DESFire Light data sheet, section 8.4). - In native mode the ACS reader adds
90 00only to replies shorter than two bytes, to meet the PC/SC minimum (ACR122U manual, section 7.2). Longer native replies arrive exactly as the card sent them. - The reader does not interpret DESFire commands. For an ISO 14443-4 card, ACS readers pack the APDU into the radio frame and answer
6A 81themselves if the card does not support ISO 14443-4 (ACR1552U manual, section 5.3.2). PC/SC Part 3 likewise says readers must not change APDUs for cards that understand them; the background is in our APDU guide. - MIFARE DESFire Light, a separate and simpler product, accepts native commands only in wrapped form (its data sheet, section 8.3).
DESFire Native Command Table
Command names, codes and the EV1/EV2/EV3 columns are from NXP's AN12752, table 2 (source A). Descriptions follow NXP's DESFire EV2 short data sheet, section 8 (source S). In wrapped form, the code goes in the INS byte after class 90. "Changes the card" marks commands that create, delete, write or reconfigure: never send them to a card you do not own. Parameter layouts not listed under public layouts are documented in NXP's data sheet available under NDA.
| Command | Code | EV1 / EV2 / EV3 | What it does | Changes the card? | Sources |
|---|---|---|---|---|---|
| Authentication (concept only; see authentication) | |||||
| Authenticate | 0A | Yes / Yes / Yes | Legacy authentication as on the original DESFire (D40); 2-key triple DES keys; D40 secure messaging | No | A, S, C |
| AuthenticateISO | 1A | Yes / Yes / Yes | Authentication as on EV1 for 2-key or 3-key triple DES keys; EV1 secure messaging | No | A, S |
| AuthenticateAES | AA | Yes / Yes / Yes | Authentication as on EV1 for AES keys; EV1 secure messaging | No | A, S |
| AuthenticateEV2First | 71 | No / Yes / Yes | AES authentication with EV2 secure messaging, first in a transaction | No | A, S, L |
| AuthenticateEV2NonFirst | 77 | No / Yes / Yes | Any later authentication in the same transaction | No | A, S, L |
| Card (PICC) memory and configuration | |||||
| GetVersion | 60 | Yes / Yes / Yes | Hardware, software and production data in three frames; no key needed | No | A, S, L, V, C |
| GetCardUID | 51 | Yes / Yes / Yes (with differences) | Returns the card's UID; its access conditions are in NXP's data sheet available under NDA | No | A, S |
| FreeMem | 6E | Yes / Yes / Yes | Free memory left on the card | No | A, S |
| Format | FC | Yes / Yes / Yes | At card level, deletes all applications and files | Yes, erases | A, S |
| SetConfiguration | 5C | Yes / Yes / Yes (with differences) | Configures the card: pre-personalises it with a key, chooses UID or random ID, sets the ATS | Yes | A, S |
| Key management | |||||
| GetKeySettings | 45 | Yes / Yes / Yes | Reads the card or application master key settings | No | A, S |
| ChangeKeySettings | 54 | Yes / Yes / Yes | Changes the master key settings | Yes | A, S |
| GetKeyVersion | 64 | Yes / Yes / Yes | Reads the version number of a key (not the key) | No | A, S, L |
| ChangeKey | C4 | Yes / Yes / Yes | Changes a key | Yes | A, S |
| ChangeKeyEV2 | C6 | No / Yes / Yes | Changes a key of the card or of one application key set | Yes | A, S |
| InitializeKeySet / FinalizeKeySet / RollKeySet | 56 / 57 / 55 | No / Yes / Yes | Prepare, finalise and switch to another application key set | Yes | A, S |
| Application management | |||||
| CreateApplication | CA | Yes / Yes / Yes (EV3: KeySett3 differences) | Creates an application; its keys start with the default application key | Yes | A, S, N |
| DeleteApplication | DA | Yes / Yes / Yes (with differences) | Permanently deactivates an application | Yes | A, S |
| CreateDelegatedApplication | C9 | No / Yes / Yes | Creates an application on behalf of a third party (delegated application management) | Yes | A, S |
| SelectApplication | 5A | Yes / Yes / Yes | Selects one application, or the card level with AID 00 00 00 | No | A, S, N |
| GetApplicationIDs | 6A | Yes / Yes / Yes | Lists the 3-byte AIDs of all applications | No | A, S, N |
| GetDFNames | 6D | No / Yes / Yes | Lists the ISO DF names of the applications | No | A, S |
| GetDelegatedInfo | 69 | No / Yes / Yes | Version and quota of a delegated-application slot | No | A, S |
| File management | |||||
| CreateStdDataFile / CreateBackupDataFile | CD / CB | Yes / Yes / Yes (EV3: FileOption differences) | Creates a data file, without or with the backup mechanism | Yes | A, S, N |
| CreateValueFile | CC | Yes / Yes / Yes (EV3: FileOption differences) | Creates a file holding a 32-bit signed value | Yes | A, S |
| CreateLinearRecordFile / CreateCyclicRecordFile | C1 / C0 | Yes / Yes / Yes | Creates a record file that fills up, or one that overwrites its oldest record | Yes | A, S |
| CreateTransactionMACFile | CE | No / Yes / Yes | Creates a Transaction MAC file and enables that feature for the application | Yes | A, S, L |
| DeleteFile | DF | Yes / Yes / Yes | Permanently deactivates a file | Yes | A, S |
| GetFileIDs | 6F | Yes / Yes / Yes | Lists the file numbers of the selected application | No | A, S, L |
| GetISOFileIDs | 61 | Yes / Yes / Yes | Lists the ISO file IDs | No | A, S, L |
| GetFileSettings | F5 | Yes / Yes / Yes (EV3: response differences) | File type, communication mode, access rights and size of one file | No | A, S, L |
| GetFileCounters | F6 | Yes / No / Yes (AN12752 marks it new on EV3) | Reads file counters (details under NDA) | No | A |
| ChangeFileSettings | 5F | Yes / Yes / Yes (with differences) | Changes the access rights and options of a file | Yes | A, S, L |
| Data management | |||||
| ReadData | BD / AD | Yes / Yes / Yes | Reads from a standard or backup data file. AN12752 lists both codes; the public DESFire Light data sheet documents AD | No | A, S, L |
| WriteData | 3D / 8D | Yes / Yes / Yes | Writes to a standard or backup data file | Yes | A, S, N |
| GetValue | 6C | Yes / Yes / Yes | Reads the value of a value file | No | A, S, L |
| Credit / Debit / LimitedCredit | 0C / DC / 1C | Yes / Yes / Yes | Increases or decreases a value; LimitedCredit allows a limited increase without full Credit rights | Yes | A, S |
| ReadRecords | BB / AB | Yes / Yes / Yes | Reads complete records from a record file | No | A, S, L |
| WriteRecord / UpdateRecord | 3B / 8B; DB / BA | Yes / Yes / Yes (see note) | Adds a record, or changes an existing one | Yes | A, S |
| ClearRecordFile | EB | Yes / Yes / Yes | Resets a record file to empty | Yes | A, S |
| Transactions | |||||
| CommitTransaction / AbortTransaction | C7 / A7 | Yes / Yes / Yes | Validates or cancels all pending writes to backup, value and record files of the application | Yes (Commit) | A, S |
| CommitReaderID | C8 | No / Yes / Yes | Records a reader ID for the ongoing transaction | Yes | A, S |
| Proximity check, originality and frames | |||||
| PreparePC / ProximityCheck / VerifyPC | F0 / F2 / FD | No / Yes / Yes | The proximity check against relay attacks | No | A, S |
| Read_Sig | 3C | – / Yes / Yes | Reads NXP's originality signature | No | A, L |
| Additional frame | AF | All | Asks for the next frame after status AF / 91 AF | No | C, L |
Notes. Where two codes are given for one command (for example ReadData BD / AD), both are listed by NXP in AN12752; when to use which is documented in NXP's data sheet available under NDA. AN12752 marks UpdateRecord as supported on EV1, while the evolution figure in NXP's EV2 short data sheet lists it among the EV2 additions; check NXP's data sheet if you depend on it. "with differences" means AN12752 lists behaviour changes on EV3. Read_Sig has no EV1 entry in AN12752.
Standard ISO 7816-4 Commands on DESFire
DESFire EV1 and later also support these ISO 7816-4 instructions with class 00 (NXP's EV2 short data sheet, section 2.1.6, and AN12752). They work on applications and files that were created with ISO file identifiers or DF names. NFC Forum Type 4 Tag readers use ISOSelectFile and ISOReadBinary to read the NDEF message on a DESFire card (NXP AN11004).
| Command | INS | What it does | Changes the card? | Sources |
|---|---|---|---|---|
| ISOSelectFile | A4 | Selects the card level, an application (by ISO file ID or DF name) or a file | No | S, A, L |
| ISOReadBinary | B0 | Reads a standard or backup data file | No | S, A, L |
| ISOUpdateBinary | D6 | Writes a standard or backup data file | Yes | S, A, L |
| ISOReadRecord | B2 | Reads from a record file | No | S, A |
| ISOAppendRecord | E2 | Adds a record | Yes | S, A |
| ISOGetChallenge / ISOExternalAuthenticate / ISOInternalAuthenticate | 84 / 82 / 88 | ISO 7816-4 style authentication (concept: see authentication) | No | S, A |
These commands answer with ISO status words (90 00, 6A 82 and so on, see status codes), not 91 xx. The general ISO 7816-4 command structure is explained in our APDU guide.
Request and Reply Layouts That NXP Publishes
These layouts are in NXP's public documents. All multi-byte native parameters are least significant byte first (DESFire Light data sheet, section 8.3). All are shown wrapped. Layouts of the other commands are in NXP's data sheet available under NDA.
| Command | Wrapped request | Reply data | Sources |
|---|---|---|---|
| GetVersion | 90 60 00 00 00, then 90 AF 00 00 00 twice | Frame 1, hardware: vendor (04 = NXP), type, subtype, major version, minor version, storage size, protocol. Frame 2, software: the same seven fields. Frame 3: UID (7 bytes), batch number, production week and year. | L (section 11.5.2), V, C |
| SelectApplication | 90 5A 00 00 03 [AID, 3 bytes] 00; card level: 90 5A 00 00 03 00 00 00 00 | None; 91 00 | N (section 8.1) |
| GetFileIDs | 90 6F 00 00 00 | One byte per file number | L (section 11.7.3) |
| GetFileSettings | 90 F5 00 00 01 [file] 00 | Standard data file: file type (00), file option (bits 1-0 = communication mode), access rights (2 bytes), file size (3 bytes). Other file types have other fields. | L (section 11.7.2) |
| ReadData | 90 [BD or AD] 00 00 07 [file] [offset, 3 bytes] [length, 3 bytes] 00 | The data. Length 00 00 00 = to the end of the file. | L (section 11.8.1, AD), A |
Decoding GetVersion
NXP's AN10833 reads the first frame like this: the second byte's lower half is the product family (1 = MIFARE DESFire, 8 = MIFARE DESFire Light). The fourth byte's lower half is the generation (1 = EV1, 2 = EV2, 3 = EV3). The sixth byte is the storage size: 16 = 2 KB, 18 = 4 KB, 1A = 8 KB, 1C = 16 KB, 1E = 32 KB. Our DESFire reading guide puts this into a detection step.
Decoding access rights and communication mode
The two access-right bytes hold four 4-bit conditions: Read (bits 15-12), Write (11-8), Read&Write (7-4) and Change (3-0). Each is a key number, E = free access or F = no access (DESFire Light data sheet, section 8.2.3.5; the same coding appears in AN11004). Because the bytes come least significant first, E0 EE on the wire means Read E, Write E, Read&Write E, Change key 0. The communication mode bits mean plain (x0), MAC (01) or full encryption (11).
DESFire Status Codes
In wrapped mode the card's status byte follows 91. In native mode the same byte is the first byte of the reply. Names and meanings are from the public DESFire Light data sheet, table 20 and the per-command tables (source L), which NXP shares with the DESFire family; 91 AF and 91 00 also appear in the ACS manuals (source C).
| Status word | NXP name | Meaning | What to check |
|---|---|---|---|
91 00 | OPERATION_OK | Successful operation | – |
91 AF | ADDITIONAL_FRAME | Another data frame is expected | Send 90 AF 00 00 00 (or your next data frame) and join the parts |
91 AE | AUTHENTICATION_ERROR | The current authentication state does not allow the command | The step needs a key; authenticate with the key named in the access rights |
91 9D | PERMISSION_DENIED | The current configuration or state does not allow the command | For example, a file command while the card level is selected, or an access right set to "never" |
91 F0 | FILE_NOT_FOUND | The file number does not exist | List the files with GetFileIDs |
91 40 | NO_SUCH_KEY | Invalid key number | Key numbers depend on how many keys the application has |
91 7E | LENGTH_ERROR | Length of the command is not valid | Check Lc and the parameter count |
91 9E | PARAMETER_ERROR | Parameter value not valid | Check byte order (LSB first) and ranges |
91 BE | BOUNDARY_ERROR | Read or write beyond the file or record limits, or beyond a value file's limits | Read the size with GetFileSettings |
91 1C | ILLEGAL_COMMAND_CODE | Command code not supported | The card generation may not have this command (see the table above) |
91 CA | COMMAND_ABORTED | The previous command was not fully completed: not all frames were requested or sent | Finish every 91 AF chain before the next command |
91 1E | INTEGRITY_ERROR | CRC or MAC does not match; padding not valid | Secure messaging problem in your code |
91 DE | DUPLICATE_ERROR | A file or application with that number already exists | Creation commands only |
91 0C | NO_CHANGES | No changes to backup files; commit or abort not needed | Transactions |
91 AD | AUTHENTICATION_DELAY | Authentication not allowed yet; keep trying until the delay has passed | Listed in the DESFire Light data sheet |
91 EE | MEMORY_ERROR | Failure reading or writing non-volatile memory | Retry; if it persists the card may be faulty |
Selecting an application that does not exist also returns a 91 xx error. That code is not in the public DESFire Light data sheet (DESFire Light has a single application); it is documented in NXP's DESFire data sheet available under NDA.
ISO status words (class 00 commands) and reader replies
| Status word | Meaning | Source |
|---|---|---|
90 00 | Success | ISO 7816-4 |
62 83 | Selected file or application deactivated (limited functionality) | L, table 21 |
67 00 | Wrong length | L, table 21 |
69 82 | Security status not satisfied | L, table 21 |
69 85 | Conditions of use not satisfied | L, table 21 |
6A 80 | Incorrect parameters in the data field | L, table 21 |
6A 82 | File or application not found | L, table 21; A, table 9 |
6A 81 | Sent by the ACS reader, not the card: the card does not support ISO 14443-4 | R |
The general ISO status word table and the PC/SC return codes (0x8010…, which come from Windows before any status word) are in our APDU status word guide.
DESFire EV1, EV2 and EV3 Differences
Each generation keeps the earlier commands. NXP says a DESFire EV2 works as an EV1 in its default delivery configuration, and an EV3 as an EV1 or EV2; new features need activation or new commands (EV2 short data sheet, section 1.2; AN12753). At the level NXP publishes:
| Feature | EV1 | EV2 | EV3 |
|---|---|---|---|
| Cryptography | DES, 2-key and 3-key triple DES, AES-128 | As EV1 | As EV1 |
| Secure messaging | D40 native and EV1 | D40, EV1 and EV2 (AES) | As EV2 |
| Applications per card | 28 | No fixed limit (memory only) | As EV2 |
| Files per application | 32 | 32 | 32 |
| User memory sizes | 2, 4, 8 KB | 2, 4, 8, 16 KB (the EV2 short data sheet also lists 32 KB) | 2, 4, 8, 16 KB |
| Random ID, configurable ATS | Yes (ATS: historical bytes only) | Yes | Yes |
| Multiple key sets, key rolling | No (one key set) | Yes (up to 16 key sets) | Yes |
| Delegated application management | No | Yes | Yes, plus deletion with a DAMMAC and NXP's AppXplorer keys |
| Transaction MAC, virtual card, proximity check, originality check | No | Yes | Yes |
| Transaction Timer, Secure Dynamic Messaging | No | No | Yes |
| Data frame size | Communication buffer 64 bytes | Up to 128 bytes (2/4/8 KB) or 256 bytes (16/32 KB) | Up to 256 bytes for several commands |
| GetVersion generation nibble (AN10833) | 1 | 2 | 3 |
Sources: NXP EV2 short data sheet rev. 3.2 (figure 1 and table 1), AN12752 rev. 1.4 (tables 1 to 4), AN12753 rev. 1.2 (section 2.3), AN10833 rev. 3.9. Security certification levels and exact memory per product type are on NXP's product pages. The original DESFire (D40, MF3ICD40) is the generation before EV1. MIFARE DESFire Light (GetVersion type 08) is a separate product with one fixed application, five keys and its own public data sheet.
Authentication Commands, Explained Conceptually
Every DESFire command that touches protected data needs an authentication first. The commands are named in the table above: 0A (legacy), 1A (ISO, triple DES), AA (AES), and on EV2 and EV3 71 and 77, plus the ISO 7816-4 trio 84, 82, 88. They differ in the key type and in the secure messaging that follows, not in purpose. This page explains what they do, not how to compute them.
- Mutual three-pass authentication. NXP's term. The reader and the card exchange random challenges in three steps, so that each proves it knows the same key without the key ever crossing the air. In wrapped form the card answers the first step with
91 AF, The ACS manuals' first DESFire example,90 0A 00 00 01 00 00, shows this: ACS describes the 8 bytes it returns, with91 AF, as a random number, which is the card's first challenge. - Which key. The command names a key number: 0 is the master key of the selected level (card or application), the others are application keys. The file's access rights say which key number each operation needs.
- What it creates. A successful authentication creates session keys. From then on, data travels plain, with a MAC, or encrypted, as the file's communication mode requires.
- First and non-first (EV2, EV3). AuthenticateEV2First starts a transaction with EV2 secure messaging; AuthenticateEV2NonFirst is for later authentications in the same transaction.
- Failure. A wrong key gives
91 AE. The DESFire Light data sheet also defines91 AD, a delay before another attempt is accepted. - Keys in a SAM. NXP's AN12696 (public) shows DESFire authentication and key changes carried out with a MIFARE SAM AV3, so the reader software never holds the key. The ACR1252U manual (section 5.3.1) documents ACS's own ACOS6-SAM commands for DESFire session keys. BSD has not tested a SAM.
Factory default keys
NXP documents publicly that the five keys of MIFARE DESFire Light leave the factory with a transport value of 16 bytes of 00 (DESFire Light data sheet, section 8.2.4). For MIFARE DESFire EV1, EV2 and EV3, BSD could not find the delivery key value in any document NXP marks as public: it is documented in NXP's data sheet available under NDA, and NXP's community support, asked about the EV3 default card key, referred the question to NDA documentation. This page therefore does not state it. Whatever the value, delivery keys are known to everyone, so a card in a real system must have its own keys. How to plan, diversify and store them is in our key management guide.
Using These Commands Safely
- Use your own test cards. Never send commands to a card from a live access, transport, canteen or payment system.
- Start read-only. GetVersion, GetApplicationIDs, SelectApplication, GetFileIDs, GetFileSettings and ReadData on free files change nothing. Our read sequence and APDU test plan use only these.
- Commands marked "changes the card" can be permanent. Format erases everything; a changed key you lose cannot be recovered; changed key settings can block further changes. Plan them on paper and test them on spare cards.
- No key recovery. BSD does not help anyone read a card without the owner's keys. If you have lost your own keys, ask the card issuer or replace the cards.
What BSD Still Has to Test
Read-only checks on BSD's own DESFire test cards, on the ACR1252U, ACR1552U and ACR122U, with no key used:
- GetVersion wrapped and native (after lifting and re-presenting the card), to confirm the mode rule and the Windows Plug and Play effect.
- The generation nibble and storage byte on each of BSD's DESFire cards, compared with what is printed on the card's packaging.
- The status words for an unknown file (
91 F0), a read beyond the file end (91 BE), an unknown command code (91 1C) and selecting an AID that does not exist. - ReadData with
BDand withADon a free-read file, recording both replies per card generation.
Sources
Checked on 1 Dec 2026. Only NXP documents marked "Company Public" and the ACS manuals were used. The letters match the Sources columns above. Explanations are in BSD's own words.
- A: NXP, AN12752 rev. 1.4 (24 July 2023), MIFARE DESFire EV3 feature and functionality comparison to other MIFARE DESFire products
- S: NXP, MF3D(H)x2 MIFARE DESFire EV2 product short data sheet rev. 3.2 (12 June 2019)
- L: NXP, MF2DL(H)x0 MIFARE DESFire Light product data sheet rev. 3.3 (5 April 2019)
- N: NXP, AN11004 rev. 2.4 (22 May 2013), MIFARE DESFire as Type 4 Tag
- V: NXP, AN10833 rev. 3.9 (15 Dec 2025), MIFARE type identification procedure
- NXP, AN12753 rev. 1.2 (30 Sept 2020), MIFARE DESFire EV3 quick start guide; and AN12696 rev. 1.3 (14 July 2020), MIFARE SAM AV3 for MIFARE DESFire
- C: ACS, ACR122U Application Programming Interface, version 2.04, section 7.2 (wrapped and native DESFire examples, frame chaining, mode rule)
- R: ACS, ACR1552U Series Reference Manual, version 1.05, section 5.3.2 (pass-through,
6A 81, Windows Plug and Play); ACR1252U Application Programming Interface, version 1.17, section 5.3.1 (ACOS6-SAM commands), listed on the ACR1252U product page
BSD Infotech is an independent ACS supplier and integrator, not the manufacturer. ACS, the ACS logo and ACS product names belong to Advanced Card Systems Ltd. MIFARE, MIFARE DESFire and MIFARE Classic are trademarks of NXP B.V. Windows is a trademark of Microsoft Corporation.
