se051plugntrust 2.1.0.0
SE051 Plug n Trust Click Driver

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

Topics

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

Functions

void se051plugntrust_cfg_setup (se051plugntrust_cfg_t *cfg)
 SE051 Plug n Trust configuration object setup function.
 
err_t se051plugntrust_init (se051plugntrust_t *ctx, se051plugntrust_cfg_t *cfg)
 SE051 Plug n Trust initialization function.
 
err_t se051plugntrust_apdu_write (se051plugntrust_t *ctx, se051plugntrust_frame_data_t *frame_data)
 Writing frame data function.
 
err_t se051plugntrust_apdu_read (se051plugntrust_t *ctx, se051plugntrust_frame_data_t *frame_data)
 Reading frame data function function.
 
err_t se051plugntrust_apdu_transfer (se051plugntrust_t *ctx, se051plugntrust_frame_data_t *frame_data)
 Write-Read frame data function.
 
void se051plugntrust_set_en_pin (se051plugntrust_t *ctx, uint8_t state)
 Set Enable pin state.
 
void se051plugntrust_set_rst_pin (se051plugntrust_t *ctx, uint8_t state)
 Set Reset pin state.
 
void se051plugntrust_reset (se051plugntrust_t *ctx)
 Reset function.
 
void se051plugntrust_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 se051plugntrust_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 se051plugntrust_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 se051plugntrust_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 se051plugntrust_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 se051plugntrust_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 se051plugntrust_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 se051plugntrust_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 se051plugntrust_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 se051plugntrust_calculate_apdu_size (se051plugntrust_apdu_t *apdu_data)
 Calculates APDU object size.
 
err_t se051plugntrust_end_apdu_session (se051plugntrust_t *ctx)
 Sends command for ending APDU session.
 
err_t se051plugntrust_object_id_list (se051plugntrust_t *ctx, uint32_t *id_list, uint8_t *list_len)
 Reads all Object ID's from Applet.
 
err_t se051plugntrust_sw_reset (se051plugntrust_t *ctx, se051plugntrust_atr_t *atr_data)
 Sends request to reset device and reads ATR data.
 
err_t se051plugntrust_select_applet (se051plugntrust_t *ctx, uint8_t ns_encode, se051plugntrust_version_info_t *ver_info)
 Selects Clicks Applet and returns info that device sends back to host.
 
err_t se051plugntrust_select_card_manager (se051plugntrust_t *ctx, uint8_t rsp, uint8_t *cardmanager_rsp, uint8_t *cardmanager_rsp_len)
 Select card manager.
 
err_t se051plugntrust_get_free_memory (se051plugntrust_t *ctx, uint8_t memory_type, uint16_t *free_memory)
 Reads Applet free memory.
 
err_t se051plugntrust_get_random_numbers (se051plugntrust_t *ctx, uint8_t *random_buf, uint8_t buf_len)
 Get random data.
 
err_t se051plugntrust_check_object_exist (se051plugntrust_t *ctx, uint32_t object_id)
 Check if object exists.
 
err_t se051plugntrust_delete_object (se051plugntrust_t *ctx, uint32_t object_id)
 Delete object.
 
