C API for BALTECH SDK

§ brp_Desfire_ExecCommand()

brp_errcode brp_Desfire_ExecCommand ( brp_protocol  protocol,
unsigned  Cmd,
brp_buf  Header,
size_t  Header_len,
brp_buf  Param,
size_t  Param_len,
brp_Desfire_ExecCommand_CryptoMode  CryptoMode,
unsigned  ResponseLen,
brp_buf Resp,
size_t *  Resp_len,
brp_mempool mempool 
)

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]protocolused to execute the command
[in]CmdDESFire Command code
[in]HeaderHeader of command. The header is always sent bufunencrypted. It must not be larger than 59 bytes.
[in]Header_len
[in]ParamParameter data of command (will be encrypted or MACed according to the value of the CryptoMode variable).
[in]Param_len
[in]CryptoModeType of encryption.
[in]ResponseLenExpected 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.
[out]RespResponse of command.
[out]Resp_len
[in]mempoolis 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