DESFire APDU Commands: Developer Guide

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.

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:

NativeISO-wrapped nativeStandard ISO 7816-4
Command[cmd] [params]90 [cmd] 00 00 [Lc] [params] 0000 [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 example60, then AF, AF90 60 00 00 00, then 90 AF 00 00 00 twice(no ISO equivalent)
More framesStatus AF; send AF91 AF; send 90 AF 00 00 00Per ISO 7816-4
Byte order of parametersLeast significant byte firstLeast significant byte firstMost significant byte first
When to useAvoid on Windows (see below)Applications on PC/SC readersNFC 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 00 for 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 00 only 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 81 themselves 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).

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.

CommandCodeEV1 / EV2 / EV3What it doesChanges the card?Sources
Authentication (concept only; see authentication)
Authenticate0AYes / Yes / YesLegacy authentication as on the original DESFire (D40); 2-key triple DES keys; D40 secure messagingNoA, S, C
AuthenticateISO1AYes / Yes / YesAuthentication as on EV1 for 2-key or 3-key triple DES keys; EV1 secure messagingNoA, S
AuthenticateAESAAYes / Yes / YesAuthentication as on EV1 for AES keys; EV1 secure messagingNoA, S
AuthenticateEV2First71No / Yes / YesAES authentication with EV2 secure messaging, first in a transactionNoA, S, L
AuthenticateEV2NonFirst77No / Yes / YesAny later authentication in the same transactionNoA, S, L
Card (PICC) memory and configuration
GetVersion60Yes / Yes / YesHardware, software and production data in three frames; no key neededNoA, S, L, V, C
GetCardUID51Yes / Yes / Yes (with differences)Returns the card's UID; its access conditions are in NXP's data sheet available under NDANoA, S
FreeMem6EYes / Yes / YesFree memory left on the cardNoA, S
FormatFCYes / Yes / YesAt card level, deletes all applications and filesYes, erasesA, S
SetConfiguration5CYes / Yes / Yes (with differences)Configures the card: pre-personalises it with a key, chooses UID or random ID, sets the ATSYesA, S
Key management
GetKeySettings45Yes / Yes / YesReads the card or application master key settingsNoA, S
ChangeKeySettings54Yes / Yes / YesChanges the master key settingsYesA, S
GetKeyVersion64Yes / Yes / YesReads the version number of a key (not the key)NoA, S, L
ChangeKeyC4Yes / Yes / YesChanges a keyYesA, S
ChangeKeyEV2C6No / Yes / YesChanges a key of the card or of one application key setYesA, S
InitializeKeySet / FinalizeKeySet / RollKeySet56 / 57 / 55No / Yes / YesPrepare, finalise and switch to another application key setYesA, S
Application management
CreateApplicationCAYes / Yes / Yes (EV3: KeySett3 differences)Creates an application; its keys start with the default application keyYesA, S, N
DeleteApplicationDAYes / Yes / Yes (with differences)Permanently deactivates an applicationYesA, S
CreateDelegatedApplicationC9No / Yes / YesCreates an application on behalf of a third party (delegated application management)YesA, S
SelectApplication5AYes / Yes / YesSelects one application, or the card level with AID 00 00 00NoA, S, N
GetApplicationIDs6AYes / Yes / YesLists the 3-byte AIDs of all applicationsNoA, S, N
GetDFNames6DNo / Yes / YesLists the ISO DF names of the applicationsNoA, S
GetDelegatedInfo69No / Yes / YesVersion and quota of a delegated-application slotNoA, S
File management
CreateStdDataFile / CreateBackupDataFileCD / CBYes / Yes / Yes (EV3: FileOption differences)Creates a data file, without or with the backup mechanismYesA, S, N
CreateValueFileCCYes / Yes / Yes (EV3: FileOption differences)Creates a file holding a 32-bit signed valueYesA, S
CreateLinearRecordFile / CreateCyclicRecordFileC1 / C0Yes / Yes / YesCreates a record file that fills up, or one that overwrites its oldest recordYesA, S
CreateTransactionMACFileCENo / Yes / YesCreates a Transaction MAC file and enables that feature for the applicationYesA, S, L
DeleteFileDFYes / Yes / YesPermanently deactivates a fileYesA, S
GetFileIDs6FYes / Yes / YesLists the file numbers of the selected applicationNoA, S, L
GetISOFileIDs61Yes / Yes / YesLists the ISO file IDsNoA, S, L
GetFileSettingsF5Yes / Yes / Yes (EV3: response differences)File type, communication mode, access rights and size of one fileNoA, S, L
GetFileCountersF6Yes / No / Yes (AN12752 marks it new on EV3)Reads file counters (details under NDA)NoA
ChangeFileSettings5FYes / Yes / Yes (with differences)Changes the access rights and options of a fileYesA, S, L
Data management
ReadDataBD / ADYes / Yes / YesReads from a standard or backup data file. AN12752 lists both codes; the public DESFire Light data sheet documents ADNoA, S, L
WriteData3D / 8DYes / Yes / YesWrites to a standard or backup data fileYesA, S, N
GetValue6CYes / Yes / YesReads the value of a value fileNoA, S, L
Credit / Debit / LimitedCredit0C / DC / 1CYes / Yes / YesIncreases or decreases a value; LimitedCredit allows a limited increase without full Credit rightsYesA, S
ReadRecordsBB / ABYes / Yes / YesReads complete records from a record fileNoA, S, L
WriteRecord / UpdateRecord3B / 8B; DB / BAYes / Yes / Yes (see note)Adds a record, or changes an existing oneYesA, S
ClearRecordFileEBYes / Yes / YesResets a record file to emptyYesA, S
Transactions
CommitTransaction / AbortTransactionC7 / A7Yes / Yes / YesValidates or cancels all pending writes to backup, value and record files of the applicationYes (Commit)A, S
CommitReaderIDC8No / Yes / YesRecords a reader ID for the ongoing transactionYesA, S
Proximity check, originality and frames
PreparePC / ProximityCheck / VerifyPCF0 / F2 / FDNo / Yes / YesThe proximity check against relay attacksNoA, S
Read_Sig3C– / Yes / YesReads NXP's originality signatureNoA, L
Additional frameAFAllAsks for the next frame after status AF / 91 AFNoC, 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.

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).

