plugntrust 2.0.0.0
main.c File Reference

PlugnTrust Click example. More...

#include "board.h"
#include "log.h"
#include "plugntrust.h"

Macros

#define PARSE_BUF_LEN   0xFF
 
#define DATA_LEN   16
 
#define AES_DATA_SIZE   16
 
#define AES_KEY_SIZE   16
 

Functions

void application_init (void)
 
void application_task (void)
 
int main (void)
 

Detailed Description

PlugnTrust Click example.

Description

This application is showcasing basic functionality of Plug&Trust click board. It gets identify data from device, selects card manager and applet. Then checks free memory, reads all objects and deletes not reserved ones. After that showcases a few of functionality:

  • Generating random data,
  • Creating, reading and deleteing binary objects,
  • Creating AES symmetrical key and cipher with it; In the end it is showcasing funcionality in the endless loop.

The demo application is composed of two sections :

Application Init

At the start it sets comunication interface from default configuration[I2C]. Reads indetifing data from device, and then selects Card manager and applet. After that it reads free presistant memory, reads all objects and deletes objects that are not reserved by the Applet. Then it generates 2 byte of random data, and gets the version information from the Applet. Thtas followed up with creating binary object and 'MikroE' data is wrriten in it. Then its checked it object is created, and reads data back, in the end its deleted and checked if it still exists. Finally it creates 128AES key (16bytes), and then it encrypts and then decrypts data with that key, and in the end it deletes that key object.

Application Task

It generates 16bytes of data, writes it in binary object and then reads it and logs it. Then creates AES key and encrypts that random data with it, and then decrypts it. In the end it deletes both AES key object and binary object thats created at the start of task.

Note
For more informations and explanations refer to documents from NXP->AN12413 and UM11225.
Author
Luka Filipovic

Macro Definition Documentation

◆ AES_DATA_SIZE

#define AES_DATA_SIZE   16

◆ AES_KEY_SIZE

#define AES_KEY_SIZE   16

◆ DATA_LEN

#define DATA_LEN   16

◆ PARSE_BUF_LEN

#define PARSE_BUF_LEN   0xFF

Function Documentation

◆ application_init()

void application_init ( void )

< Logger config object.

< Click config object.

Logger initialization. Default baud rate: 115200 Default log level: LOG_LEVEL_DEBUG

Note
If USB_UART_RX and USB_UART_TX are defined as HAL_PIN_NC, you will need to define them manually for log to work. See LOG_MAP_USB_UART macro definition for detailed explanation.

◆ application_task()

void application_task ( void )

◆ main()

int main ( void )