a5000plugntrust 2.1.0.0
A5000 Plug n Trust Click Driver

API for configuring and manipulating A5000 Plug n Trust Click driver. More...

Topics

 Protocol Control Byte
 List of pcb of A5000 Plug n Trust Click driver.
 
 A5000 Plug n Trust Registers List
 List of registers of A5000 Plug n Trust Click driver.
 
 A5000 Plug n Trust Registers Settings
 Settings for registers of A5000 Plug n Trust Click driver.
 
 A5000 Plug n Trust MikroBUS Map
 MikroBUS pin mapping of A5000 Plug n Trust Click driver.
 

Functions

void a5000plugntrust_cfg_setup (a5000plugntrust_cfg_t *cfg)
 A5000 Plug n Trust configuration object setup function.
 
err_t a5000plugntrust_init (a5000plugntrust_t *ctx, a5000plugntrust_cfg_t *cfg)
 A5000 Plug n Trust initialization function.
 
err_t a5000plugntrust_apdu_write (a5000plugntrust_t *ctx, a5000plugntrust_frame_data_t *frame_data)
 Writing frame data function.
 
err_t a5000plugntrust_apdu_read (a5000plugntrust_t *ctx, a5000plugntrust_frame_data_t *frame_data)
 Reading frame data function function.
 
err_t a5000plugntrust_apdu_transfer (a5000plugntrust_t *ctx, a5000plugntrust_frame_data_t *frame_data)
 Write-Read frame data function.
 
void a5000plugntrust_set_en (a5000plugntrust_t *ctx, uint8_t state)
 Set Enable pin state.
 
void a5000plugntrust_set_tlv_u8 (uint8_t *buf, uint8_t *buf_len, uint8_t tag, uint8_t value)
 Add TLV data of 1 byte value in payload buffer.
 
void a5000plugntrust_set_tlv_u16 (uint8_t *buf, uint8_t *buf_len, uint8_t tag, uint16_t value)
 Add TLV data of 2 bytes value in payload buffer.
 
void a5000plugntrust_set_tlv_u16_optional (uint8_t *buf, uint8_t *buf_len, uint8_t tag, uint16_t value)
 Add TLV data of 2 bytes value in payload buffer if value is greater then 0.
 
void a5000plugntrust_set_tlv_u32 (uint8_t *buf, uint8_t *buf_len, uint8_t tag, uint32_t value)
 Add TLV data of 4 bytes value in payload buffer.
 
err_t a5000plugntrust_set_tlv_u8buf (uint8_t *buf, uint8_t *buf_len, uint8_t tag, uint8_t *cmd, uint32_t cmd_len)
 Add TLV data buffer in payload buffer.
 
err_t a5000plugntrust_set_tlv_u8buf_optional (uint8_t *buf, uint8_t *buf_len, uint8_t tag, uint8_t *cmd, uint32_t cmd_len)
 Add TLV data buffer in payload buffer if TLV data buffer length greater then 0.
 
err_t a5000plugntrust_get_tlv_u8 (uint8_t *buf, uint32_t *buf_index, uint8_t tag, uint8_t *rsp)
 Parses TLV data from payload buffer to find data for desired tag.
 
err_t a5000plugntrust_get_tlv_u16 (uint8_t *buf, uint32_t *buf_index, uint8_t tag, uint16_t *rsp)
 Parses TLV data from payload buffer to find data for desired tag.
 
err_t a5000plugntrust_get_tlv_u8buf (uint8_t *buf, uint32_t *buf_index, uint8_t buf_len, uint8_t tag, uint8_t *rsp, uint32_t *rsp_len)
 Parses TLV data from payload buffer to find data for desired tag.
 
uint8_t a5000plugntrust_calculate_apdu_size (a5000plugntrust_apdu_t *apdu_data)
 Calculates APDU object size.
 
err_t a5000plugntrust_end_apdu_session (a5000plugntrust_t *ctx)
 Sends command for ending APDU session.
 
err_t a5000plugntrust_object_id_list (a5000plugntrust_t *ctx, uint32_t *id_list, uint8_t *list_len)
 Reads all Object ID's from Applet.
 
err_t a5000plugntrust_sw_reset (a5000plugntrust_t *ctx, a5000plugntrust_atr_t *atr_data)
 Sends request to reset device and reads ATR data.
 
