BALTECH SDK wrapper functions reference

§ brp_Desfire_ExecCommand()

brp_errcode brp_Desfire_ExecCommand ( brp_Desfire_ExecCommand_t  params)

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.

Parameters
[in]paramsStruct with the following fields:
  • protocol used to execute the command
  • Cmd (in) DESFire Command code
  • Header (in) Header of command. The header is always sent buf unencrypted. It must not be larger than 59 bytes.
  • Header_len (in) Length of Header (in bytes).
  • Param (in) Parameter data of command (will be encrypted or MACed according to the value of the CryptoMode variable).
  • Param_len (in) Length of Param (in bytes).
  • CryptoMode (in) Type of encryption.
  • ResponseLen (in) Expected length of response. For commands where the length of the response is not known by the host (i.e. brp_Desfire_ReadData() with Len = 0), this value has to be set to 0xFFFF.
  • Resp (out) Response of command.
  • Resp_len (out) Length of Resp (in bytes).
  • mempool (in) is used to store response data. Maybe NULL to use an internal mempool, in this case the data is only available until another command uses the internal mempool