Desfire.ExecCommand

Generic command to communicate to a DESFire card. Depending on the value of the CryptoMode parameter, data will be transmitted plain, MACed or encrypted.

The DESFire command frame has to be split into two parts, header and data. The data block will be encrypted whereas the header block is left unencrypted.

Example: in the Desfire ChangeKeySettings command, the header is empty. The encrypted key settings will be transferred in the data block.

Properties

Parameters (request frame)

Name Type/Size Description
Cmd Integer (8 bits) DESFire Command code
Length of Header Integer (8 bits) Length of Header in bytes
Raw data Header of command. The header is always sent buf unencrypted. It must not be larger than 59 bytes.
Length of Param Integer (16 bits) Length of Param in bytes
Param Raw data Parameter data of command (will be encrypted or MACed according to the value of the CryptoMode variable).
CryptoMode Enumeration (8 bits) Type of encryption.
Values:
  • Plain (0)
  • MAC (1)
  • Encrypted (3)
ResponseLen Integer (16 bits) Expected length of response. For commands where the length of the response is not known by the host (i.e. Desfire.ReadData with Len = 0), this value has to be set to 0xFFFF.

Returned values (response frame)

Name Type/Size Description
Length of Resp Integer (16 bits) Length of Resp in bytes
Resp Raw data Response of command.