CommandINSWhat it doesChanges the card?Sources
ISOSelectFileA4Selects the card level, an application (by ISO file ID or DF name) or a fileNoS, A, L
ISOReadBinaryB0Reads a standard or backup data fileNoS, A, L
ISOUpdateBinaryD6Writes a standard or backup data fileYesS, A, L
ISOReadRecordB2Reads from a record fileNoS, A
ISOAppendRecordE2Adds a recordYesS, A
ISOGetChallenge / ISOExternalAuthenticate / ISOInternalAuthenticate84 / 82 / 88ISO 7816-4 style authentication (concept: see authentication)NoS, 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.

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.

CommandWrapped requestReply dataSources
GetVersion90 60 00 00 00, then 90 AF 00 00 00 twiceFrame 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
SelectApplication90 5A 00 00 03 [AID, 3 bytes] 00; card level: 90 5A 00 00 03 00 00 00 00None; 91 00N (section 8.1)
GetFileIDs90 6F 00 00 00One byte per file numberL (section 11.7.3)
GetFileSettings90 F5 00 00 01 [file] 00Standard 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)
ReadData90 [BD or AD] 00 00 07 [file] [offset, 3 bytes] [length, 3 bytes] 00The 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).

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 wordNXP nameMeaningWhat to check
91 00OPERATION_OKSuccessful operation–
91 AFADDITIONAL_FRAMEAnother data frame is expectedSend 90 AF 00 00 00 (or your next data frame) and join the parts
91 AEAUTHENTICATION_ERRORThe current authentication state does not allow the commandThe step needs a key; authenticate with the key named in the access rights
91 9DPERMISSION_DENIEDThe current configuration or state does not allow the commandFor example, a file command while the card level is selected, or an access right set to "never"
91 F0FILE_NOT_FOUNDThe file number does not existList the files with GetFileIDs
91 40NO_SUCH_KEYInvalid key numberKey numbers depend on how many keys the application has
91 7ELENGTH_ERRORLength of the command is not validCheck Lc and the parameter count
91 9EPARAMETER_ERRORParameter value not validCheck byte order (LSB first) and ranges
91 BEBOUNDARY_ERRORRead or write beyond the file or record limits, or beyond a value file's limitsRead the size with GetFileSettings
91 1CILLEGAL_COMMAND_CODECommand code not supportedThe card generation may not have this command (see the table above)
91 CACOMMAND_ABORTEDThe previous command was not fully completed: not all frames were requested or sentFinish every 91 AF chain before the next command
91 1EINTEGRITY_ERRORCRC or MAC does not match; padding not validSecure messaging problem in your code
91 DEDUPLICATE_ERRORA file or application with that number already existsCreation commands only
91 0CNO_CHANGESNo changes to backup files; commit or abort not neededTransactions
91 ADAUTHENTICATION_DELAYAuthentication not allowed yet; keep trying until the delay has passedListed in the DESFire Light data sheet
91 EEMEMORY_ERRORFailure reading or writing non-volatile memoryRetry; 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 wordMeaningSource
90 00SuccessISO 7816-4
62 83Selected file or application deactivated (limited functionality)L, table 21
67 00Wrong lengthL, table 21
69 82Security status not satisfiedL, table 21
69 85Conditions of use not satisfiedL, table 21
6A 80Incorrect parameters in the data fieldL, table 21
6A 82File or application not foundL, table 21; A, table 9
6A 81Sent by the ACS reader, not the card: the card does not support ISO 14443-4R

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.

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:

FeatureEV1EV2EV3
CryptographyDES, 2-key and 3-key triple DES, AES-128As EV1As EV1
Secure messagingD40 native and EV1D40, EV1 and EV2 (AES)As EV2
Applications per card28No fixed limit (memory only)As EV2
Files per application323232
User memory sizes2, 4, 8 KB2, 4, 8, 16 KB (the EV2 short data sheet also lists 32 KB)2, 4, 8, 16 KB
Random ID, configurable ATSYes (ATS: historical bytes only)YesYes
Multiple key sets, key rollingNo (one key set)Yes (up to 16 key sets)Yes
Delegated application managementNoYesYes, plus deletion with a DAMMAC and NXP's AppXplorer keys
Transaction MAC, virtual card, proximity check, originality checkNoYesYes
Transaction Timer, Secure Dynamic MessagingNoNoYes
Data frame sizeCommunication buffer 64 bytesUp to 128 bytes (2/4/8 KB) or 256 bytes (16/32 KB)Up to 256 bytes for several commands
GetVersion generation nibble (AN10833)123

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.

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, with 91 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 defines 91 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.

  • 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.

Read-only checks on BSD's own DESFire test cards, on the ACR1252U, ACR1552U and ACR122U, with no key used:

  1. GetVersion wrapped and native (after lifting and re-presenting the card), to confirm the mode rule and the Windows Plug and Play effect.
  2. The generation nibble and storage byte on each of BSD's DESFire cards, compared with what is printed on the card's packaging.
  3. 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.
  4. ReadData with BD and with AD on a free-read file, recording both replies per card generation.

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.

Building a DESFire application?

Tell us the card generation, the reader and what the cards must hold. We design and build DESFire software for ACS readers, from provisioning to everyday reading.