err_t a5000plugntrust_select_applet (a5000plugntrust_t *ctx, uint8_t ns_encode, a5000plugntrust_version_info_t *ver_info)
 Selects Clicks Applet and returns info that device sends back to host.
 
err_t a5000plugntrust_select_card_manager (a5000plugntrust_t *ctx, uint8_t rsp, uint8_t *cardmanager_rsp, uint8_t *cardmanager_rsp_len)
 Select card manager.
 
err_t a5000plugntrust_get_free_memory (a5000plugntrust_t *ctx, uint8_t memory_type, uint16_t *free_memory)
 Reads Applet free memory.
 
err_t a5000plugntrust_get_random_numbers (a5000plugntrust_t *ctx, uint8_t *random_buf, uint8_t buf_len)
 Get random data.
 
err_t a5000plugntrust_check_object_exist (a5000plugntrust_t *ctx, uint32_t object_id)
 Check if object exists.
 
err_t a5000plugntrust_delete_object (a5000plugntrust_t *ctx, uint32_t object_id)
 Delete object.
 
err_t a5000plugntrust_read_object (a5000plugntrust_t *ctx, uint32_t object_id, uint16_t offset, uint16_t read_len, uint8_t *data_buf, uint32_t *data_len)
 Read object data.
 
err_t a5000plugntrust_write_binary_object (a5000plugntrust_t *ctx, uint32_t object_id, uint16_t offset, uint16_t data_len, uint8_t *data_buf)
 Create/Write to binary object.
 
err_t a5000plugntrust_get_applet_info (a5000plugntrust_t *ctx, a5000plugntrust_version_info_t *ver_info)
 Get Version info from Applet.
 

Detailed Description

API for configuring and manipulating A5000 Plug n Trust Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ a5000plugntrust_apdu_read()

err_t a5000plugntrust_apdu_read ( a5000plugntrust_t * ctx,
a5000plugntrust_frame_data_t * frame_data )

Reading frame data function function.

This function reads a frame_data from device.

Parameters
[in]ctx: Click context object. See a5000plugntrust_t object definition for detailed explanation.
[out]frame_data: Communication data. See a5000plugntrust_frame_data_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ a5000plugntrust_apdu_transfer()

err_t a5000plugntrust_apdu_transfer ( a5000plugntrust_t * ctx,
a5000plugntrust_frame_data_t * frame_data )

Write-Read frame data function.

This function writes a frame_data and then reads return data from device and stores it in frame_data.

Parameters
[in]ctx: Click context object. See a5000plugntrust_t object definition for detailed explanation.
[in,out]frame_data: Communication data. See a5000plugntrust_frame_data_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ a5000plugntrust_apdu_write()

err_t a5000plugntrust_apdu_write ( a5000plugntrust_t * ctx,
a5000plugntrust_frame_data_t * frame_data )

Writing frame data function.

This function writes a frame_data to device.

Parameters
[in]ctx: Click context object. See a5000plugntrust_t object definition for detailed explanation.
[in]frame_data: Communication data. See a5000plugntrust_frame_data_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ a5000plugntrust_calculate_apdu_size()

uint8_t a5000plugntrust_calculate_apdu_size ( a5000plugntrust_apdu_t * apdu_data)

Calculates APDU object size.

Goes through apdu object and returns size value of it.

Parameters
[in]apdu_data: APDU object. See a5000plugntrust_apdu_t object definition for detailed explanation.
Returns
Value size of APDU data object
Note
On the start return value is 4[CLA,INS,P1,P2] and then adds payload_len and rsp_len.

◆ a5000plugntrust_cfg_setup()

void a5000plugntrust_cfg_setup ( a5000plugntrust_cfg_t * cfg)

A5000 Plug n Trust configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See a5000plugntrust_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ a5000plugntrust_check_object_exist()

err_t a5000plugntrust_check_object_exist ( a5000plugntrust_t * ctx,
uint32_t object_id )

Check if object exists.

Sends request to check if object with object_id exists.

Parameters
[in]ctx: Click context object. See a5000plugntrust_t object definition for detailed explanation.
[in]object_id: Object ID.
Returns
  • 1 - Does exists,
  • 2 - Doesn't exist,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
Functions a5000plugntrust_select_card_manager and a5000plugntrust_select_applet needs to be called for this function to be successful. At the end of function it calls a5000plugntrust_end_apdu_session function.