err_t se051plugntrust_read_object (se051plugntrust_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 se051plugntrust_write_binary_object (se051plugntrust_t *ctx, uint32_t object_id, uint16_t offset, uint16_t data_len, uint8_t *data_buf)
 Create/Write to binary object.
 
err_t se051plugntrust_get_applet_info (se051plugntrust_t *ctx, se051plugntrust_version_info_t *ver_info)
 Get Version info from Applet.
 

Detailed Description

API for configuring and manipulating SE051 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

◆ se051plugntrust_apdu_read()

err_t se051plugntrust_apdu_read ( se051plugntrust_t * ctx,
se051plugntrust_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 se051plugntrust_t object definition for detailed explanation.
[out]frame_data: Communication data. See se051plugntrust_frame_data_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ se051plugntrust_apdu_transfer()

err_t se051plugntrust_apdu_transfer ( se051plugntrust_t * ctx,
se051plugntrust_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 se051plugntrust_t object definition for detailed explanation.
[in,out]frame_data: Communication data. See se051plugntrust_frame_data_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ se051plugntrust_apdu_write()

err_t se051plugntrust_apdu_write ( se051plugntrust_t * ctx,
se051plugntrust_frame_data_t * frame_data )

Writing frame data function.

This function writes a frame_data to device.

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

◆ se051plugntrust_calculate_apdu_size()

uint8_t se051plugntrust_calculate_apdu_size ( se051plugntrust_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 se051plugntrust_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.

◆ se051plugntrust_cfg_setup()

void se051plugntrust_cfg_setup ( se051plugntrust_cfg_t * cfg)

SE051 Plug n Trust configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ se051plugntrust_check_object_exist()

err_t se051plugntrust_check_object_exist ( se051plugntrust_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 se051plugntrust_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 se051plugntrust_select_card_manager and se051plugntrust_select_applet needs to be called for this function to be successful. At the end of function it calls se051plugntrust_end_apdu_session function.

◆ se051plugntrust_delete_object()

err_t se051plugntrust_delete_object ( se051plugntrust_t * ctx,
uint32_t object_id )

Delete object.

Sends request to delete object with object_id.

Parameters
[in]ctx: Click context object. See se051plugntrust_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 se051plugntrust_select_card_manager and se051plugntrust_select_applet needs to be called for this function to be successful. At the end of function it calls se051plugntrust_end_apdu_session function.

◆ se051plugntrust_end_apdu_session()

err_t se051plugntrust_end_apdu_session ( se051plugntrust_t * ctx)

Sends command for ending APDU session.

This function sends SBLOCK request for ending APDU session.

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

◆ se051plugntrust_get_applet_info()

err_t se051plugntrust_get_applet_info ( se051plugntrust_t * ctx,
se051plugntrust_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 se051plugntrust_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 se051plugntrust_select_card_manager and se051plugntrust_select_applet needs to be called for this function to be successful. At the end of function it calls se051plugntrust_end_apdu_session function.

◆ se051plugntrust_get_free_memory()

err_t se051plugntrust_get_free_memory ( se051plugntrust_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 se051plugntrust_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 se051plugntrust_select_card_manager and se051plugntrust_select_applet needs to be called for this function to be successful. At the end of function it calls se051plugntrust_end_apdu_session function.

◆ se051plugntrust_get_random_numbers()

err_t se051plugntrust_get_random_numbers ( se051plugntrust_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 se051plugntrust_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 se051plugntrust_select_card_manager and se051plugntrust_select_applet needs to be called for this function to be successful. At the end of function it calls se051plugntrust_end_apdu_session function.

◆ se051plugntrust_get_tlv_u16()

err_t se051plugntrust_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;
se051plugntrust_get_tlv_u16( frame_data.apdu->payload, &parse_index, SE051PLUGNTRUST_TLV_TAG_1, &value )
#define SE051PLUGNTRUST_TLV_TAG_1
Definition se051plugntrust.h:295
err_t se051plugntrust_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.

◆ se051plugntrust_get_tlv_u8()

err_t se051plugntrust_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;
se051plugntrust_get_tlv_u8( frame_data.apdu->payload, &parse_index, SE051PLUGNTRUST_TLV_TAG_1, &value )
err_t se051plugntrust_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.

◆ se051plugntrust_get_tlv_u8buf()

err_t se051plugntrust_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;
se051plugntrust_get_tlv_u8buf( frame_data.apdu->payload, &parse_index, frame_data.len,
SE051PLUGNTRUST_TLV_TAG_1, data_out, &parse_len )
err_t se051plugntrust_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.

◆ se051plugntrust_init()

err_t se051plugntrust_init ( se051plugntrust_t * ctx,
se051plugntrust_cfg_t * cfg )

SE051 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 se051plugntrust_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See se051plugntrust_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ se051plugntrust_object_id_list()

err_t se051plugntrust_object_id_list ( se051plugntrust_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 se051plugntrust_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.

◆ se051plugntrust_read_object()

err_t se051plugntrust_read_object ( se051plugntrust_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 se051plugntrust_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 se051plugntrust_select_card_manager and se051plugntrust_select_applet needs to be called for this function to be successful. At the end of function it calls se051plugntrust_end_apdu_session function.

◆ se051plugntrust_reset()

void se051plugntrust_reset ( se051plugntrust_t * ctx)

Reset function.

Sets en pin to enable selected interface from ctx and then resets device by toggling rst pin.

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

◆ se051plugntrust_select_applet()

err_t se051plugntrust_select_applet ( se051plugntrust_t * ctx,
uint8_t ns_encode,
se051plugntrust_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 se051plugntrust_t object definition for detailed explanation.
[in]ns_encode: NS encode of I-Block.
[out]ver_info: Version info data. See se051plugntrust_version_info_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ se051plugntrust_select_card_manager()

err_t se051plugntrust_select_card_manager ( se051plugntrust_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 se051plugntrust_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.

◆ se051plugntrust_set_en_pin()

void se051plugntrust_set_en_pin ( se051plugntrust_t * ctx,
uint8_t state )

Set Enable pin state.

This function sets en pin state.

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

◆ se051plugntrust_set_rst_pin()

void se051plugntrust_set_rst_pin ( se051plugntrust_t * ctx,
uint8_t state )

Set Reset pin state.

This function sets rst pin state.

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

◆ se051plugntrust_set_tlv_u16()

void se051plugntrust_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;
se051plugntrust_set_tlv_u16( frame_data.apdu->payload, &frame_data.apdu->payload_len,
#define SE051PLUGNTRUST_TLV_TAG_2
Definition se051plugntrust.h:296
void se051plugntrust_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.

◆ se051plugntrust_set_tlv_u16_optional()

void se051plugntrust_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 se051plugntrust_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;
se051plugntrust_set_tlv_u16_optional( frame_data.apdu->payload, &frame_data.apdu->payload_len,
void se051plugntrust_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.

◆ se051plugntrust_set_tlv_u32()

void se051plugntrust_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;
se051plugntrust_set_tlv_u32( frame_data.apdu->payload, &frame_data.apdu->payload_len,
void se051plugntrust_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.

◆ se051plugntrust_set_tlv_u8()

void se051plugntrust_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
se051plugntrust_set_tlv_u8( frame_data.apdu->payload, &frame_data.apdu->payload_len,
#define SE051PLUGNTRUST_MEM_PERSISTENT
Memory type.
Definition se051plugntrust.h:274
void se051plugntrust_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.

◆ se051plugntrust_set_tlv_u8buf()

err_t se051plugntrust_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 }
se051plugntrust_set_tlv_u8buf( frame_data.apdu->payload, &frame_data.apdu->payload_len,
#define SE051PLUGNTRUST_TLV_TAG_3
Definition se051plugntrust.h:297
err_t se051plugntrust_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 AES_KEY_SIZE

◆ se051plugntrust_set_tlv_u8buf_optional()

err_t se051plugntrust_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 se051plugntrust_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 }
se051plugntrust_set_tlv_u8buf_optional( frame_data.apdu->payload, &frame_data.apdu->payload_len,
err_t se051plugntrust_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.

◆ se051plugntrust_sw_reset()

err_t se051plugntrust_sw_reset ( se051plugntrust_t * ctx,
se051plugntrust_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 se051plugntrust_t object definition for detailed explanation.
[out]atr_data: Output data after reset. See se051plugntrust_atr_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ se051plugntrust_write_binary_object()

err_t se051plugntrust_write_binary_object ( se051plugntrust_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 se051plugntrust_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 se051plugntrust_select_card_manager and se051plugntrust_select_applet needs to be called for this function to be successful. At the end of function it calls se051plugntrust_end_apdu_session function.