Generic Access Control Data Model, MIFARE Plus, MIFARE DESFire EV1, MIFARE SAM AV2, SmartMX, a generic approach for physical access control applications.

Key Management

The card identifier object contains information that can be used in the discovery phase of the card.

 There shall be three basic keys per site that will be used with this application. Each key, except the general mutual authentication key, shall be diversified by the described algorithm in this document. The three keys shall be an Application Master key, application validation key, general mutual authentication key and a originality and cloning protection system key. If a random Identifier is returned during anti-collision, the application will have to query the card for a unique identifier after using the general mutual authentication key for authentication. The layout of the application and keys are illustrated below.

Mifare DESFire 4K Full Colour Printing Cards,Mifare DESFire 4K Full Colour Printing Cards,ISO Mifare DESFire EV1 4K Card,Mifare DESFire 4K Card,

(1) Key 0 – Application Master Key
(2) Key 1 – Application Validation Key
Fig 2. Key Management Diagram

Application Master Key (APPMK – Key 0)

UID based diversified key that is stored on the card. The master key is stored on the backend system. This key is only used for personalization and administration of the data objects.

Application Validation Key (APPVK – Key 1)
UID based diversified key that is stored on the card. The master key is stored on the backend system. This key is only used for validation / authentication of the data objects.

Originality and cloning protection System Key (OCPSK)
UID based diversified key that is used for the calculation of the digital signature in each of the data objects. This key is not stored on the card.

General Mutual Authentication Key (GMAK)
This key is used for general mutual authentication when a random identifier method is used during anti-collision. Each card shall have a method to retrieve a unique, non changing identifier that shall be used for key diversification and originality check.

Key Diversification
All keys, except the General Mutual Authentication Key (GMAK) shall be diversified, based on the UID of the card. Therefore, the secret keys are unique to every card in the system. The key diversification is performed using the following non-reversible algorithms. The preferred method of key diversification will be the AES algorithm. This algorithm is defined below. If DES key diversification is required, see the below basic algorithms for the DIV constants and DIV inputs. Please consult the NXP document AN1653**MIFARE SAM AV2 Key Diversification for further description of DES key diversification.

Diversification of AES 16-byte keys
The following diagram shows the 16-byte AES key diversification scheme.

ISO 14443 A Mifare DESFire EV1 4K Cards,Mifare DESFire EV1 4K Blank White Cards,Mifare DESFire EV1 4K Access Control Cards,

AES DIV constant 1: 0×01 DIV Input: Message with length of 31 bytes. This DIV input contains the AES DIV constant, UID of the card and padding, if necessary.

Example:

Secret Key : 0xf3f9377698707b688eaf84abe39e3791 UID : 0x04deadbeeffeed Div Constant : 0×01

Step 1: Generate subkeys

Generate K0: K0 = CIPHK(0b). Encrypt 0s using Secret Key. Here K0 = 0x6704a3af8af3d920a0a7594f5cebf9fd

Generate K1: If MSB(K0) = 0, then K1 = K0 << 1; Else K1 = (K0 << 1) XOR 0×00000000000000000000000000000087; Shift K0 one bit left. If Most Significant Bit of K0 is not 0, XOR shifted result with 0×00000000000000000000000000000087. Here K1 = 0xce09475f15e7b241414eb29eb9d7f3fa

Generate K2: If MSB(K1) = 0, then K2 = K1 << 1; Else K2 = (K1 << 1) XOR 0×00000000000000000000000000000087. Shift K1 one bit left. If Most Significant Bit of K1 is not 0 XOR shifted result with 0×00000000000000000000000000000087 Here K2 = 0x9c128ebe2bcf6482829d653d73afe773.

Step 2 : Create Div Input Div Constant + UID + Padding 0x0104deadbeeffeed800000000000000000000000000000000000000000000000

Step 3 : XOR string Since padding occurred, K2 will be XOR’d with Div Input Result –

0x0104deadbeeffeed80000000000000009c128ebe2bcf6482829d653d73afe773

Step 4: Encrypt the above result with Secret Key Result – 0x901789466c3d5fb6c885ab59139e132f0bb408baff98b6ee9f2e1585777f6a51

Step 5 : Diversified Key would be the last 16 byte block ( Block 2 ) of the encryption result. Diversified key is 0x0bb408baff98b6ee9f2e1585777f6a5

Diversification of 16 bytes (2-key) TDEA keys
The following diagram shows the 16-byte TDEA key diversification scheme.

Mifare DESFire EV1 4K Contactless Cards,Mifare DESFire EV1 4K Silk Screen Printing Cards,Mifare DESFire EV1 4K ISO Printing cards,

DES DIV Constant 1: 0×21
DES DIV Constant 2: 0×22
DIV Input: Message with length of 31 bytes. This DIV input contains the
DES DIV constant, UID of the card and padding, if necessary.

Diversification of 24 bytes (3-key) TDEA keys
The following diagram shows the 24-byte TDEA key diversification scheme.

Mifare DESFire EV1 4K Proximity Cards,Mifare DESFire 4K Pre-printed Card,Mifare DESFire 4K Offset Printing Card,ISO MIFARE DESFire EV1 Smart Card 4k byte/32k bit,

DES DIV Constant 3: 0×31
DES DIV Constant 4: 0×32
DES DIV Constant 5: 0×33
DIV Input: Message with length of 31 bytes. This DIV input contains the DES DIV
constant, UID of the card and padding, if necessary.