This library offers utilities to encode and decode APDU objects as well as their responses.
In smart card applications a host typically sends binary APDU data to a secure element and reads back a response. This binary data may be somewhat difficult to create and understand depending on the length of the data, etc. This library can be used to work with APDUs in a more generic and structured way.
Example
.ins = 0x02u,
.p1 = 0x03u,
.p2 = 0x04u,
.lc = 0u,
.data = NULL,
.le = 0u
};
uint8_t *encoded;
size_t encoded_len;
ifx_apdu_encode(&apdu, &encoded, &encoded_len);
uint8_t *response;
size_t response_len;
ifx_protocol_t protocol;
ifx_protocol_activate(&protocol, NULL, NULL);
ifx_protocol_transceive(&protocol, encoded, encoded_len, &response, &response_len);
ifx_apdu_response_decode(&decoded, response, response_len);
if (decoded.
sw != 0x9000u)
{
}
APDU (response) en-/decoding utility.
Generic protocol API (ISO/OSI stack).
Data storage struct for APDU response information.
uint16_t sw
APDU response status word.
Data storage for APDU fields.
uint8_t cla
APDU instruction class.