◆ a5000plugntrust_delete_object()

err_t a5000plugntrust_delete_object ( a5000plugntrust_t * ctx,
uint32_t object_id )

Delete object.

Sends request to delete object with object_id.

Parameters
[in]ctx: Click context object. See a5000plugntrust_t object definition for detailed explanation.
[in]object_id: Object ID.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
Functions a5000plugntrust_select_card_manager and a5000plugntrust_select_applet needs to be called for this function to be successful. At the end of function it calls a5000plugntrust_end_apdu_session function.

◆ a5000plugntrust_end_apdu_session()

err_t a5000plugntrust_end_apdu_session ( a5000plugntrust_t * ctx)

Sends command for ending APDU session.

This function sends SBLOCK request for ending APDU session.

Parameters
[in]ctx: Click context object. See a5000plugntrust_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ a5000plugntrust_get_applet_info()

err_t a5000plugntrust_get_applet_info ( a5000plugntrust_t * ctx,
a5000plugntrust_version_info_t * ver_info )

Get Version info from Applet.

Sends request to read version info from Applet.

Parameters
[in]ctx: Click context object. See a5000plugntrust_t object definition for detailed explanation.
[out]ver_info: Version info data. See #ver_info object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
Functions a5000plugntrust_select_card_manager and a5000plugntrust_select_applet needs to be called for this function to be successful. At the end of function it calls a5000plugntrust_end_apdu_session function.

◆ a5000plugntrust_get_free_memory()

err_t a5000plugntrust_get_free_memory ( a5000plugntrust_t * ctx,
uint8_t memory_type,
uint16_t * free_memory )

Reads Applet free memory.

Sends request to check free memory of memory_type.

Parameters
[in]ctx: Click context object. See a5000plugntrust_t object definition for detailed explanation.
[in]memory_type: Memory type to check. See #Memory type definition for memory type options.
[out]free_memory: Response buffer.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
Functions a5000plugntrust_select_card_manager and a5000plugntrust_select_applet needs to be called for this function to be successful. At the end of function it calls a5000plugntrust_end_apdu_session function.

◆ a5000plugntrust_get_random_numbers()

err_t a5000plugntrust_get_random_numbers ( a5000plugntrust_t * ctx,
uint8_t * random_buf,
uint8_t buf_len )

Get random data.

Sends request to get buff_len of random data.

Parameters
[in]ctx: Click context object. See a5000plugntrust_t object definition for detailed explanation.
[out]random_buf: Buffer to store random data.
[in]buf_len: Length of random buffer data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
Functions a5000plugntrust_select_card_manager and a5000plugntrust_select_applet needs to be called for this function to be successful. At the end of function it calls a5000plugntrust_end_apdu_session function.

◆ a5000plugntrust_get_tlv_u16()

err_t a5000plugntrust_get_tlv_u16 ( uint8_t * buf,
uint32_t * buf_index,
uint8_t tag,
uint16_t * rsp )

Parses TLV data from payload buffer to find data for desired tag.

Searches APDU payload response to find 2 bytes of value for desired tag.

Parameters
[in]buf: Input buffer.
[in,out]buf_index: Buffer index to search from.
[in]tag: Tag of TLV data.
[out]rsp: Value of TLV data.
Returns
  • 0 - Data found,
  • -1 - Data missing. See #err_t definition for detailed explanation.
Note
None. Example
uint32_t buff_index = 0;
uint16_t value = 0;
a5000plugntrust_get_tlv_u16( frame_data.apdu->payload, &parse_index, A5000PLUGNTRUST_TLV_TAG_1, &value )
err_t a5000plugntrust_get_tlv_u16(uint8_t *buf, uint32_t *buf_index, uint8_t tag, uint16_t *rsp)
Parses TLV data from payload buffer to find data for desired tag.
#define A5000PLUGNTRUST_TLV_TAG_1
Definition a5000plugntrust.h:295

◆ a5000plugntrust_get_tlv_u8()

err_t a5000plugntrust_get_tlv_u8 ( uint8_t * buf,
uint32_t * buf_index,
uint8_t tag,
uint8_t * rsp )

Parses TLV data from payload buffer to find data for desired tag.

Searches APDU payload response to find 1 byte of value for desired tag.

