Desfire.ChangeExtKey

This command allows to change any key stored on the card.

The key length has to be set according to the desired encryption algorithm:

Properties

Parameters (request frame)

Name Type/Size Description
- Bit mask (8 bits) -
MasterKeyType Enumeration (bit mask area 0xC0) These bits must only be set if the card's Master Key is changed. They specify the type of the new card's Master Key.
Values:
  • DESorTripleDES (0)
  • ThreeKeyTripleDES (1)
  • AES (2)
RFU Integer (bit mask area 0x30) Zero padding
IsKeySet Boolean (bit 0x08) Only needed for Desfire EV2 with multiple Keysets. If true,the reader executes the Desfire "ChangeKeyEV2" command instead of the Desfire "ChangeKey" command.
IsAesKey Boolean (bit 0x04) Has to be set if the new key is an AES key.
IsVersion Boolean (bit 0x02) Has to be set if the NewKeyVersion parameter is present.
IsChangeKey Boolean (bit 0x01)

Has to be set if the key used to authenticate the card is the key that needs to be changed (as specified in KeyNo ).

In this case, the parameter OldKey has to be omitted.

KeyNo Integer (8 bits) Number of key (0-13) to modify. Has to be 0 if the application Master Key is changed.
Optional field, condition: IsVersion
KeyVersion Integer (8 bits)

Version of the new key.

Remarks:

  • If this value is not available (i.e. if IsVersion is not set), 0 will be assumed as NewKeyVersion.
Length of NewKey Integer (8 bits) Length of NewKey in bytes
NewKey Raw data New key (16 bytes).
Length of OldKey Integer (8 bits) Length of OldKey in bytes
OldKey Raw data Current key (16 bytes).
Optional field, condition: IsKeySet
KeySet Integer (8 bits) specifies KeySet needed for multiple keysets (EV2 extension).

Returned values (response frame)

None