Document Version 1.2
Last revised on
2017-09-26
Page 31 of 92
Reference Manual for uTrust 4701F and uTrust 4711F Readers
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 kinds
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
47xx 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 the card keys in secure mode, the application developer has to 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 needs to be padded as per pkcs7 padding
scheme (see example below).
3)
The Reader-key can only be loaded in the 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 has got to 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