Parameters
[in]buf: Input buffer.
[in,out]buf_index: Buffer index to search from.
[in]tag: Tag of TLV data.
[out]rsp: Value of TLV data.
Returns
  • 0 - Data found,
  • -1 - Data missing. See #err_t definition for detailed explanation.
Note
None. Example
uint32_t buff_index = 0;
uint8_t value = 0;
a5000plugntrust_get_tlv_u8( frame_data.apdu->payload, &parse_index, A5000PLUGNTRUST_TLV_TAG_1, &value )
err_t a5000plugntrust_get_tlv_u8(uint8_t *buf, uint32_t *buf_index, uint8_t tag, uint8_t *rsp)
Parses TLV data from payload buffer to find data for desired tag.

◆ a5000plugntrust_get_tlv_u8buf()

err_t a5000plugntrust_get_tlv_u8buf ( uint8_t * buf,
uint32_t * buf_index,
uint8_t buf_len,
uint8_t tag,
uint8_t * rsp,
uint32_t * rsp_len )

Parses TLV data from payload buffer to find data for desired tag.

Searches APDU payload response to find 4 bytes of value for desired tag.

Parameters
[in]buf: Input buffer.
[in,out]buf_index: Buffer index to search from.
[in]buf_len: Input buffer length.
[in]tag: Tag of TLV data.
[out]rsp: Buffer of TLV data.
[in,out]rsp_len: Rsp buffer length.
Returns
  • 0 - Data found,
  • -1 - Error parssing data. See #err_t definition for detailed explanation.
Note
None. Example
uint32_t buff_index = 0;
uint8_t parse_len = 0xFF;
uint8_t data_out[ 0xFF ] = 0;
a5000plugntrust_get_tlv_u8buf( frame_data.apdu->payload, &parse_index, frame_data.len,
A5000PLUGNTRUST_TLV_TAG_1, data_out, &parse_len )
err_t a5000plugntrust_get_tlv_u8buf(uint8_t *buf, uint32_t *buf_index, uint8_t buf_len, uint8_t tag, uint8_t *rsp, uint32_t *rsp_len)
Parses TLV data from payload buffer to find data for desired tag.

◆ a5000plugntrust_init()

err_t a5000plugntrust_init ( a5000plugntrust_t * ctx,
a5000plugntrust_cfg_t * cfg )

A5000 Plug n Trust initialization function.

This function initializes all necessary pins and peripherals used for this click board.

Parameters
[out]ctx: Click context object. See a5000plugntrust_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See a5000plugntrust_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ a5000plugntrust_object_id_list()

err_t a5000plugntrust_object_id_list ( a5000plugntrust_t * ctx,
uint32_t * id_list,
uint8_t * list_len )

Reads all Object ID's from Applet.

Reads list of all objects from Applet and outputs array of objects ID's.

Parameters
[in]ctx: Click context object. See a5000plugntrust_t object definition for detailed explanation.
[out]id_list: Buffer of Object ID's.
[out]list_len: Length of id_list.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
By default Applet has 26 predefined and reserved objects.

◆ a5000plugntrust_read_object()

err_t a5000plugntrust_read_object ( a5000plugntrust_t * ctx,
uint32_t object_id,
uint16_t offset,
uint16_t read_len,
uint8_t * data_buf,
uint32_t * data_len )

Read object data.

Sends request to read object data of object with object_id.

Parameters
[in]ctx: Click context object. See a5000plugntrust_t object definition for detailed explanation.
[in]object_id: Object ID.
[in]offset: Offset read data OPTIONAL: set 0 if not needed.
[in]read_len: Length to be read OPTIONAL: set 0 to read full data from object.
[out]data_buf: Read data buffer.
[out]data_len: Length of read data bffer.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
Functions a5000plugntrust_select_card_manager and a5000plugntrust_select_applet needs to be called for this function to be successful. At the end of function it calls a5000plugntrust_end_apdu_session function.

◆ a5000plugntrust_select_applet()

err_t a5000plugntrust_select_applet ( a5000plugntrust_t * ctx,
uint8_t ns_encode,
a5000plugntrust_version_info_t * ver_info )

Selects Clicks Applet and returns info that device sends back to host.

Selects Clicks Applet and returns version info that device sens back to host.

