Document Version 1.0
Last revised on
2018-‐10-‐22
Page 29 of 79
Reference Manual for uTrust 5501 F Reader/Writer Module
6.2.3.
PAPDU_MIFARE_LOAD_KEYS
This command is used to load the key to the volatile memory of the reader. It can be used for all types
of contactless cards. Refer to section 3.2.2.1.4 of [PCSC3] for further details.
Command APDU:
Command
CLA
INS
P1
P2
Lc
Data
Le
Load Keys
0xFF
0x82
Key Struct
Key Num
Key data
Key
-‐
The Key Structure (P1) is defined as follows:
b7
b6
b5
b4
b3
b2
b1
b0
Description
x
0: Card Key; 1 Reader Key
x
0: Plain Transmission, 1: Secured Transmission
x
0: Keys are loaded into the volatile memory
1: Keys are loaded into the non-‐volatile memory.
x
RFU
xxxx
If b6 is set, it is the Reader Key number that has been
used for the encryption, else it is ignored.
Only one reader key (0x00) is supported by uTrust
5501 F
Notes
:
1)
Card keys can be loaded in both “secure” and “non-‐secure” mode. Card keys can only be
loaded to the volatile memory of the reader.
2)
To load card keys in secure mode, the application developer must know the 128 bit AES key
of the reader. The default key is “00010203 05060708 0A0B0C0D 0F101112”.
As a MIFARE key is only 6 bytes in length, data must be padded as per pkcs7 padding scheme
(see example below).
3)
The reader-‐key can only be loaded in secure-‐mode to the non-‐volatile memory of the reader.
The new key is first XORed with the old key and encrypted with the old key. In order to validate
the integrity of the processed key data, a 2 byte CRC must be sent following the key data.
Refer to the example Load Keys – Reader – Secure for details.
4)
The CRC16 is calculated as defined in CRC-‐16-‐CCITT (polynomial 0x8408) with an initial value
of 0x0000.
Response APDU:
Data
Status Word
-‐
SW1, SW2