M075031 Desfire
M075031 Desfire
M075031 Desfire
mifare DESFire
Contactless Multi-Application IC
with DES and 3DES Security
MF3 IC D40
Product Specification
Revision 3.1
CONFIDENTIAL
Philips
Semiconductors
April 2004
Philips Semiconductors
Functional Specification
CONTENTS
1
FEATURES..................................................................................................................................... 5
1.1
1.2
1.3
1.4
1.5
Security........................................................................................................................................... 6
2.1
2.2
2.3
Anticollision..................................................................................................................................... 8
2.4
2.5
2.6
Security Concept............................................................................................................................. 9
2.7
(3)DES-Encryption ........................................................................................................................ 12
2.8
MACing......................................................................................................................................... 14
MF3 IC D40 CODING OF SECURITY-, APPLICATION- AND FILE- RELATED FEATURES ....... 15
3.1
3.2
3.3
3.4
3.5
3.6
3.7
3.8
3.9
3.10
3.11
3.12
Selection of native DESFire APDU Framing versus ISO 7816-4 framing and commands ............... 22
3.13
3.14
4.1
4.1.1
4.1.2
CONFIDENTIAL
Philips Semiconductors
Functional Specification
4.1.3
4.1.4
4.2
4.2.1
4.2.2
4.2.3
4.3
4.3.1
Authenticate .................................................................................................................................. 31
4.3.2
ChangeKeySettings....................................................................................................................... 33
4.3.3
GetKeySettings ............................................................................................................................. 36
4.3.4
ChangeKey ................................................................................................................................... 37
4.3.5
GetKeyVersion.............................................................................................................................. 39
4.4
4.4.1
CreateApplication.......................................................................................................................... 40
4.4.2
DeleteApplication .......................................................................................................................... 41
4.4.3
GetApplicationIDs.......................................................................................................................... 42
4.4.4
SelectApplication........................................................................................................................... 43
4.4.5
FormatPICC .................................................................................................................................. 44
4.4.6
GetVersion.................................................................................................................................... 45
4.5
4.5.1
GetFileIDs..................................................................................................................................... 47
4.5.2
GetFileSettings.............................................................................................................................. 48
4.5.3
ChangeFileSettings ....................................................................................................................... 50
4.5.4
CreateStdDataFile......................................................................................................................... 51
4.5.5
CreateBackupDataFile .................................................................................................................. 52
4.5.6
CreateValueFile ............................................................................................................................ 53
4.5.7
CreateLinearRecordFile ................................................................................................................ 54
4.5.8
CreateCyclicRecordFile................................................................................................................. 55
4.5.9
DeleteFile...................................................................................................................................... 56
4.6
4.6.1
ReadData...................................................................................................................................... 57
4.6.2
WriteData...................................................................................................................................... 59
4.6.3
GetValue....................................................................................................................................... 61
4.6.4
Credit ............................................................................................................................................ 62
4.6.5
Debit ............................................................................................................................................. 63
4.6.6
LimitedCredit................................................................................................................................. 64
CONFIDENTIAL
Philips Semiconductors
Functional Specification
4.6.7
WriteRecord .................................................................................................................................. 65
4.6.8
ReadRecords ................................................................................................................................ 67
4.6.9
ClearRecordFile ............................................................................................................................ 69
4.7.1
4.7.2
4.7.3
4.7.4
4.7.5
DEFINITIONS ............................................................................................................................... 78
Contact Information.................................................................................................................................... 80
CONFIDENTIAL
Philips Semiconductors
Functional Specification
1 FEATURES
1.1 RF Interface: ISO 14443 Type A
Contactless transmission of data and powered by the RF-field (no battery needed)
High data integrity: 16 Bit CRC, parity, bit coding, bit counting
1.2 ISO/IEC 7816 compatibility (only Software Version 0.6 and higher)
4 kbyte NV-Memory
CONFIDENTIAL
Philips Semiconductors
Functional Specification
1.5 Security
Hardware DES/3DES Data encryption on RF-channel with replay attack protection using 56/112 bit Keys
featuring key versioning
CONFIDENTIAL
Philips Semiconductors
Functional Specification
2 GENERAL DESCRIPTION
Philips has developed the MIFARE DESFire (MF3 IC D40) to be used with Proximity Coupling Devices
(PCDs) according to ISO14443 Type A. The communication protocol complies to part ISO 14443-4. The
MF3 IC D40 is primarily designed for secure contactless transport applications and related loyalty programs.
In addition to ISO 14443 DESFire also support the use of ISO 7816-3 compliant APDU message structure.
In the MIFARE system, the MF3 IC D40 is connected to a coil consisting of a few turns embedded in a
standard ISO smart card. No battery is needed. When the card is positioned in the proximity of the PCD
antenna, the high speed RF communication interface allows to transmit data with up to 424 kbit/s.
Energy
contacts La , Lb
Data
ISO 14443A PCD
CONFIDENTIAL
Philips Semiconductors
Functional Specification
2.3 Anticollision
An intelligent anticollision mechanism allows to handle more than one PICC in the field simultaneously. The
anticollision algorithm selects each PICC individually and ensures that the execution of a transaction with a
selected PICC is performed correctly without data corruption resulting from other PICCs in the field.
MSB
Byte SN0
LSB
SN1
SN2
SN3
SN4
SN5
SN6
CONFIDENTIAL
Philips Semiconductors
Functional Specification
PCD
Data
exchanged
PICC
Authenticate
(KeyNo)
8 bytes
ekkeyNo(RndB)
9
Philips Semiconductors
Functional Specification
PCD
Data
exchanged
PICC
transmitted to the PCD.
16 bytes
dkkeyNo(RndA+
RndB)
The
PICC
runs
an
DES/3DES
encipherment on the received token and
thus gains RndA + RndB. The PICC can
now verify the sent RndB by comparing it
with the RndB obtained by rotating the
original RndB left by 8 bits internally.
8 bytes
ekkeyNo(RndA)
The
PCD
runs
a
DES/3DES
decipherment on the received ekkeyNo
(RndA) and thus gains RndA for
comparison with the PCD-internally
rotated RndA.
If the comparison fails, the PCD exits the
procedure and may halt the PICC.
The PICC sets the authentication state for
6
10
CONFIDENTIAL
Philips Semiconductors
Functional Specification
PCD
Data
exchanged
PICC
the currently selected application or the
PICC itself (in case of AID=0x00).
If all comparisons are successful, the 16 byte session key is obtained by employing RndA and RndB.
The session key is gained by combining them according to the following rule:
session key := RndA1st half + RndB1st half + RndA2nd half + RndB2nd half
This scrambling of RndA and RndB is done to avoid that a malicious PCD could degenerate 3DES
cryptography to single DES operation by forcing RndA = RndB.
In case of WANTED single DES operation (leading 8 bytes of the secret key are identical to the trailing
8 bytes), only the first 8 bytes of the session key (RndA1st half + RndB1st half) are used for further
cryptographic operations, the trailing 8 bytes must not be used.
With the generation of the session key the mutual 3-pass authentication is successfully completed.
Data Transmission between PICC and PCD can be done on three levels of security:
Access to user data is granted on application level. For each application up to 14 different user definable
keys can be assigned to control access to data stored in the PICC.
11
CONFIDENTIAL
Philips Semiconductors
Functional Specification
2.7 (3)DES-Encryption
The DES standard defines two basic cryptographic operations: encipherment and decipherment.
The DESFire device always performs the cryptographic operation encipherment on any received and sent
data. This avoids time-consuming key-re-loading to the DESFire 3DES hardware.
This implicates that the PCD always needs to use the decipher cryptographic operation to decipher data
received from DESFire respectively needs to use the decipher cryptographic operation to decipher data
before sending to DESFire.
3DES operation
PICC
PCD
st
Encipher
Decipher
nd
Decipher
Encipher
st
Encipher
Decipher
DES/3DES always operates on 8 bytes. Therefore data streams are always padded to a length of multiples
of 8 bytes.
All cryptographic operations are done in cipher block chaining mode, which defines the result of the
previous operation to be the Init-vector of the next cryptographic operation. For sending data the "CBC send
mode" is used, for receiving always "CBC receive mode".
The Init-vector to start cryptographic operation is defined as 0x00 00 00 00 00 00 00 00".
For DES operation the length of data has to be equal to n*8 Bytes, so the data is filled up to
n*8 Bytes with "0x00" (=padding).
Note: In case the length of data in the DESFire command is given with "0x00 00 00" (all data bytes have to
be read), padding to n*8 Bytes has to be done with once "0x80" and the rest "0x00".
The original DES standard specifies one parity bit for every byte in the DES key, causing an overhead of
8 bits per DES key. Modern 3DES Hardware does not need parity bits any more to ensure data integrity.
DESFire uses these bits to store one byte of data that can be used to store the version of the key. This is
called key versioning. When you write a key to key to DESFire, you always write this version information (in
your key generation process, make sure you overwrite the parity bits with the key version, otherwise you
endanger the security level of your cryptographic system, as the parity bits (= key version) can by read with
the GetKeyVersion command, see chapter 4.3.5.
To store a key version to the PICC, the new version number needs to be coded by the application software
into the new key before issuing the ChangeKey command. The key version information is NOT checked by
the PICC in any respect.
12
CONFIDENTIAL
Philips Semiconductors
Functional Specification
Important Note:
Even if the Key versioning feature is NOT used, the application needs to make sure that the parity bits of
every single byte in the new DES / 3DES key are overwritten with a default value (e.g. 0) as they can be
read out using the GetKeyVersion command.
In case the parity information is not overwritten, the valid parity bits are returned., which significantly
decreases the cryptographic strength of the key.
13
CONFIDENTIAL
Philips Semiconductors
Functional Specification
2.8 MACing
The DES standard defines two basic cryptographic operations: encipherment and decipherment.
The DESFire device always performs the cryptographic operation encipherment on any received and sent
data. This avoids time-consuming key-re-loading to the DESFire 3DES hardware.
This implicates that for calculation of a MAC the PCD also always needs to encipher data received from
DESFire respectively needs to encipher data before sending to DESFire.
PICC
PCD
st
3DES operation
Encipher
Encipher
nd
Decipher
Decipher
st
Encipher
Encipher
DES/3DES always operates on 8 bytes. Therefore data streams are always padded to a length of multiples
of 8 bytes.
All cryptographic operations are done in cipher block chaining mode, which defines the result of the
previous operation to be the Init-vector of the next cryptographic operation as. For generating MACs the
"CBC send mode" is used.
The Init-vector to start cryptographic operation is defined as 0x00 00 00 00 00 00 00 00"
For DES operation the length of data has to be equal to n*8 Bytes, so the data is filled up to
n*8 Bytes with "0x00" (=padding).
The first 4 bytes of the last 8 byte outcome block is defined as MAC.
This 4 bytes MAC is added to and checked across the transferred plain data.
14
CONFIDENTIAL
Philips Semiconductors
Functional Specification
(coded as 0x00)
(coded as 0x01)
(coded as 0x02)
(coded as 0x03)
(coded as 0x04)
The Settings are coded into one byte which needs to be set to
Communication Mode
bit 7 bit 2
bit 1
bit 0
Plain communication
RFU = 0
ignored
RFU = 0
RFU = 0
Both DES and 3DES keys are stored in strings consisting of 16 bytes:
If the 2nd half of the key string is equal to the 1st half, the key is handled as a single DES key by the PICC.
If the 2nd half of the key string is not equal to the 1st half, the key is handled as a 3DES key.
00 11 22 33
44 55 66 77
0x00 00 00 00 00 00 00 00
00 00 00 00
00 00 00 00 *
0x00 11 22 33 44 55 66 77
88 99 AA BB
CC DD EE FF
0x00 11 22 33 44 55 66 77
00 00 00 00
00 00 01 00
0x00 00 00 00 00 00 00 00
00 00 00 01
00 00 00 00
* All bytes 0x00 is the default key of the MF3 IC D40 IC, and defines single DES operation as default.
All operations based on keys are executed with the respective method DES or 3DES.
15
CONFIDENTIAL
Philips Semiconductors
Functional Specification
Read Access
Write Access
Read&Write Access
ChangeAccessRights
Each of the Access Rights is coded in 4 bits, one nibble. Each nibble represents a link to one of the keys
stored within the respective application's key file.
One nibble allows to code 16 different values. If such a value is set to a number between 0 and 13 (max. 14
keys), this references a certain key within the application's key file, provided that the key exists (selecting a
non-existing key is not allowed).
If the number is coded as 14 (0xE) this means free access. Thus the regarding access is granted always
with and without a preceding authentication, directly after the selection of the respective application.
The number 15 (0xF) defines the opposite of free access and has the meaning deny access. Therefore
the respective linked Access Rights is always denied.
The most significant 4 bits of the two bytes parameter code the reference number of the key which is
necessary to know for getting Read Access (in case of Value files: for the GetValue and the Debit
Command).
The next 4 bits hold the number of the key for getting Write Access (in case of Value files: GetValue, Debit
and LimitedCredit Command).
The upper nibble of the lower byte holds the key number for getting Read&Write Access, in Value files this
right allows full access (in case of Value files: GetValue, Debit, LimitedCredit and Credit Command; in case
of Record files additionally: ClearRecordFile).
The least significant nibble holds the reference number of the key, which is necessary to be authenticated
with in order to change the Access Rights for the file and to link each Access Right to key numbers.
Access rights are always packed in 2 bytes as follows:
15
12
Read Access
11
Write Access
4
Read&Write Access
MS Bit
16
CONFIDENTIAL
Philips Semiconductors
Functional Specification
Status
OPERATION_OK
NO_CHANGES
0x0E
0x1C
0x1E
OUT_OF_EEPROM_ERROR
ILLEGAL_COMMAND_CODE
INTEGRITY_ERROR
0x40
0x7E
0x9D
NO_SUCH_KEY
LENGTH_ERROR
PERMISSION_DENIED
0x9E
0xA0
0xA1
PARAMETER_ERROR
APPLICATION_NOT_FOUND
APPL_INTEGRITY_ERROR
0xAE
AUTHENTICATION_ERROR
0xAF
0xBE
ADDITIONAL_FRAME
BOUNDARY_ERROR
0xC1
0xCA
PICC_INTEGRITY_ERROR
COMMAND_ABORTED
0xCD
0xCE
PICC_DISABLED_ERROR
COUNT_ERROR
0xDE
DUPLICATE_ERROR
0xEE
EEPROM_ERROR
0xF0
0xF1
FILE_NOT_FOUND
FILE_INTEGRITY_ERROR
Description
Successful operation
No changes done to backup files, CommitTransaction /
AbortTransaction not necessary
Insufficient NV-Memory to complete command
Command code not supported
CRC or MAC does not match data
Padding bytes not valid
Invalid key number specified
Length of command string invalid
Current configuration / status does not allow the requested
command
Value of the parameter(s) invalid
Requested AID not present on PICC
Unrecoverable error within application, application will be
disabled *
Current authentication status does not allow the requested
command
Additional data frame is expected to be sent
Attempt to read/write data from/to beyond the file's/record's
limits.
Attempt to exceed the limits of a value file.
Unrecoverable error within PICC, PICC will be disabled *
Previous Command was not fully completed
Not all Frames were requested or provided by the PCD
PICC was disabled by an unrecoverable error *
Number of Applications limited to 28, no additional
CreateApplication possible
Creation of file/application failed because file/application
with same number already exists
Could not complete NV-write operation due to loss of
power, internal backup/rollback mechanism activated *
Specified file number does not exist
Unrecoverable error within file, file will be disabled *
17
CONFIDENTIAL
Philips Semiconductors
Functional Specification
Description
REQA
WUPA
ANTICOLLISION /
SELECT Cascade
Level 1
ANTICOLLISION /
SELECT Cascade
Level 2
Description
RATS
The response to the RATS command identifies the PICC type to the PCD.
PPS
The PPS command allows to individually select the communication baud rate
between PCD and PICC. For DESFire it is possible to individually set the
communication baud rate independently for both directions i.e. DESFire allows a nonsymmetrical information interchange speed.
WTX
If the PICC needs more time than the defined FWT to respond to a PCD command it
will send a request for a waiting time extension.
18
CONFIDENTIAL
Philips Semiconductors
Functional Specification
Command
Description
0x0A
Authenticate
In this procedure both, the PICC as well as the reader device, show in an
encrypted way that they posses the same secret which especially means
the same key. This procedure not only confirms that both entities are
permitted to do operations on each other but also creates a session key
which can be used to keep the further communication path secure. As the
name session key implicitly indicates, each time a new authentication
procedure is successfully completed a new key for further cryptographic
operations is generated.
0x54
Change KeySettings
0x45
Get KeySettings
0xC4
Change Key
0x64
Get KeyVersion
Reads out the current key version of any key stored on the PICC.
Note: All command & data frames are exchanged between PICC and PCD by using block format as defined
in ISO 14443-4.
Command
Description
0xCA
Create Application
0xDA
Delete Application
0x6A
0x5A
Select Application
0xFC
FormatPICC
0x60
Get Version
Note: All command & data frames are exchanged between PICC and PCD by using block format as defined
in ISO 14443-4.
19
CONFIDENTIAL
Philips Semiconductors
Functional Specification
Command
Description
0x6F
Get FileIDs
Returns the File IDentifiers of all active files within the currently selected
application.
0xF5
Get FileSettings
0x5F
Change FileSettings
0xCD
Create StdDataFile
Creates files for the storage of plain unformatted user data within an
existing application on the PICC.
0xCB
Create
BackupDataFile
Creates files for the storage of plain unformatted user data within an
existing application on the PICC, additionally supporting the feature of an
integrated backup mechanism.
0xCC
Create ValueFile
Creates files for the storage and manipulation of 32bit signed integer values
within an existing application on the PICC.
0xC1
Create
LinearRecordFile
Creates files for multiple storage of structural similar data, for example for
loyalty programs, within an existing application on the PICC. Once the file is
filled completely with data records, further writing to the file is not possible
unless it is cleared.
0xC0
Create
CyclicRecordFile
Creates files for multiple storage of structural similar data, for example for
logging transactions, within an existing application on the PICC. Once the
file is filled completely with data records, the PICC automatically overwrites
the oldest record with the latest written one. This wrap is fully transparent
for the PCD.
0xDF
DeleteFile
Note: All command & data frames are exchanged between PICC and PCD by using block format as defined
in ISO 14443-4.
20
CONFIDENTIAL
Philips Semiconductors
Functional Specification
Command
Description
0xBD
Read Data
0x3D
Write Data
0x6C
Get Value
0x0C
Credit
0xDC
Debit
0x1C
Limited Credit
Allows a limited increase of a value stored in a Value File without having full
Credit permissions to the file.
0x3B
Write Record
0xBB
Read Records
Reads out a set of complete records from a Cyclic or Linear Record File.
0xEB
Clear RecordFile
0xC7
Commit Transaction
Validates all previous write access on Backup Data Files, Value Files and
Record Files within one application.
0xA7
Abort Transaction
Invalidates all previous write access on Backup Data Files, Value Files and
Record Files within one application.
Note: All command & data frames are exchanged between PICC and PCD by using block format as defined
in ISO 14443-4.
21
CONFIDENTIAL
Philips Semiconductors
Functional Specification
3.12 Selection of native DESFire APDU Framing versus ISO 7816-4 framing and commands
Enter
ISO 14443-4
NO
YES
22
CONFIDENTIAL
Philips Semiconductors
Functional Specification
CLA
INS
P1
P2
LC
Data
LE
0x90
0x00
0x91 0xYY The SW2 byte holds the Status byte of native DESFire
23
CONFIDENTIAL
Philips Semiconductors
Functional Specification
NOTE: For maximum compatibility with future versions of DESFire (or DESFire emulations on Dual
Interface Smart Cards) we do NOT recommend to use this legacy features in newly designed
applications.
Enter
ISO 14443-4
NO
FRAMED
YES
OPTIONAL
OPTIONAL
OPTIONAL
24
CONFIDENTIAL
Philips Semiconductors
Functional Specification
Parameter
Data
Integrity mechanism
Response
26 ( 7 Bit)
0344
Description: The MF3 IC D40 accepts the REQA command in Idle state only. The response is the 2-byte
ATQA (0344). REQA and ATQA are implemented fully according to ISO14443-3.
REQA:
CMD (7 Bit)
PCD
'26'
Command
time
MF3 IC D40
'44'
Response
'03'
ATQA
90s
80s
180s
Parameter
Data
Integrity mechanism
Response
52 ( 7Bit)
0344
Description: The MF3 IC D40 accepts the WAKE-UP command in the Idle and Halt state only. The
response is the 2-byte ATQA (0344). WAKE-UP is implemented fully according to ISO14443-3.
WAKE-UP
PCD
Command
CMD (7 Bit)
'52'
time
MF3 IC D40
'44'
Response
'03'
ATQA
90s
80s
180s
25
CONFIDENTIAL
Philips Semiconductors
Functional Specification
Parameter
Data
Integrity mechanism
Response
Anticollision: 93
20 67
Parity
Parts of UID
Select: 93
70
Cascade Tag,
SAK (24)
CMD
ARG
'93'
'20'
time
MF3 IC D40
'88'
Response
CT
190s
SN0
SN1
CMD
Command
'93'
ARG
80s
'70'
CT
'88'
BCC1
UID of Cascadelevel1
430s
SN2
UID of Cascadelevel1
SN0
SN1
SN2
CRC
BCC
1
C0
C1
time
MF3 IC D40
'24'
Response
SAK
780s
80s
26
C0
C1
CRC
260s
CONFIDENTIAL
Philips Semiconductors
Functional Specification
Parameter
Data
Integrity mechanism
Response
Anticollision: 0x95
20 67
Parity
Parts of UID
Select: 0x95
70
SAK (20)
Description: The ANTICOLLISION and SELECT command are based on the same command code. They
differ only in the parameter byte. This byte is per definition 70 in case of SELECT. The MF3 IC D40 accepts
these commands in the Ready2 state only. The response is part 2 of the UID.
For more details on the possible parameters please see ISO 14443-3.
Note: Times units are not drawn to scale!
CMD
ARG
'95'
'20'
time
MF3 IC D40
SN3
Response
SN4
SN5
80s
430s
BCC2
UID of Cascadelevel2
190s
PCD
SN6
'95'
ARG
'70'
UID of Cascadelevel1
SN3
SN4
SN5
SN6
CRC
BCC
2
C0
C1
time
MF3 IC D40
'20'
Response
SAK
780s
80s
27
C0
C1
CRC
260s
CONFIDENTIAL
Philips Semiconductors
Functional Specification
Parameter
Data
Integrity mechanism
Response
0xE0
CRC
16 Byte Data
FSDI: The High Nibble of the parameter byte codes the maximum frame size supported by the PCD for
communication with the PICC.
CID: The Low Nibble of the parameter byte codes the logical number of the addressed PICC. This logical
number is in the range from 0x00 to 0x0E. This CID is used to distinguish several PICCs simultaneously
selected by a single PCD. The DESFire PICC fully supports CIDs, which is coded in TC(1).
Note: Times units are not drawn to scale!
RATS
PCD
Command
CMD
ARG
'E0'
'XX'
CRC
C0
C1
time
MF3 IC D40
Response
360s
'06'
'75'
'33'
'81'
'02'
'XX'
TL
T0
TA(1)
TB(1)
TC(1)
T1
80s
C0
C1
CRC
1490
The response of the MF3 IC D40 to the RATS is the Answer to Select, ATS. This ATS consists of the
following bytes:
TL: Length Byte, the length byte TL specifies the length of the transmitted ATS including itself. The two
CRC bytes are not included in TL. For the MF3 IC D40 device TL is set to 0x06.
T0: Format Byte, the format bytes defines the presence of the subsequent bytes TA(1), TB(1) and TC(1). All
three are present, resulting is 0x7 for the higher nibble. The lower nibble (FSCI) specifies the maximum size
of a frame accepted by the MF3 IC D40 which is 64 bytes, coded as 0x5. The format byte therefore is 0x75.
TA(1): The Interface byte TA(1) codes the maximum possible data rates supported by the PICC. As the
MF3 IC D40 supports date rates up to 424 kbaud in both directions (PICC to PCD and PCD to PICC), the
TA(1) byte is set to 0x33.
TB(1): The higher nibble codes the Frame Waiting Time (FWT), which is set to 0x8 for DESFire, indicating
77.33 ms. The lower nibble codes the start-up frame guard time (SFGT). It is set to 0x1, indicating 604s.
The PCD will therefore receive 0x81.
TC(1): CID is supported, NAD is not supported, therefore TC(1) is set to 0x02.
T1: The DESFire PICC sends one byte as historical character which should be ignored by the application
software.
28
CONFIDENTIAL
Philips Semiconductors
Functional Specification
Parameter
Data
Integrity mechanism
Response
PPSS: DX
PPS0
CRC
PPSS: D0
PPS1
Description: The PPS command allows to individually select the communication baud rate between PCD
and PICC. For DESFire it is possible to individually set the communication baud rate independently for both
directions i.e. DESFire allows a non-symmetrical information interchange speed.
PPSS: The higher nibble of the PPSS byte needs to be set to D, all other values are RFU. The lower
nibble indicates the CID of the selected PICC in the range of 0x00 and 0x0E.
PPS0: The PPS Parameter 0 byte indicates the presence of PPS1 (which is valid for DESFire) and
therefore has to be set to 0x11.
PPS1: The PPS Parameter 1 byte defines the divisor integer for timings between PCD and PICC which
directly defines the baud rate in each direction.
The higher nibble of the PPS1 byte is RFU and has to be set to 0. Bits b3 and b2 code the divisor
integer from PICC to PCD and are called DSI. Bits b1 and b0 code the divisor integer from PCD to PICC
and are called DRI.
The coding of DRI and DSI is done as specified below:
DRI, DSI bit coding
00
01
10
Divisor
106 kbaud
212 kbaud
424 kbaud
DESFire supports baud rates up to 424 kbaud in both directions. please note that it is possible to
independently set the communication speed in both directions, which allows for example to use
106 kbaud for communication from PCD to PICC (DRI=00) and 424 kbaud from PICC to PCD (DSI=10).
For communication with 106 kbaud in both directions the value of PPS1 has to be 00, which is the
default if no PPS command is sent to the PICC.
PPS
PCD
Command
CMD
'DX'
ARG
'11'
'00'
CRC
C0
C1
time
MF3 IC D40
'D0'
Response
C0
PPSS
360s
80s
50s
C1
CRC
1490
The response of the MF3 IC D40 to the PSS command is the PPS Start byte (PPSS, 0xD0). Invalid PPS
requests are ignored (as defined in ISO).
29
CONFIDENTIAL
Philips Semiconductors
Functional Specification
30
CONFIDENTIAL
Philips Semiconductors
Functional Specification
4.3.1 Authenticate
In this procedure both, the PICC as well as the reader device, show in an encrypted way that they posses
the same secret which especially means the same key. This procedure not only confirms that both entities
can trust each other but also generates a session key which can be used to keep the further communication
path secure. As the name session key implicitly indicates, each time a new authentication procedure is
successfully completed a new key for further cryptographic operations is obtained.
Authenticate(keyNo) [2bytes]
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
PCD:
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
1
1
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
1
16
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
0x0A
Key
No
cmd
0xAF
dkNo(RndA+RndB')
status
31
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
PICC:
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
1
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
or 0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
1
8
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
1
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
or 0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
1
8
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
error
code
status
0xAF
ekNo(RndB)
status
error
code
status
0x00
ekNo(RndA')
status
CONFIDENTIAL
Philips Semiconductors
Functional Specification
Depending on the configuration of the application (represented by its AID), an authentication has to be done
to perform specific operations:
Depending on the security configuration of the PICC, the following commands may require an authentication
with the PICC master keys:
Selecting an application
Changing the key which was used for reaching the currently valid authentication status
A failed authentication
Please note: Master keys are identified by their key number 0x00. This is valid on PICC level (selected
AID = 0x00) and on Application level (selected AID 0x00).
32
CONFIDENTIAL
Philips Semiconductors
Functional Specification
4.3.2 ChangeKeySettings
This command changes the master key configuration settings depending on the currently selected AID.
If AID = 0x00 has been selected in advance, the change applies to the PICC key settings, otherwise
(AID 0x00) it applies to the application key settings of the currently selected application.
ChangeKeySettings(KeySettings) [2 bytes]
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
PCD:
PICC:
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
1
8
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
1
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
or 0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
1
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0x54
cmd
error
code
status
0x00
status
This command only succeeds if the configuration changeable bit, see below, of the current key settings was
not cleared before.
Additionally a successful preceding authentication with the master key is required (PICC master key if
AID = 0x00, else with application master key).
This command takes one byte as parameter which codes the new master key settings.
To guarantee that the ChangeKeySettings command is sent by the same PCD which did the preceding
Authentication command, it is necessary to apply the same security mechanism as for the ChangeKey
command, see chapter 4.3.4.
A CRC is calculated on the parameter byte and appended at its end. As this modified data stream now is of
three bytes length, five zero bytes 0x00 are appended to get an 8 bytes long data stream suitable for the
DES/3DES decipherment operation.
The PICC now is capable of proving the authenticity of the received data by running a DES/3DES
encipherment and checking the recovered CRC and padding bytes of the plain data.
33
CONFIDENTIAL
Philips Semiconductors
Functional Specification
Bit2
Bit1
Bit0
allow changing the
PICC master key
Bit3
Bit4
Bit5
configuration
changeable
Bit6
RFU
RFU
Bit7
RFU
RFU
1: this configuration is changeable if authenticated with PICC master key (default setting).
Bit2: codes whether PICC master key authentication is needed before Create- / DeleteApplication
Bit1: codes whether PICC master key authentication is needed for application directory access:
0: Successful PICC master key authentication is required for executing the GetApplicationIDs
and GetKeySettings commands.
1: PICC Master key is changeable (authentication with the current PICC master key necessary,
default setting).
* Note: In case of usage of the application master key for deletion, the application which is about to be
deleted needs to be Selected and Authenticated with the application master key prior to the
DeleteApplication command.
34
CONFIDENTIAL
Philips Semiconductors
Functional Specification
Bit2
Bit1
Bit0
allow change
master key
Bit3
Bit4
Bit5
configuration
changeable
Bit6
ChangeKey Access
Rights Bit0
ChangeKey Access
Rights Bit3
Bit7
ChangeKey Access
Rights Bit1
ChangeKey Access
Rights Bit2
0x0: Application master key authentication is necessary to change any key (default).
0x1 .. 0xD: Authentication with the specified key is necessary to change any key.
0xE: Authentication with the key to be changed (same KeyNo) is necessary to change a key.
0xF: All Keys (except application master key, see Bit0) within this application are frozen.
Bit3: codes whether a change of the application master key settings is allowed:
1: this configuration is changeable if authenticated with the application master key (default
setting).
Bit2: codes whether application master key authentication is needed before CreateFile / DeleteFile
1: CreateFile / DeleteFile is permitted also without application master key authentication (default
setting).
Bit1: codes whether application master key authentication is needed for file directory access:
0: Successful application master key authentication is required for executing the GetFileIDs
GetFileSettings and GetKeySettings commands.
1: Application master key is changeable (authentication with the current application master key
necessary, default setting).
35
CONFIDENTIAL
Philips Semiconductors
Functional Specification
4.3.3 GetKeySettings
The GetKeySettings command allows to get configuration information on the PICC and application master
key configuration settings as described in chapter 4.3.2. In addition it returns the maximum number of keys
which can be stored within the selected application.
GetKeySettings() [1 byte]
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
PCD:
PICC:
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
1
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
1
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 or 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
1
1
1
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0x45
cmd
error
code
status
0x00
key
settings
max
No of
keys
status
36
CONFIDENTIAL
Philips Semiconductors
Functional Specification
4.3.4 ChangeKey
This command allows to change any key stored on the PICC.
If AID = 0x00 is selected, the change applies to the PICC master key and therefore only KeyNo = 0x00 is
valid (only one PICC master key is present on a PICC). In all other cases (AID 0x00) the change applies to
the specified KeyNo within the currently selected application (represented by its AID).
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
PCD:
PICC:
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
1
1
24
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
1
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
or 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
1
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0xC4
Key
No
cmd
error
code
status
0x00
status
As a parameter this command takes the KeyNo which is of one byte length and has to be in the range from
0x00 to number of application keys - 1.
The second parameter holds the information about the new key packed in a cryptogram.
The respective key settings (see chapter 4.3.2) define whether a change of keys is permitted or not,
additionally they show which key is needed for Authentication before the ChangeKey Command.
To change any key (except Master Key and the ChangeKey Key), authentication with the ChangeKey is
necessary.
To change the ChangeKey Key or the Master Key, authentication with the Master Key is necessary.
37
CONFIDENTIAL
Philips Semiconductors
Functional Specification
In case the KeyNo used for authentication is DIFFERENT from the KeyNo to be changed and
ChangeKey Key is set to a value 0xE, the PCD needs to generate the data frame deciphered key
data in the following way:
The new key and the current key are bit-wise XORed (16 byte). A CRC (2 byte) is calculated over the
XORed data and appended at the end. Additionally a CRC (2 byte) of the new key is appended. After this
padding of zeros (4 byte) is applied to reach an adequate frame size of multiples of 8 (24 byte overall).
Finally a DES/3DES deciphering operation (using the current session key) is performed on the whole key
data field. The three cryptogram blocks are chained using the CBC send mode.
In case the KeyNo used for authentication is the SAME as the KeyNo to be changed or if ChangeKey
Key is set to 0xE, the PCD needs to generate the data frame deciphered key data in the following way:
A CRC (2 bytes) is calculated over the new key data (16 bytes) and appended at the end. After this padding
of zeros (6 bytes) is applied to reach an adequate frame size of multiples of 8 (24 byte overall). Finally a
DES/3DES deciphering operation (using the current session key) is performed on the whole key data field.
The three cryptogram blocks are chained using the CBC send mode.
In case the ChangeKey Key is set to 0xF (never), all keys except the Master Key (see chapter 4.3.2,
Bit0) are frozen. The ChangeKey command therefore will return an error code when attempting to
change a key different from the master key.
Note: After a successful change of the key used to reach the current authentication status, this
authentication is invalidated i.e. an authentication with the new key is necessary for subsequent operations.
38
CONFIDENTIAL
Philips Semiconductors
Functional Specification
4.3.5 GetKeyVersion
The GetKeyVersion command allows to read out the current key version of any key stored on the PICC.
If AID = 0x00 is selected, the command returns the version of the PICC master key and therefore only
KeyNo = 0x00 is valid (only one PICC master key is present on a PICC). In all other cases (AID 0x00) the
version of the specified KeyNo within the currently selected application (represented by its AID) is returned.
GetKeyVersion(KeyNo) [2 bytes]
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
PCD:
PICC:
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
1
1
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
1
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
or 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
1
1
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0x64
Key
No
cmd
error
code
status
0x00
Key
Ver
status
One parameter is passed with this command which codes the key number.
The command returns the current version of the specified key as an unsigned byte.
To change the key version of any key, the ChangeKey command, see chapter 4.3.4, is used.
This command can be issued without valid authentication.
39
CONFIDENTIAL
Philips Semiconductors
Functional Specification
CreateApplication(AID,KeySettings,NumOfKeys) [6 bytes]
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
PCD:
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
1
3
1
1
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
0xCA
cmd
Key
Sett.
AID
LSB
Num
Of
Keys
MSB
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
PICC:
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
1
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
or
1
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
error
code
status
0x00
Application
successfully created
status
40
CONFIDENTIAL
Philips Semiconductors
Functional Specification
4.4.2 DeleteApplication
The DeleteApplication command allows to permanently deactivate applications on the PICC.
DeleteApplication(AID) [4 bytes]
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
PCD:
PICC:
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
1
3
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
1
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 or 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
1
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0xDA
cmd
AID
LSB
MSB
error
code
status
0x00
status
The application which will be deleted is represented by its Application Identifier, AID, which is the only
parameter of this command.
Depending on the PICC master key settings, see chapter 4.3.2, either a preceding PICC master key
authentication or an application master key authentication is required.
In the latter case, it has to be the master key authentication for the application which shall be deleted by this
command.
The AID allocation is removed, therefore it is possible to create a new application with the deleted
application's AID. However, the deleted memory blocks can only be recovered by using the FormatPICC
command (see chapter 4.4.5) which erases the full user memory of the PICC.
Note: Even if the PICC master key contains the default value 0 and the bit free create / delete without PICC
master key is set, it is necessary to be either authenticated with the zero PICC master key or the respective
application master key.
Note: If the currently selected application is deleted, this command automatically selects the PICC level,
selected AID = 0x00 00 00.
41
CONFIDENTIAL
Philips Semiconductors
Functional Specification
4.4.3 GetApplicationIDs
The GetApplicationIDs command returns the Application IDentifiers of all active applications on a PICC.
GetApplicationIDs() [1 byte]
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000PCD:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 PICC:
000000000000000000000000000000000000
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 010 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00100 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 or 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000 00up00 00 00 00to00 00 1900 00 00 00AIDs
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1
3
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 030 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00100 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00100 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00100 00 00 00 00 00 00 00 00 00 00 00 300 00 100 00 00up00 00 00 to00 00 00 700 00 AIDs
00 00 00 00 00 00300 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000
0x6A
cmd
error
code
status
0xAF
AID
AID
status
0xAF
status
error
code
status
0x00
AID
AID
status
42
CONFIDENTIAL
Philips Semiconductors
Functional Specification
4.4.4 SelectApplication
The SelectApplication command allows to select one specific application for further access.
SelectApplication(AID) [4 bytes]
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
PCD:
PICC:
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
1
3
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
1
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 or 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
1
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0x5A
cmd
AID
LSB
MSB
error
code
status
0x00
status
43
CONFIDENTIAL
Philips Semiconductors
Functional Specification
4.4.5 FormatPICC
This command releases the PICC user memory.
FormatPICC() [1 byte]
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
PCD:
PICC:
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
1
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
1
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 or 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
1
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0xFC
cmd
error
code
status
0x00
status
44
CONFIDENTIAL
Philips Semiconductors
Functional Specification
4.4.6 GetVersion
The GetVersion command returns manufacturing related data of the PICC.
GetVersion [1 byte]
PCD:
PICC:
1
0x60
cmd
1
1st frame
vend
0xAF
or ID
type
sub
type
major minor
ver
ver
stora
ge
size
proto
col
stora
ge
size
proto
col
status
1
0xAF
2nd
frame
1
0xAF
1
vend
or ID
type
sub
type
major minor
ver
ver
status
1
0xAF
1
3srd frame
0x00
UID
batch No
cw
prod
year
prod
status
45
CONFIDENTIAL
Philips Semiconductors
Functional Specification
nd
rd
The 3 frame returns the unique serial number, batch number, year and calendar week of production:
* The 7 MSBits (= n) code the storage size itself based on 2^n, the LSBit is set to '0' if the size is exactly 2^n
and set to '1' if the storage size is between 2^n and 2^(n+1). For this version of DESFire the 7 MSBits are set
to 0x0C (2^12 = 4096) and the LSBit is '0'.
46
CONFIDENTIAL
Philips Semiconductors
Functional Specification
4.5.1 GetFileIDs
The GetFileIDs command returns the File IDentifiers of all active files within the currently selected
application.
GetFileIDs() [1 byte]
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
PCD:
PICC:
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
1
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
1
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
or 0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0 to 16
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
1
1
1
1
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0x6F
cmd
error
code
status
0x00
FID
FID
FID
status
47
CONFIDENTIAL
Philips Semiconductors
Functional Specification
4.5.2 GetFileSettings
The GetFileSettings command allows to get information on the properties of a specific file. The information
provided by this command depends on the type of the file which is queried.
GetFileSettings() [2 byte]
00000000000000000000000000000
00000000000000000000000000000
PCD:
00000000000000000000000000000
00000000000000000000000000000
1
1
00000000000000000000000000000
00000000000000000000000000000
00000000000000000000000000000
00000000000000000000000000000
00000000000000000000000000000
00000000000000000000000000000
00000000000000000000000000000
00000000000000000000000000000
00000000000000000000000000000
00000000000000000000000000000
00000000000000000000000000000
00000000000000000000000000000
00000000000000000000000000000
00000000000000000000000000000
00000000000000000000000000000
00000000000000000000000000000
00000000000000000000000000000
00000000000000000000000000000
00000000000000000000000000000
00000000000000000000000000000
00000000000000000000000000000
00000000000000000000000000000
00000000000000000000000000000
00000000000000000000000000000
00000000000000000000000000000
00000000000000000000000000000
00000000000000000000000000000
00000000000000000000000000000
0xF5
cmd
File
No
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
PICC:
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
or 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
1
1
2
3
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
1
1
2
4
4
4
1
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
1
1
2
3
3
3
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
see status code
table
error
code
status
0x00
file
type
com.
sett.
status
0x00
status
file size
file
type
com.
sett.
status
0x00
access
rights
access
rights
MSB
lower limit
file
type
com.
sett.
access
rights
MSB LSB
record size
limited credit
value
upper limit
MSB LSB
max. number
of records
MSB LSB
limited
credit
enabled
MSB
current number
of records
MSB LSB
MSB
The GetFileSettings command takes one parameter, coding the file number of the file to be queried within
the currently selected application. This file number must be in the range between 0x00 and 0x0F.
Depending on the application master key settings (see chapter 4.3.2), a preceding authentication with the
application master key might be required.
After updating a value file's value but before issuing the CommitTransaction command, the GetFileSettings
command will always retrieve the old, unchanged limit for the limited credit value.
48
CONFIDENTIAL
Philips Semiconductors
Functional Specification
The first part of the returned message is the same for all file types:
The first byte indicates the files type, see chapter 3.1.
The next byte provides information on the files communication settings (plain/MACed/Enciphered), see
chapter 3.2.
This information is followed by the 2 byte file Access Rights field, see chapter 3.3.
All subsequent bytes in the response have a special meaning depending on the file type:
Value Files:
Three fields, each of four bytes length, are returned whereby the first field returns the lower limit of the
file (as defined at file creation), the second field returns the upper limit (as defined at file creation) and
the next field returns the current maximum limited credit value, see chapter 4.6.5. If the limited credit
functionality is not in use, the last field contains all zeros. The last byte codes, if the LimitedCredit
command is allowed for this file (0x00 for disabled, 0x01 for enabled).
49
CONFIDENTIAL
Philips Semiconductors
Functional Specification
4.5.3 ChangeFileSettings
This command changes the access parameters of an existing file.
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
PCD:
PICC:
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
1
1
1
2
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
or 0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
1
1
8
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
1
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
or 0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
1
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0x5F
File
No
cmd
0x5F
Com.
Set.
Access
Rights
LSB
File
No
MSB
cmd
error
code
status
0x00
status
As first parameter one byte is to be passed which codes the file number within the currently selected
application.
The next byte defines the new communication settings, see chapter 3.2.
Finally a two byte field defines the new Access Rights, see chapter 3.3.
This change only succeeds if the current Access Rights for Change Access Rights is different from never,
see also chapter 3.3.
To guarantee that the ChangeFileSettings command is coming from the same party which did the preceding
authentication, it is necessary to apply basically the same security mechanism as used with the ChangeKey
command, see chapter 4.3.4:
A CRC is calculated over the new three byte settings and appended at the end. As this modified data stream
now is of five bytes length, three bytes, all 0x00, are appended to get an eight bytes long data stream
suitable for DES/3DES operation. Finally a DES/3DES decipherment is done on this data on PCD side.
The PICC now is capable of proving the authenticity of the received data by running a DES/3DES
encipherment and checking the recovered CRC on the plain data.
However, if the ChangeAccessRights Access Rights is set with the value free, no security mechanism is
necessary and therefore the data is sent as plain text (5 byte overall length).
50
CONFIDENTIAL
Philips Semiconductors
Functional Specification
4.5.4 CreateStdDataFile
The CreateStdDataFile command is used to create files for the storage of plain unformatted user data within
an existing application on the PICC.
CreateStdDataFile(FileNo,Com.Set.,AccessRights,FileSize)
[8bytes]
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
PCD:
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
1
1
1
3
2
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
0xCD
cmd
File
No
Com.
Set.
Access
Rights
LSB
MSB LSB
FileSize
MSB
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
PICC:
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
1
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
or 0000000000000000000000000000000000000000000
1
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
error
code
status
0x00
File successfully
created
status
As first parameter this command needs the file number of the new file within the range 0x00 to 0x0F. The file
will be created in the currently selected application. It is not necessary to create the files within the
application in a special order. If a file with the specified number already exists within the currently selected
application, an error code is returned.
The next byte defines the communication settings, see chapter 3.2.
Then a two byte field defines the Access Rights for the new file, see chapter 3.3.
The last parameter of three byte length specifies the size of the file in bytes.
Note: The MF3 IC D40 internally allocates NV-memory in multiples of 32 bytes. Therefore a file creation
command with FileSize parameter 0x00 00 01 (1 byte file size) will internally consume the same amount of
NV-memory as a 0x00 00 20 (32 byte file size), namely 32 bytes.
51
CONFIDENTIAL
Philips Semiconductors
Functional Specification
4.5.5 CreateBackupDataFile
The CreateBackupDataFile command is used to create files for the storage of plain unformatted user data
within an existing application on the PICC, additionally supporting the feature of an integrated backup
mechanism.
CreateBackupDataFile(FileNo,Com.Set.,AccessRights,FileSize)
[8bytes]
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
PCD:
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
1
1
1
2
3
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
0xCB
cmd
File
No
Com.
Set.
Access
Rights
LSB
MSB LSB
File Size
MSB
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
PICC:
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
1
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
or 0000000000000000000000000000000000000000000
1
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
error
code
status
0x00
File successfully
created
status
As the name BackupDataFile implies, files of this type feature an integrated backup mechanism.
Every Write command is done in a independent mirror image of this file. To validate a write access to this file
type, it is necessary to confirm it with a CommitTransaction command, see chapter 4.6.10. If no
CommitTransaction command is send by the PCD, only the mirror image is changed, the original data
remains unchanged and valid.
All parameters have the same format as for the CreateStdDataFile command, see chapter 4.5.4, except the
parameter FileNo. As only the first 8 files within an application feature the integrated backup mechanism,
only FileNo 0x00 to 0x07 is allowed.
Due to the mirror image a BackupDataFile always consumes DOUBLE the NV-memory on the PICC
compared to a StdDataFile with the same specified FileSize.
52
CONFIDENTIAL
Philips Semiconductors
Functional Specification
4.5.6 CreateValueFile
The CreateValueFile command is used to create files for the storage and manipulation of 32bit signed
integer values within an existing application on the PICC.
CreateValueFile(FileNo,Com.Set.,AccessRights,LowerLimit,
UpperLimit,Value,LimitedCreditEnabled)
[18 bytes]
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
PCD:
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1 1
1
2
4
4
4
1
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
or
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0xCC
cmd
File
No
Com.
Set
Access
Rights
Lower Limit
Upper Limit
MSB LSB
Limited
Credit
enabled
Value
MSB LSB
MSB
0000000000000000000000000000
0000000000000000000000000000
PICC:
0000000000000000000000000000
0000000000000000000000000000
0000000000000000000000000000
0000000000000000000000000000
0000000000000000000000000000
0000000000000000000000000000
1
0000000000000000000000000000
0000000000000000000000000000
0000000000000000000000000000
0000000000000000000000000000
1
0000000000000000000000000000
0000000000000000000000000000
0000000000000000000000000000
0000000000000000000000000000
0000000000000000000000000000
0000000000000000000000000000
error
code
see status
code table
status
0x00
File successfully
created
status
As first parameter one byte codes the file number in the range 0x00 to 0x07 which the new created file
should get within the currently selected application.
The next byte defines the communication settings, see chapter 3.2
Then a two byte field defines the Access Rights for the new file, see chapter 3.3.
The next parameter is of 4 byte length and codes the lower limit which is valid for this file. The lower limit
marks the boundary which must not be passed by a Debit calculation on the current value, see chapter 4.6.5.
The lower limit is a 4 byte signed integer and thus may be negative too.
After this again 4 bytes are used to code the upper limit which sets the boundary in the same manner but for
the Credit operation, see chapter 4.6.4. This parameter is also a 4 byte signed integer.
The upper limit has to be lower limit, otherwise an error message would be sent by the PICC and thus the
file would not be created.
The next parameter is a 4 byte signed integer again and specifies the initial value of the value file. The upper
and lower limit is checked by the PICC, in case of inconsistency the file is not created and an error message
is sent by the PICC.
The last bytes codes the activation of the LimitedCredit feature, see chapter 4.6.6. Here 0x00 means that
LimitedCredit is disabled and 0x01 enables this feature.
ValueFiles feature always the integrated backup mechanism. Therefore every access changing the value
needs to be validated using the CommitTransaction command, see chapter 4.6.10.
53
CONFIDENTIAL
Philips Semiconductors
Functional Specification
4.5.7 CreateLinearRecordFile
The CreateLinearRecordFile command is used to create files for multiple storage of structural data, for
example for loyalty programs, within an existing application on the PICC. Once the file is filled completely
with data records, further writing to the file is not possible unless it is cleared, see command
ClearRecordFile, chapter 4.6.9.
CreateLinearRecordFile(FileNo,Com.Set.,AccessRights,Rec.Size,
MaxNumOfRecords) [11 bytes]
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
PCD:
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
1
1
1
2
3
3
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
0xC1
cmd
File
No
Com.
Set.
Access
Rights
LSB
MSB LSB
Record Size
MSB LSB
MSB
000000000000000000000000000000000000000000
000000000000000000000000000000000000000000
000000000000000000000000000000000000000000
PICC:
000000000000000000000000000000000000000000
000000000000000000000000000000000000000000
000000000000000000000000000000000000000000
000000000000000000000000000000000000000000
000000000000000000000000000000000000000000
1
000000000000000000000000000000000000000000
000000000000000000000000000000000000000000
000000000000000000000000000000000000000000
000000000000000000000000000000000000000000
000000000000000000000000000000000000000000
or 000000000000000000000000000000000000000000
1
000000000000000000000000000000000000000000
000000000000000000000000000000000000000000
000000000000000000000000000000000000000000
000000000000000000000000000000000000000000
000000000000000000000000000000000000000000
error
code
status
0x00
File successfully
created
status
As first parameter one byte codes the file number in the range 0x00 to 0x07 which the new created file
should get within the currently selected application.
The next byte defines the communication settings, see chapter 3.2.
Then a two byte field defines the Access Rights for the new file, see chapter 3.3.
The next parameter is of three bytes length and codes the size of one single record in bytes. This parameter
has to be in the range from 0x00 00 01 to 0xFF FF FF.
The last parameter is also of three bytes length and codes the number of records. This parameter has to be
in the range from 0x00 00 01 to 0xFF FF FF, too.
Thus the entire file size in the PICC NV-memory is given by RecordSize*MaxNumOfRecords.
Linear Record Files feature always the integrated backup mechanism. Therefore every access appending a
record needs to be validated using the CommitTransaction command, see chapter 4.6.10.
54
CONFIDENTIAL
Philips Semiconductors
Functional Specification
4.5.8 CreateCyclicRecordFile
The CreateCyclicRecordFile command is used to create files for multiple storage of structural data, for
example for logging transactions, within an existing application on the PICC. Once the file is filled completely
with data records, the PICC automatically overwrites the oldest record with the latest written one. This wrap
is fully transparent for the PCD.
CreateCyclicRecordFile(FileNo,Com.Set.,AccessRights,Rec.Size,
MaxNumOfRecords) [11 bytes]
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
PCD:
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
1
1
1
2
3
3
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000
0xC0
cmd
File
No
Com.
Set.
Access
Rights
LSB
MSB LSB
Record Size
MSB LSB
MSB
000000000000000000000000000000000000000000
000000000000000000000000000000000000000000
000000000000000000000000000000000000000000
PICC:
000000000000000000000000000000000000000000
000000000000000000000000000000000000000000
000000000000000000000000000000000000000000
000000000000000000000000000000000000000000
000000000000000000000000000000000000000000
1
000000000000000000000000000000000000000000
000000000000000000000000000000000000000000
000000000000000000000000000000000000000000
000000000000000000000000000000000000000000
000000000000000000000000000000000000000000
or 000000000000000000000000000000000000000000
1
000000000000000000000000000000000000000000
000000000000000000000000000000000000000000
000000000000000000000000000000000000000000
000000000000000000000000000000000000000000
000000000000000000000000000000000000000000
error
code
status
0x00
File successfully
created
status
As first parameter one byte codes the file number in the range 0x00 to 0x07 which the new created file
should get within the currently selected application.
The next byte defines the communication settings, see chapter 3.2.
Then a two byte field defines the Access Rights for the new file, see chapter 3.3.
The next parameter is of three bytes length and codes the size of one single record in bytes. This parameter
has to be in the range from 0x00 00 01 to 0xFF FF FF.
The last parameter is also of three bytes length and codes the number of records. This parameter has to be
in the range from 0x00 00 02 to 0xFF FF FF, too.
Thus the entire file size in the PICC NV-memory is given by RecordSize*MaxNumOfRecords.
Cyclic Record Files feature always the integrated backup mechanism. Therefore every access appending a
record needs to be validated using the CommitTransaction command, see chapter 4.6.10.
Note: as the backup feature consumes one record, the Max. Num Of Records needs to be one larger than
the application requires.
55
CONFIDENTIAL
Philips Semiconductors
Functional Specification
4.5.9 DeleteFile
The DeleteFile command permanently deactivates a file within the file directory of the currently selected
application.
DeleteFile(FileNo) [2 bytes]
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
PCD:
PICC:
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
1
1
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
1
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
or 0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
1
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0xDF
File
No
cmd
error
code
status
0x00
status
This command takes one byte as parameter coding the file number which is to be in the range from 0x00 to
0x0F
The operation of this command invalidates the file directory entry of the specified file which means that the
file cant be accessed anymore.
Depending on the application master key settings, see chapter 4.3.2, a preceding authentication with the
application master key is required.
Allocated memory blocks associated with the deleted file are not set free. The FileNo of the deleted file can
be re-used to create a new file within that application.
To release memory blocks for re-use, the whole PICC user NV-memory needs to be erased using the
FormatPICC command, see chapter 4.4.5.
56
CONFIDENTIAL
Philips Semiconductors
Functional Specification
ReadData(FileNo,Offset,Length) [8bytes]
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
PCD:
PICC:
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
1
1
3
3
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
1
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
or 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
1
1 up to 59
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
1
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
1
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
1
1 up to 59
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0xBD
cmd
File
No
Offset
LSB
Length
MSB LSB
MSB
error
code
status
0xAF
DATA
status
0xAF
status
error
code
status
0x00
DATA
status
The first parameter is of 1 byte length and defines the file number to be read from. This parameter has to be
in the range from 0x00 to 0x0F for Standard Data Files and 0x00 to 0x07 for Backup Data Files, respectively.
The next parameter is of three byte length and codes the starting position for the read operation within the
file (= offset value). This parameter has to be in the range from 0x00 00 00 to file size -1.
The third parameter is also three byte long and specifies the number of data bytes to be read. This
parameter can be in the range from 0x00 00 00 to 0xFF FF FF.
If the third parameter is coded as 0x00 00 00, the entire data file, starting from the position specified in the
offset value, is read.
57
CONFIDENTIAL
Philips Semiconductors
Functional Specification
If the number of bytes to send to the PCD does not fit into one single frame, the PICC waits for a status
frame with status byte 0xAF, before the next frame is sent to the PCD.
If Backup Data Files are read after writing to them, but before issuing the CommitTransaction command, see
chapter 4.6.10, the ReadData command will always retrieve the old, unchanged data stored in the PICC. All
data written to a Backup Data File is validated and externally visible for a ReadData command only after a
CommitTransaction command.
The Read command requires a preceding authentication either with the key specified for Read or
Read&Write access, see chapter 3.3.
Depending on the communication settings, see chapter 3.2, linked to the file, data will be sent by the PICC
either plain, MACed or enciphered. All cryptographic operations are done in CBC mode.
For MACed- and enciphered communication padding on the data is necessary to reach an overall datalength of multiples of eight. In case of a specified data length (command parameter Length 0x00 00 00)
padding is done with all 0x00.
Only in case enciphered communication AND the file is read until it's limit (command parameter Length =
0x00 00 00), the first byte appended for padding is 0x80, all other bytes appended are 0x00 (in accordance
with ISO 9797-1).
NOTE: In case of MACing the padding bytes are only used for cryptographic purpose but NOT exchanged
between PCD and PICC.
58
CONFIDENTIAL
Philips Semiconductors
Functional Specification
4.6.2 WriteData
The WriteData command allows to write data to Standard Data Files and Backup Data Files.
WriteData(FileNo,Offset,Length,Data) [8+bytes]
00000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00PCD:
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000
00 00 00 00 00100 00 00 00 00 00 100 00 00 00 00 00 00 00 00 00 00 00 00300 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 300 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000 00up00 00 00 to00 00 00 5200 00 00 00 00 00 00 00 00 00 00 00 00 00
0000000000000000000000000000000000000000000000000000000000000000000000000000000000
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00100 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000 00 up00 00 00 00to00 00 005900 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0000000000000000000000000000000000000000000000000000000000000000000000000000000000
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0000000000000000000000000000000000000000000000000000000000000000000000000000000000
0x3D
cmd
0xAF
File
No
Offset
LSB
Length
MSB LSB
DATA
MSB
DATA
status
00000000000000000000000000000000000
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00PICC:
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0 0 0 0 0 0 0 010 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
or 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
00 00 00 00 00 00 00 00100 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000000000000000000000000000000000
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 100 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000000000000000000000000000000000
00000000000000000000000000000000000
or 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 010 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0xAF
status
error
code
status
0xAF
status
error
code
status
The first parameter is of 1 byte length and defines the file number to be written to; valid range is 0x00 to
0x0F for Standard Data Files and 0x00 to 0x07 for Backup Data Files, respectively.
The next parameter is of three bytes length and codes the starting position for the write operation within the
file (= offset value). This parameter has to be in the range from 0x00 00 00 to file size -1.
The third parameter is also three bytes long and specifies the number of data bytes to be written. This
parameter can be in the range from 0x00 00 01 to 0xFF FF FF.
If the number of bytes to send does not fit into one single frame, the PCD has to wait for a status frame with
status byte 0xAF before sending the next frame to the PICC.
The Write command requires a preceding authentication either with the key specified for Write or
Read&Write access, see chapter 3.3.
Depending on the communication settings, see chapter 3.2, linked to the file, data needs to be sent by the
PCD either plain, MACed or enciphered. All cryptographic operations are done in CBC mode.
For MACed and enciphered communication padding of the data string is necessary to reach an overall datalength of multiples of eight. This padding is done with all 0x00.
If the WriteData operation is performed on a Backup Data File, it is necessary to validate the written data
with a CommitTransaction command, see chapter 4.6.10. An AbortTransaction command will invalidate all
changes, see chapter 4.6.11.
59
CONFIDENTIAL
Philips Semiconductors
Functional Specification
If data is written to Standard Data Files (without integrated backup mechanism), data is directly programmed
into the visible NV-memory of the file. The new data is immediately available to any following ReadData
commands performed on that file.
Note: In case of MACed or enciphered communication the validity of data is verified by the PICC by
checking the MAC or the CRC (including necessary padding bytes) which is transmitted at the end of the
data frame. If the verification fails (MAC / CRC does not fit data, padding bytes invalid), the PICC stops
further NV-programming and returns an Integrity Error to the PCD, see chapter 3.4. As a consequence of the
Integrity Error any transaction, which might have begun, is automatically aborted.
Note: Getting an Integrity Error when writing on a Standard Data File can corrupt the content of the file.
Note: In case of MACing the padding bytes are only used for cryptographic purpose but NOT exchanged
between PCD and PICC.
60
CONFIDENTIAL
Philips Semiconductors
Functional Specification
4.6.3 GetValue
The GetValue command allows to read the currently stored value from Value Files.
GetValue(FileNo) [2 bytes]
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
PCD:
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
1
1
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
0x6C
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
PICC:
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
1
4(plain),8(enc),8(MACed)
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
or 0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
1
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
File
No
cmd
0x00
DATA
status
error
code
status
The only parameter sent with this command is of one byte length and codes the file number. This parameter
has to be in the range from 0x00 to 0x07.
The PICC response holds the current value of the Value file. Depending on the communication mode data is
either transferred plain (4 bytes), enciphered (8 bytes enciphered data: 4 bytes value, 2 bytes CRC, 2 bytes
padding with 0x00) or MACed (4 bytes value + 4 bytes MAC).
The value is always represented LSB first.
The GetValue command requires a preceding authentication with the key specified for Read, Write or
Read&Write access, see chapter 3.3.
After updating a value file's value but before issuing the CommitTransaction command, the GetValue
command will always retrieve the old, unchanged value which is still the valid one.
61
CONFIDENTIAL
Philips Semiconductors
Functional Specification
4.6.4 Credit
The Credit command allows to increase a value stored in a Value File.
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
PCD:
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
1
1
4(plain),8(enc),8(MACed)
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
0x0C
File
No
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
PICC:
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
1
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
or 0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
1
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
DATA
cmd
0x00
status
error
code
status
The first parameter sent with this command is of one byte length and codes the file number. This parameter
has to be in the range from 0x00 to 0x07.
This command increases the current value stored in the file by a certain amount (4 byte signed integer)
which is transmitted in the data field. Only positive values are allowed for the Credit command.
Depending on the communication mode the value is either transferred plain (4 bytes), enciphered (8 bytes
enciphered data: 4 bytes value, 2 bytes CRC, 2 bytes padding with 0x00) or MACed (4 bytes value + 4 bytes
MAC).
The value is always represented LSB first.
It is necessary to validate the updated value with a CommitTransaction command, see chapter 4.6.10. An
AbortTransaction command will invalidate all changes, see chapter 4.6.11.
The value modifications of Credit, Debit and LimitedCredit commands are cumulated until a
CommitTransaction command is issued.
Credit commands do NEVER modify the Limited Credit Value of a Value file. However, if the Limited Credit
Value needs to be set to 0, a LimitedCredit with value 0 can be used.
The Credit command requires a preceding authentication with the key specified for Read&Write access,
see chapter 3.3.
62
CONFIDENTIAL
Philips Semiconductors
Functional Specification
4.6.5 Debit
The Debit command allows to decrease a value stored in a Value File.
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
PCD:
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
1
1
4(plain),8(enc),8(MACed)
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
0xDC
File
No
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
PICC:
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
1
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
or 0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
1
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
DATA
cmd
0x00
status
error
code
status
The first parameter is of one byte length and codes the file number. This parameter has to be in the range
from 0x00 to 0x07.
The next parameter (4 byte signed integer) holds the value which will be subtracted from the current value
stored in the file. Only positive values are allowed for the Debit command.
Depending on the communication mode the value is either transferred plain (4 bytes), enciphered (8 bytes
enciphered data: 4 bytes value, 2 bytes CRC, 2 bytes padding with 0x00) or MACed (4 bytes value + 4 bytes
MAC).
The value is always represented LSB first.
It is necessary to validate the updated value with a CommitTransaction command, see chapter 4.6.10. An
AbortTransaction command will invalidate all changes, see chapter 4.6.11.
The value modifications of Credit, Debit and LimitedCredit commands are cumulated until a
CommitTransaction command is issued.
The Debit command requires a preceding authentication with one of the keys specified for Read, Write or
Read&Write access, see chapter 3.3.
If the usage of the LimitedCredit feature is enabled, the new limit for a subsequent LimitedCredit command is
set to the sum of Debit commands within one transaction before issuing a CommitTransaction command.
This assures that a LimitedCredit command can not re-book more values than a debiting transaction
deducted before.
63
CONFIDENTIAL
Philips Semiconductors
Functional Specification
4.6.6 LimitedCredit
The LimitedCredit command allows a limited increase of a value stored in a Value File without having full
Read&Write permissions to the file. This feature can be enabled or disabled during value file creation.
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
PCD:
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
1
1
4(plain),8(enc),8(MACed)
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
0x1C
File
No
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
PICC:
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
1
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
or 0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
1
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000
DATA
cmd
0x00
status
error
code
status
The first parameter sent with this command is of one byte length and codes the file number. This parameter
has to be in the range from 0x00 to 0x07.
This command increases the current value stored in the file by a certain amount (4 byte signed integer)
which is transmitted in the data field. Only positive values are allowed for the LimitedCredit command.
Depending on the communication mode the value is either transferred plain (4 bytes), enciphered (8 bytes
enciphered data: 4 bytes value, 2 bytes CRC, 2 bytes padding with 0x00) or MACed (4 bytes value + 4 bytes
MAC).
The value is always represented LSB first.
It is necessary to validate the updated value with a CommitTransaction command, see chapter 4.6.10. An
AbortTransaction command will invalidate all changes, see chapter 4.6.11.
The value modifications of Credit, Debit and LimitedCredit commands are cumulated until a
CommitTransaction command is issued.
The LimitedCredit command requires a preceding authentication with the key specified for Write or "Read
&Write" access, see chapter 3.3.
The value for LimitedCredit is limited to the sum of the Debit commands on this value file within the most
recent transaction containing at least one Debit. After executing the LimitedCredit command the new limit is
set to 0 regardless of the amount which has been re-booked. Therefore the LimitedCredit command can only
be used once after a Debit transaction.
64
CONFIDENTIAL
Philips Semiconductors
Functional Specification
4.6.7 WriteRecord
The WriteRecord command allows to write data to a record in a Cyclic or Linear Record File.
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00WriteRecord(FileNo,Offset,Length,Data)
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00[8+bytes]
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0PCD:
00000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00PICC:
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0 0 0 0 010 0 0 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 030 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 30 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 000 0up0 0 0 to0 0 0 520 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 010 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 or 0 0 0 0 0 0 0 0 010 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000
00 00 00 00 00 00 00100 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000 00up00 00 00 00to00 00 5900 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00100 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 or 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00100 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x3B
cmd
File
No
Offset
LSB
Length
MSB LSB
DATA
MSB
0xAF
status
error
code
status
0xAF
DATA
status
0xAF
status
error
code
status
The first parameter is of one byte length and codes the file number. This parameter has to be in the range
from 0x00 to 0x07.
The next three bytes code the offset within one single record (in bytes). This parameter has to be in the
range from 0x00 00 00 to record size - 1.
This parameter is followed by another three bytes coding the length of data which is to be written to the
record file. This parameter has to be in the range from 0x00 00 01 to record size - offset.
The WriteRecord command appends one record at the end of the linear record file, it erases and overwrites
the oldest record in case of a cyclic record file if it is already full. The entire new record is cleared before data
is written to it.
If no CommitTransaction command (se chapter 4.6.10) is sent after a WriteRecord command, the next
WriteRecord command to the same file writes to the already created record. After sending a
CommitTransaction command, a new WriteRecord command will create a new record in the record file. An
AbortTransaction command will invalidate all changes, see chapter 4.6.11.
After issuing a ClearRecordFile command, but before a CommitTransaction / AbortTransaction command, a
WriteRecord command to the same record file will fail.
65
CONFIDENTIAL
Philips Semiconductors
Functional Specification
Depending on the communication settings, see chapter 3.2, linked to the file, data needs to be sent by the
PCD either plain, MACed or enciphered. All cryptographic operations are done in CBC mode.
For MACed- and enciphered communication padding on the data is necessary to reach an overall datalength of multiples of eight. This padding is done with all 0x00.
The WriteRecord command requires a preceding authentication either with the key specified for Write or
Read&Write access, see chapter 3.3.
NOTE: In case of MACing the padding bytes are only used for cryptographic purpose but NOT exchanged
between PCD and PICC.
66
CONFIDENTIAL
Philips Semiconductors
Functional Specification
4.6.8 ReadRecords
The ReadRecords command allows to read out a set of complete records from a Cyclic or Linear Record
File.
ReadRecords(FileNo,Offset,Length)
[8bytes]
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
PCD:
PICC:
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
1
1
3
3
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
1
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
or 0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
1
1 up to 59
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
1
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
1
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
1
1 up to 59
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0xBB
cmd
File
No
Offset
LSB
Length
MSB LSB
MSB
error
code
status
0xAF
DATA
status
0xAF
status
error
code
status
0x00
DATA
status
The first parameter is of one byte length and codes the file number in the range from 0x00 to 0x07.
The next parameter is three bytes long and codes the offset of the newest record which is read out. In case
of 0x00 00 00 the latest record is read out. The offset value must be in the range from 0x00 to number of
existing records 1.
The third parameter is another three bytes which code the number of records to be read from the PICC.
Records are always transmitted by the PICC in chronological order (= starting with the oldest, which is
number of records 1 before the one addressed by the given offset). If this parameter is set to 0x00 00 00
then all records, from the oldest record up to and including the newest record (given by the offset parameter)
are read.
The allowed range for the number of records parameter is from 0x00 00 00 to number of existing records
offset.
Note: In cyclic record files the maximum number of stored valid records is one less than the number of
records specified in the CreateCyclicRecordFile command.
67
CONFIDENTIAL
Philips Semiconductors
Functional Specification
A ReadRecords command on an empty record file (directly after creation or after a committed clearance, see
chapter 4.6.9) will result in an error.
The ReadRecords command requires a preceding authentication either with the key specified for Read or
Read&Write access, see chapter 3.3.
Depending on the communication settings, see chapter 3.2, linked to the file, data will be sent by the PICC
either plain, MACed or enciphered. All cryptographic operations are done in CBC mode.
For MACed- and enciphered communication padding on the data is necessary to reach an overall datalength of multiples of eight. In case of a specified number of records (command parameter Length
0x00 00 00) padding is done with all 0x00.
Only in case enciphered communication AND the file is read until it's limit (command parameter Length =
0x00 00 00), the first byte appended for padding is 0x80, all other bytes appended are 0x00 (in accordance
with ISO 9797-1).
NOTE: In case of MACing the padding bytes are only used for cryptographic purpose but NOT exchanged
between PCD and PICC.
68
CONFIDENTIAL
Philips Semiconductors
Functional Specification
4.6.9 ClearRecordFile
The ClearRecordFile command allows to reset a Cyclic or Linear Record File to the empty state.
ClearRecordFile(FileNo) [2 bytes]
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
PCD:
PICC:
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
1
1
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
1
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 or 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
1
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0xEB
File
No
cmd
error
code
status
0x00
status
The only parameter sent with this command is of one byte length and codes the file number in the range
from 0x00 to 0x07.
After executing the ClearRecordFile command but before CommitTransaction, all subsequent WriteRecord
commands, see chapter 4.6.7, will fail. The ReadRecords command, see chapter 4.6.8, will return the old still
valid records.
After the CommitTransaction command is issued, a ReadRecords command will fail, WriteRecord
commands will be successful.
An AbortTransaction command (instead of CommitTransaction) will invalidate the clearance, see chapter
4.6.11.
Full Read&Write permission on the file is necessary for executing this command, see chapter 3.3.
69
CONFIDENTIAL
Philips Semiconductors
Functional Specification
4.6.10 CommitTransaction
The CommitTransaction command allows to validate all previous write access on Backup Data Files, Value
Files and Record Files within one application.
CommitTransaction(AID) [1 bytes]
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
PCD:
PICC:
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
1
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
1
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
or 0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
1
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0xC7
cmd
error
code
status
0x00
status
Value Files
The CommitTransaction is typically the last command of a transaction before the ISO 14443-4 Deselect
command or before proceeding with another application (SelectApplication command).
As logical counter-part of the CommitTransaciton command the AbortTransaction command allows to
invalidate changes on files with integrated backup management, see chapter 4.6.11.
70
CONFIDENTIAL
Philips Semiconductors
Functional Specification
4.6.11 AbortTransaction
The AbortTransaction command allows to invalidate all previous write access on Backup Data Files, Value
Files and Record Files within one application.
This is useful to cancel a transaction without the need for re-authentication to the PICC, which would lead to
the same functionality.
AbortTransaction(AID) [1 bytes]
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
PCD:
PICC:
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
1
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
1
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
or 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
1
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0xA7
cmd
error
code
status
0x00
status
Value Files
71
CONFIDENTIAL
Philips Semiconductors
Functional Specification
INS
P1
P2
0x00
0xA4
Mode Opt.
of Sel.
LC
Data
LE
Length
of AID
AID
Description:
This APDU selects an ISO Application by its ISO Application Identifier (AID). The ISO AID of DESFire is
0xD2 76 00 00 85 01 00. The full ISO AID has to be transmitted, partial selection is NOT supported.
Other ISO AIDs are not supported by DESFire.
Data
Remarks
P1
Mode of Selection
P2
Option
Lc
Length
Fixed to 0x07
Data
AID
Response APDU
Data
72
CONFIDENTIAL
Philips Semiconductors
Functional Specification
INS
P1
P2
0x00
0xA4
Mode Opt.
of Sel.
LC
Data
LE
Length
Directory Name
Description:
This APDU selects a DESFire Application by its three byte DESFire Application Identifier (DESFire AID).
The Application can then be the object of subsequent file operations such as READ BINARY or UPDATE
BINARY using their implicit file selection option.
The functionality of the ISO SELECT DIRECTORY Command is compatible with the native DESFire Select
Application command.
Data
Remarks
P1
Mode of Selection
P2
Option
Lc
Length
Data
Directory Name
Response APDU
Data
73
CONFIDENTIAL
Philips Semiconductors
Functional Specification
INS
P1
P2
0x00
0xA4
Mode Opt.
of Sel.
LC
Data
LE
Description:
Based on the transmitted ISO File ID, this APDU selects a DESFire AID and DESFire FID. The Application
can then be the object of subsequent file operations such as READ BINARY or UPDATE BINARY without
using their implicit file selection option.
The functionality of the Select File Command includes an implicit DESFire Select Application command.
Data
Remarks
P1
Mode of Selection
P2
Option
Lc
Length
Fixed to 0x02
Data
File ID
The data field contains the DESFire FID in the lowest nibble of the
last ISO File ID data byte.
The rest of the ISO File ID is padded with 0xE nibbles from the left to
construct a DESFire AID.
Example:
File ID
DESFire AID
DESFire FID
0x00 07
0xEE E0 00
0x07
0xDB 00
0xEE ED B0
0x00
Response APDU
Data
74
CONFIDENTIAL
Philips Semiconductors
Functional Specification
File IDs with 1, 3 or 4 byte are also possible on DESFireG (but not specified in ISO 7816):
Byte
Data
Remarks
P1
Mode of Selection
P2
Option
Lc
Length
Up to 4 bytes
Data
File ID
The data field contains the DESFire FID in the lowest nibble of the
last ISO File ID data byte.
The rest of the ISO File ID is padded with 0xE nibbles from the left to
construct a DESFire AID.
In case a 4 byte ISO File ID is sent, the highest nibble is ignored by
DESFire.
Example:
File ID
DESFire AID
DESFire FID
0x07
0xEE EE E0
0x07
0xAA BB CC
0xEA AB BC
0x0C
0x11 22 33 44
0x12 23 34
0x04
Response APDU
Data
75
CONFIDENTIAL
Philips Semiconductors
Functional Specification
INS
P1
P2
0x00
0xB0
Short file ID /
LC
Data
LE
Bytes
to be
Read
Offset
Description:
Reads up to 59 bytes from a binary file (Standard Data File or Backup Data File). Only short file IDs 0 to
15 are supported. The offset is limited to 15 bits (032767).
The offset is limited to 1 byte (0255) if the file ID is also provided. The File ID is optional when the File has
previously been opened with the ISO SELECT FILE command or with a previous ISO READ BINARY or ISO
UPDATE BINARY with File ID.
If a short file ID is used and no DESFire AID is selected before issuing this command (no ISO SELECT FILE
command or ISO SELECT DIRECTORY command issued), DESFire will select the DESFire AID 0xEE E0
00 automatically.
The Read Binary command is limited to the use of files with the DESFire Access Right for read only access
and / or the read & write access set to key 0xE, indicating free access without cryptographic operations.
Detailed Description of the APDU Fields
Byte
Data
Remarks
P1 / P2
Short File ID /
If bit 8 is set to zero in P1, then P1-P2 code the offset from zero to
32767 (fifteen bits).
If bit 8 is set to one in P1, then bits 7 to 5 of P1 are set to 0 (RFU
bits), bits 4 to 1 of P1 code a short DESFire FID and bits 8 to 1 of P2
code the offset from zero to 255 (eight bits).
The number of bytes to read from the file. The allowed range is 1 to
59 bytes.
Offset
LE
Bytes to Read
Response APDU
Data
76
CONFIDENTIAL
Philips Semiconductors
Functional Specification
INS
P1
P2
0x00
0xD6
Short file ID /
Offset
LC
Data
LE
Bytes
to
write
Description:
Writes up to 52 bytes to a binary file (DESFire Standard Data File or Backup Data File). Only File IDs 0 to
15 are supported. The offset is limited to 15 bits (0 .. 32767).
The offset is limited to 1 byte (0 .. 255) if the File ID is also provided. The File ID is optional if the file has
previously been opened with the Select File command or with a previous Read Binary or Update Binary
including a File ID.
If a short file ID is used and no DESFire AID is selected before issuing this command (no ISO SELECT FILE
command or ISO SELECT DIRECTORY command issued), DESFire will select the DESFire AID 0xEE E0
00 automatically.
If a Backup Data File is used, the DESFire issues an implicit Commit Transaction command. This ensures
that every update of a binary file is treated as a transaction.
The ISO UPDATE BINARY command is limited to the use of files with the Access Right for write only
access and / or read & write access set to key 0xE, indicating free access without cryptographic
operations.
Detailed Description of the APDU Fields
Byte
Data
Remarks
P1 / P2
Short File ID /
If bit 8 is set to zero in P1, then P1-P2 code the offset from zero to
32767 (fifteen bits).
If bit 8 is set to one in P1, then bits 7 to 5 of P1 are set to 0 (RFU
bits), bits 4 to 1 of P1 code a short DESFire FID and bits 8 to 1 of P2
code the offset from zero to 255 (eight bits).
The number of bytes to write to the file. Maximum number of bytes is
52.
Offset
Lc
Bytes to Write
Response APDU
Data
77
CONFIDENTIAL
Philips Semiconductors
Functional Specification
5 DEFINITIONS
This data sheet contains target or goal specifications for product development.
Preliminary specification This data sheet contains preliminary data; supplementary data may be
published later.
Product specification
Limiting values
Limiting values given are in accordance with the Absolute Maximum Rating System (IEC 134). Stress
above one or more of the limiting values may cause permanent damage to the device. These are stress
ratings only and operation of the device at these or at any other conditions above those given in the
Characteristics section of the specification is not implied. Exposure to limiting values for extended
periods may affect device reliability.
Application information
Where application information is given, it is advisory and does not form part of the specification.
78
CONFIDENTIAL
Philips Semiconductors
Functional Specification
7 REVISION HISTORY
Table 1 Objective Specification MF3 IC D40 Revision History
REVISION
3.1
3.0
2.0
1.0
DATE
April 2004
April 2004
April 2003
July 2002
CPCN
PAGE
DESCRIPTION
Integration of ISO 7816 Features
Product Version
Preliminary Version
First official version.
79
CONFIDENTIAL
Contact Information
For additional information please visit http://www.semiconductors.philips.com.Fax: +31 40 27 24825
For sales offices addresses send e-mail to: [email protected].
SCA74
All rights are reserved. Reproduction in whole or in part is prohibited without the prior written consent of the copyright owner.
The information presented in this document does not form part of any quotation or contract, is believed to be accurate and reliable and may be changed
without any notice. No liability will be accepted by the publisher for any consequence of its use. Publication thereof does not convey nor imply any license
under patent- or other industrial or intellectual property rights.
P h ilip s
S e m ic o n d u c t o r s