Parameters
[in]ctx: Click context object. See a5000plugntrust_t object definition for detailed explanation.
[in]ns_encode: NS encode of I-Block.
[out]ver_info: Version info data. See a5000plugntrust_version_info_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ a5000plugntrust_select_card_manager()

err_t a5000plugntrust_select_card_manager ( a5000plugntrust_t * ctx,
uint8_t rsp,
uint8_t * cardmanager_rsp,
uint8_t * cardmanager_rsp_len )

Select card manager.

Selects card manager and depending of rsp parameter returns data to host.

Parameters
[in]ctx: Click context object. See a5000plugntrust_t object definition for detailed explanation.
[in]rsp: Request response from card manager.
[out]cardmanager_rsp: Response buffer.
[out]cardmanager_rsp_len: Length of response buffer.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ a5000plugntrust_set_en()

void a5000plugntrust_set_en ( a5000plugntrust_t * ctx,
uint8_t state )

Set Enable pin state.

This function sets en pin state.

Parameters
[in]ctx: Click context object. See a5000plugntrust_t object definition for detailed explanation.
[in]state: Logic state.
Returns
Nothing.
Note
None.

◆ a5000plugntrust_set_tlv_u16()

void a5000plugntrust_set_tlv_u16 ( uint8_t * buf,
uint8_t * buf_len,
uint8_t tag,
uint16_t value )

Add TLV data of 2 bytes value in payload buffer.

Concatenates TLV data in APDU payload for writing data to device.

