Struct desfire::comm_cfg

Struct Documentation

struct comm_cfg

Lightweight data structure expressing the communication settings to use for a desfire command.

Note

This is not relevant for the end user, unless you are calling tag::command_status_response, tag::command_response or tag::command_parse_response manually.

Public Functions

inline constexpr comm_cfg(comm_mode txrx, std::size_t sec_data_ofs = 1, bool validated = false)

Constructs (implicitly) a comm_cfg with identical tx and rx modes, set to txrx.

Parameters:
  • txrx – This will be the value for tx and rx.

  • sec_data_ofs – This will be the value for tx_secure_data_offset. Defaults to 1 because the command code is never secured.

  • validated – This will be the value for is_validated.

inline constexpr comm_cfg(comm_mode tx, comm_mode rx, std::size_t sec_data_ofs = 1, bool validated = false)

Constructs a comm_cfg with distinct tx and rx modes.

Parameters:
  • tx – This will be the value for tx.

  • rx – This will be the value for rx.

  • sec_data_ofs – This will be the value for tx_secure_data_offset.

  • validated – This will be the value for is_validated.

Public Members

comm_mode tx = comm_mode::plain

Communication mode to use to send data.

comm_mode rx = comm_mode::plain

Communication mode to use to receive data.

std::size_t tx_secure_data_offset = 0

Offset of the sensitive data that needs to be secure in the outgoing transmission.

bool is_validated = false

Flag marking whether this communication configuration has been tested to be correct. If the user was specifying the communication mode, then this should be set to false. It will produce an extra log message in case of error.

Note

In some cases, e.g. all methods that receive trust_card, the user can specify the communication mode (e.g. in the form of a file_security value). This means that the communication has a chance of failing, if the communication mode does not match the one of the file on the card. For these methods, is_validated should be set to false. For regular communication, it should be set to true. This is used to distinguish between an implementation error (i.e. a command has been issued with the wrong mode, which is an implementation error) or a parameter error (i.e. the user expects a different file security than the one present on the card).