Parameters
[out]buf: Output buffer.
[out]buf_len: Output buffer size, incresed by adding TLV.
[in]tag: Tag of TLV data.
[in]value: Value of TLV data.
Returns
Nothing.
Note
None. Example
uint16_t offset = 0;
a5000plugntrust_set_tlv_u16( frame_data.apdu->payload, &frame_data.apdu->payload_len,
void a5000plugntrust_set_tlv_u16(uint8_t *buf, uint8_t *buf_len, uint8_t tag, uint16_t value)
Add TLV data of 2 bytes value in payload buffer.
#define A5000PLUGNTRUST_TLV_TAG_2
Definition a5000plugntrust.h:296

◆ a5000plugntrust_set_tlv_u16_optional()

void a5000plugntrust_set_tlv_u16_optional ( uint8_t * buf,
uint8_t * buf_len,
uint8_t tag,
uint16_t value )

Add TLV data of 2 bytes value in payload buffer if value is greater then 0.

Calls a5000plugntrust_set_tlv_u16 if value parameter is greater then 0.

Parameters
[out]buf: Output buffer.
[out]buf_len: Output buffer size, incresed by adding TLV.
[in]tag: Tag of TLV data.
[in]value: Value of TLV data.
Returns
Nothing.
Note
None. Example
uint16_t offset = 10;
a5000plugntrust_set_tlv_u16_optional( frame_data.apdu->payload, &frame_data.apdu->payload_len,
void a5000plugntrust_set_tlv_u16_optional(uint8_t *buf, uint8_t *buf_len, uint8_t tag, uint16_t value)
Add TLV data of 2 bytes value in payload buffer if value is greater then 0.

◆ a5000plugntrust_set_tlv_u32()

void a5000plugntrust_set_tlv_u32 ( uint8_t * buf,
uint8_t * buf_len,
uint8_t tag,
uint32_t value )

Add TLV data of 4 bytes value in payload buffer.

Concatenates TLV data in APDU payload for writing data to device.

Parameters
[out]buf: Output buffer.
[out]buf_len: Output buffer size, incresed by adding TLV.
[in]tag: Tag of TLV data.
[in]value: Value of TLV data.
Returns
Nothing.
Note
None. Example
uint32_t object_id = 0x12345678;
a5000plugntrust_set_tlv_u32( frame_data.apdu->payload, &frame_data.apdu->payload_len,
void a5000plugntrust_set_tlv_u32(uint8_t *buf, uint8_t *buf_len, uint8_t tag, uint32_t value)
Add TLV data of 4 bytes value in payload buffer.

◆ a5000plugntrust_set_tlv_u8()

void a5000plugntrust_set_tlv_u8 ( uint8_t * buf,
uint8_t * buf_len,
uint8_t tag,
uint8_t value )

Add TLV data of 1 byte value in payload buffer.

Concatenates TLV data in APDU payload for writing data to device.

Parameters
[out]buf: Output buffer.
[out]buf_len: Output buffer size, incresed by adding TLV.
[in]tag: Tag of TLV data.
[in]value: Value of TLV data.
Returns
Nothing.
Note
None. Example
a5000plugntrust_set_tlv_u8( frame_data.apdu->payload, &frame_data.apdu->payload_len,
void a5000plugntrust_set_tlv_u8(uint8_t *buf, uint8_t *buf_len, uint8_t tag, uint8_t value)
Add TLV data of 1 byte value in payload buffer.
#define A5000PLUGNTRUST_MEM_PERSISTENT
Memory type.
Definition a5000plugntrust.h:274

◆ a5000plugntrust_set_tlv_u8buf()

err_t a5000plugntrust_set_tlv_u8buf ( uint8_t * buf,
uint8_t * buf_len,
uint8_t tag,
uint8_t * cmd,
uint32_t cmd_len )

Add TLV data buffer in payload buffer.

Concatenates TLV data in APDU payload for writing data to device.

Parameters
[out]buf: Output buffer.
[out]buf_len: Output buffer size, incresed by adding TLV.
[in]tag: Tag of TLV data.
[in]cmd: TLV data buffer.
[in]cmd_len: TLV data buffer length.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None. Example
#define AES_KEY_SIZE 16
uint8_t aes_key[ AES_KEY_SIZE ] = { 0 }
a5000plugntrust_set_tlv_u8buf( frame_data.apdu->payload, &frame_data.apdu->payload_len,
err_t a5000plugntrust_set_tlv_u8buf(uint8_t *buf, uint8_t *buf_len, uint8_t tag, uint8_t *cmd, uint32_t cmd_len)
Add TLV data buffer in payload buffer.
#define A5000PLUGNTRUST_TLV_TAG_3
Definition a5000plugntrust.h:297
#define AES_KEY_SIZE

◆ a5000plugntrust_set_tlv_u8buf_optional()

err_t a5000plugntrust_set_tlv_u8buf_optional ( uint8_t * buf,
uint8_t * buf_len,
uint8_t tag,
uint8_t * cmd,
uint32_t cmd_len )

Add TLV data buffer in payload buffer if TLV data buffer length greater then 0.

Calls a5000plugntrust_set_tlv_u8buf if cmd_len parameter is greater then 0.

Parameters
[out]buf: Output buffer.
[out]buf_len: Output buffer size, incresed by adding TLV.
[in]tag: Tag of TLV data.
[in]cmd: TLV data buffer.
[in]cmd_len: TLV data buffer length.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None. Example
#define AES_KEY_SIZE 16
uint8_t aes_key[ AES_KEY_SIZE ] = { 0 }
a5000plugntrust_set_tlv_u8buf_optional( frame_data.apdu->payload, &frame_data.apdu->payload_len,
err_t a5000plugntrust_set_tlv_u8buf_optional(uint8_t *buf, uint8_t *buf_len, uint8_t tag, uint8_t *cmd, uint32_t cmd_len)
Add TLV data buffer in payload buffer if TLV data buffer length greater then 0.

◆ a5000plugntrust_sw_reset()

err_t a5000plugntrust_sw_reset ( a5000plugntrust_t * ctx,
a5000plugntrust_atr_t * atr_data )

Sends request to reset device and reads ATR data.

Sends request to reset device and parses and returns ATR data.

Parameters
[in]ctx: Click context object. See a5000plugntrust_t object definition for detailed explanation.
[out]atr_data: Output data after reset. See a5000plugntrust_atr_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ a5000plugntrust_write_binary_object()

err_t a5000plugntrust_write_binary_object ( a5000plugntrust_t * ctx,
uint32_t object_id,
uint16_t offset,
uint16_t data_len,
uint8_t * data_buf )

Create/Write to binary object.

If binary object with object_id exist function will write data_buf to it. If binary object doesn't exist it will be created and then data will be written.

Parameters
[in]ctx: Click context object. See a5000plugntrust_t object definition for detailed explanation.
[in]object_id: Object ID.
[in]offset: Offset of data to be written.
[in]data_len: Length of data to be written to binary object.
[in]data_buf: Buffer of data to be written to binary object.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
Functions a5000plugntrust_select_card_manager and a5000plugntrust_select_applet needs to be called for this function to be successful. At the end of function it calls a5000plugntrust_end_apdu_session function.