diff --git a/Applications/Projects/00_Project_template/main.c b/Applications/Projects/00_Project_template/main.c
index 2a3f13b..f0de6f3 100644
--- a/Applications/Projects/00_Project_template/main.c
+++ b/Applications/Projects/00_Project_template/main.c
@@ -1,7 +1,7 @@
/**
******************************************************************************
* \file main.c
- * \brief STSELIB project template
+ * \brief STSAFE-L010 project template
* \author CS application team
******************************************************************************
* COPYRIGHT 2022 STMicroelectronics
@@ -21,7 +21,7 @@
/**
* @brief Main program entry point
- * @note This is a template project for STSAFE-A120 examples
+ * @note This is a template project for STSAFE-L010 examples
* Add your application code here
* @retval Not applicable (infinite loop)
*/
diff --git a/Applications/Projects/ReadMe.md b/Applications/Projects/ReadMe.md
index 83f157d..310a068 100644
--- a/Applications/Projects/ReadMe.md
+++ b/Applications/Projects/ReadMe.md
@@ -1,15 +1,6 @@
# Project package example
-This project folder contains examples illustrating typical use cases for the STSAFE-A120.
-The index preceding the project folder name illustrates the execution hierarchy of the examples.
-This means that the project with a higher index must be executed after the project with a lower index.
-For example, index project 03 must be run after index project 02.
-Indeed, some tests configure the STSAFE-A120 according to a typical configuration for field usage.
-
-Dependency index between groups of examples:
-- 0: Template ((No dependency)
-- 1: Examples without dependency
-- 2: Configuration examples without any dependency
-- 3: Examples with group 2 dependency
-- 4: Configuration examples without any dependency
-- 5: Examples with dependency of groups 2 & 4
+This project folder contains examples illustrating typical use cases for the STSAFE-L010.
+
+
+
diff --git a/Applications/Projects/01_Device_authentication/README.md b/Applications/Projects/SPL01_Device_authentication/README.md
similarity index 100%
rename from Applications/Projects/01_Device_authentication/README.md
rename to Applications/Projects/SPL01_Device_authentication/README.md
diff --git a/Applications/Projects/SPL01_Device_authentication/STM32CubeIDE/.cproject b/Applications/Projects/SPL01_Device_authentication/STM32CubeIDE/.cproject
new file mode 100644
index 0000000..f74129a
--- /dev/null
+++ b/Applications/Projects/SPL01_Device_authentication/STM32CubeIDE/.cproject
@@ -0,0 +1,210 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Applications/Projects/01_Secure_data_storage/STM32CubeIDE/.project b/Applications/Projects/SPL01_Device_authentication/STM32CubeIDE/.project
similarity index 97%
rename from Applications/Projects/01_Secure_data_storage/STM32CubeIDE/.project
rename to Applications/Projects/SPL01_Device_authentication/STM32CubeIDE/.project
index dbaf95b..0b109da 100644
--- a/Applications/Projects/01_Secure_data_storage/STM32CubeIDE/.project
+++ b/Applications/Projects/SPL01_Device_authentication/STM32CubeIDE/.project
@@ -1,6 +1,6 @@
- STSAFE-L010_secure_data_storage
+ SPL01_Device_authentication
diff --git a/Applications/Projects/01_Device_authentication/main.c b/Applications/Projects/SPL01_Device_authentication/main.c
similarity index 78%
rename from Applications/Projects/01_Device_authentication/main.c
rename to Applications/Projects/SPL01_Device_authentication/main.c
index 05b8340..00c2a64 100644
--- a/Applications/Projects/01_Device_authentication/main.c
+++ b/Applications/Projects/SPL01_Device_authentication/main.c
@@ -4,7 +4,7 @@
* @author CS application team
* @brief STSAFE-L010 Device authentication example
******************************************************************************
- * COPYRIGHT 2022 STMicroelectronics
+ * COPYRIGHT 2022 STMicroelectronics
*
* This software is licensed under terms that can be found in the LICENSE file in
* the root directory of this software component.
@@ -19,9 +19,9 @@
/* Defines -------------------------------------------------------------------*/
-/* Root CA key used for STSE-L SPL01 */
+/* Root CA key used for STSAFE-L010 SPL01 */
#define CA_SELF_SIGNED_CERTIFICATE_01 \
- 0x30, 0x82, 0x01, 0x67, 0x30, 0x82, 0x01, 0x19, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, \
+ 0x30, 0x82, 0x01, 0x67, 0x30, 0x82, 0x01, 0x19, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, \
0x30, 0x05, 0x06, 0x03, 0x2b, 0x65, 0x70, 0x30, 0x4b, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, \
0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, \
0x15, 0x53, 0x54, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x72, 0x6f, 0x6e, \
@@ -64,52 +64,55 @@
*/
int main(void) {
stse_ReturnCode_t stse_ret = STSE_API_INVALID_PARAMETER;
- stse_Handler_t stse_handler;
+ stse_Handler_t stse_handle;
static const uint8_t ca_selfsigned_cert[] = {CA_SELF_SIGNED_CERTIFICATE_01};
/* Initialize Terminal */
apps_terminal_init(115200);
- /* - Print Example instruction on terminal */
+ /* ## Print Example instruction on terminal */
printf("----------------------------------------------------------------------------------------------------------------");
- printf("\n\r- STSAFE-L010 Device Authentication Example -");
+ printf("\n\r- STSAFE-L010 SPL01 Device Authentication Example -");
printf("\n\r----------------------------------------------------------------------------------------------------------------");
- printf("\n\r- This example illustrates STSAFE-L010 device authentication process using Multi-Step approach. -");
+ printf("\n\r- This example illustrates STSAFE-L010 device authentication process. -");
printf("\n\r- it can be taken as reference for building distant server authentication use cases. -");
printf("\n\r----------------------------------------------------------------------------------------------------------------");
- /* ## Initialize STSAFE-A1xx device handler */
- stse_ret = stse_set_default_handler_value(&stse_handler);
+ printf("\n\n\r ( Press key to continue )");
+ uart_getc();
+
+ /* ## Initialize STSAFE-L010 device handler */
+ stse_ret = stse_set_default_handler_value(&stse_handle);
if (stse_ret != STSE_OK) {
- printf(PRINT_RED "\n\r ## stse_set_default_handler_value ERROR : 0x%04X\n\r", stse_ret);
+ printf("\n\n\r ## stse_set_default_handler_value : "PRINT_RED"ERROR 0x%04X"PRINT_RESET"\n\r", stse_ret);
apps_process_error(stse_ret);
}
- stse_handler.device_type = STSAFE_L010;
- stse_handler.io.busID = 1;
- stse_handler.io.BusSpeed = 100;
- stse_handler.io.Devaddr = 0x0C;
+ stse_handle.device_type = STSAFE_L010;
+ stse_handle.io.BusType = STSE_BUS_TYPE_I2C;
+ stse_handle.io.BusSpeed = 100;
+ stse_handle.io.Devaddr = 0x0C;
- printf("\n\r - Initialize target STSAFE-L010");
- stse_ret = stse_init(&stse_handler);
+ printf("\n\n\r ## Initialize target STSAFE-L010");
+ stse_ret = stse_init(&stse_handle);
if (stse_ret != STSE_OK) {
- printf(PRINT_RED "\n\r ## stse_init ERROR : 0x%04X\n\r", stse_ret);
+ printf("\n\r ## stse_init : "PRINT_RED"ERROR 0x%04X"PRINT_RESET"\n\r", stse_ret);
apps_process_error(stse_ret);
}
- /* ## Authenticate target STSAFE-A120 device */
+ /* ## Authenticate target STSAFE-L010 device */
stse_ret = stse_device_authenticate(
- &stse_handler,
+ &stse_handle,
ca_selfsigned_cert,
STSAFE_CERTIFICATE_ZONE_0,
STSE_STATIC_PRIVATE_KEY_SLOT_0);
if (stse_ret != STSE_OK) {
- printf(PRINT_RED "\n\n\r ## Device authentication over STSE-L SPL01 CA certificate : Failed \n\r");
- printf("\n\r\t o stse_device_authenticate ERROR : 0x%04X", stse_ret);
+ printf("\n\n\r ## Device authentication over STSAFE-L010 SPL01 CA certificate :"PRINT_RED" FAIL "PRINT_RESET"\n\r");
+ printf("\n\r\t o stse_device_authenticate"PRINT_RED": ERROR 0x%04X"PRINT_RESET, stse_ret);
apps_process_error(stse_ret);
} else {
- printf(PRINT_GREEN "\n\n\r ## Device authentication over STSE-L SPL01 CA certificate : Successful\n\r");
+ printf("\n\n\r ## Device authentication over STSAFE-L010 SPL01 CA certificate :"PRINT_GREEN" SUCCESS "PRINT_RESET"\n\r");
}
while (1) {
diff --git a/Applications/Projects/01_Device_authentication/stse_conf.h b/Applications/Projects/SPL01_Device_authentication/stse_conf.h
similarity index 100%
rename from Applications/Projects/01_Device_authentication/stse_conf.h
rename to Applications/Projects/SPL01_Device_authentication/stse_conf.h
diff --git a/Applications/Projects/01_Device_authentication_multi_steps/README.md b/Applications/Projects/SPL01_Device_authentication_multi_steps/README.md
similarity index 100%
rename from Applications/Projects/01_Device_authentication_multi_steps/README.md
rename to Applications/Projects/SPL01_Device_authentication_multi_steps/README.md
diff --git a/Applications/Projects/SPL01_Device_authentication_multi_steps/STM32CubeIDE/.cproject b/Applications/Projects/SPL01_Device_authentication_multi_steps/STM32CubeIDE/.cproject
new file mode 100644
index 0000000..e30d1c8
--- /dev/null
+++ b/Applications/Projects/SPL01_Device_authentication_multi_steps/STM32CubeIDE/.cproject
@@ -0,0 +1,210 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Applications/Projects/01_Device_authentication_multi_steps/STM32CubeIDE/.project b/Applications/Projects/SPL01_Device_authentication_multi_steps/STM32CubeIDE/.project
similarity index 96%
rename from Applications/Projects/01_Device_authentication_multi_steps/STM32CubeIDE/.project
rename to Applications/Projects/SPL01_Device_authentication_multi_steps/STM32CubeIDE/.project
index 94ef227..397e4a6 100644
--- a/Applications/Projects/01_Device_authentication_multi_steps/STM32CubeIDE/.project
+++ b/Applications/Projects/SPL01_Device_authentication_multi_steps/STM32CubeIDE/.project
@@ -1,6 +1,6 @@
- STSAFE-L010_multi_steps_device_authentication
+ SPL01_Device_authentication_multi_steps
diff --git a/Applications/Projects/SPL01_Device_authentication_multi_steps/main.c b/Applications/Projects/SPL01_Device_authentication_multi_steps/main.c
new file mode 100644
index 0000000..496c0b6
--- /dev/null
+++ b/Applications/Projects/SPL01_Device_authentication_multi_steps/main.c
@@ -0,0 +1,197 @@
+/**
+ ******************************************************************************
+ * @file main.c
+ * @author CS application team
+ * @brief STSAFE-L010 Device authentication multi steps example
+ ******************************************************************************
+ * COPYRIGHT 2022 STMicroelectronics
+ *
+ * This software is licensed under terms that can be found in the LICENSE file in
+ * the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ ******************************************************************************
+ */
+
+/* Includes ------------------------------------------------------------------*/
+
+#include "Apps_utils.h"
+
+/* Defines -------------------------------------------------------------------*/
+
+/* Root CA key used for STSAFE-L010 SPL01 */
+#define CA_SELF_SIGNED_CERTIFICATE_01 \
+ 0x30, 0x82, 0x01, 0x67, 0x30, 0x82, 0x01, 0x19, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, \
+ 0x30, 0x05, 0x06, 0x03, 0x2b, 0x65, 0x70, 0x30, 0x4b, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, \
+ 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, \
+ 0x15, 0x53, 0x54, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x72, 0x6f, 0x6e, \
+ 0x69, 0x63, 0x73, 0x20, 0x6e, 0x76, 0x31, 0x1c, 0x30, 0x1a, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, \
+ 0x13, 0x53, 0x54, 0x4d, 0x5f, 0x53, 0x54, 0x53, 0x41, 0x46, 0x45, 0x2d, 0x4c, 0x5f, 0x43, 0x41, \
+ 0x30, 0x30, 0x30, 0x31, 0x30, 0x20, 0x17, 0x0d, 0x32, 0x34, 0x30, 0x36, 0x30, 0x37, 0x30, 0x30, \
+ 0x30, 0x30, 0x30, 0x30, 0x5a, 0x18, 0x0f, 0x32, 0x30, 0x35, 0x34, 0x30, 0x36, 0x30, 0x37, 0x30, \
+ 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x30, 0x4b, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, \
+ 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x15, \
+ 0x53, 0x54, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x72, 0x6f, 0x6e, 0x69, \
+ 0x63, 0x73, 0x20, 0x6e, 0x76, 0x31, 0x1c, 0x30, 0x1a, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x13, \
+ 0x53, 0x54, 0x4d, 0x5f, 0x53, 0x54, 0x53, 0x41, 0x46, 0x45, 0x2d, 0x4c, 0x5f, 0x43, 0x41, 0x30, \
+ 0x30, 0x30, 0x31, 0x30, 0x2a, 0x30, 0x05, 0x06, 0x03, 0x2b, 0x65, 0x70, 0x03, 0x21, 0x00, 0x84, \
+ 0x47, 0xf2, 0xc0, 0x98, 0xbe, 0x15, 0xf6, 0x05, 0xc6, 0x98, 0xd5, 0xfa, 0xc5, 0x7b, 0x56, 0x0f, \
+ 0x1c, 0xcf, 0x1f, 0x37, 0x9f, 0xe9, 0x88, 0xaa, 0x2f, 0xea, 0xa2, 0x93, 0xb5, 0xde, 0xd1, 0xa3, \
+ 0x20, 0x30, 0x1e, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x08, 0x30, 0x06, 0x01, 0x01, \
+ 0xff, 0x02, 0x01, 0x00, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x04, 0x04, 0x03, 0x02, 0x02, \
+ 0x04, 0x30, 0x05, 0x06, 0x03, 0x2b, 0x65, 0x70, 0x03, 0x41, 0x00, 0x29, 0x31, 0xa8, 0x6f, 0xed, \
+ 0x6f, 0xd7, 0x54, 0x8a, 0x03, 0x20, 0x72, 0x84, 0x5d, 0x77, 0x87, 0x97, 0xe2, 0x36, 0x4b, 0x52, \
+ 0x65, 0xea, 0xc1, 0xbf, 0x7b, 0x39, 0x36, 0x05, 0x75, 0x5b, 0x5d, 0x76, 0x19, 0xfd, 0x32, 0x9c, \
+ 0xfd, 0x90, 0x93, 0x17, 0xf9, 0x53, 0xb4, 0xb8, 0x21, 0xdf, 0x9c, 0xe2, 0x0d, 0xa7, 0xcd, 0x74, \
+ 0x5b, 0x9e, 0xf1, 0xab, 0xf7, 0x94, 0x9f, 0x4a, 0xb0, 0xfb, 0x05
+
+#define STSAFE_CERTIFICATE_ZONE_0 0U
+#define STSE_STATIC_PRIVATE_KEY_SLOT_0 0U
+
+/**
+ * @brief Main program entry point - STSAFE-L010 Multi-step device authentication
+ * @details Demonstrates detailed device authentication process with individual steps:
+ * - Reads device certificate from STSAFE-L010 zone 0
+ * - Parses both CA and device certificates into structured format
+ * - Extracts and displays certificate information (subject, issuer, keys)
+ * - Verifies device certificate signature using CA public key
+ * - Generates random challenge for device
+ * - Requests device signature on challenge using private key
+ * - Verifies signature using device's public key from certificate
+ * @note This multi-step approach shows each authentication phase separately,
+ * useful for understanding the authentication protocol or implementing
+ * custom authentication flows for distant server scenarios
+ * @retval 0 on success (never reached due to infinite loop)
+ */
+int main(void) {
+ stse_ReturnCode_t stse_ret = STSE_API_INVALID_PARAMETER;
+ stse_Handler_t stse_handle;
+ PLAT_UI16 certificate_size;
+ stse_certificate_t parsed_stse_certificate;
+ stse_certificate_t parsed_ca_selfsigned_cert;
+ static const uint8_t ca_selfsigned_cert[] = {CA_SELF_SIGNED_CERTIFICATE_01};
+
+ /* Initialize Terminal */
+ apps_terminal_init(115200);
+
+ /* ## Print Example instruction on terminal */
+ printf("----------------------------------------------------------------------------------------------------------------");
+ printf("\n\r- STSAFE-L010 SPL01 Multi-Steps Device Authentication Example -");
+ printf("\n\r----------------------------------------------------------------------------------------------------------------");
+ printf("\n\r- This example illustrates STSAFE-L010 device authentication process using Multi-Step approach. -");
+ printf("\n\r- it can be taken as reference for building distant server authentication use cases. -");
+ printf("\n\r----------------------------------------------------------------------------------------------------------------");
+ printf("\n\n\r ( Press key to continue )");
+ uart_getc();
+
+ /* ## Initialize STSAFE-L010 device handler */
+ stse_ret = stse_set_default_handler_value(&stse_handle);
+ if (stse_ret != STSE_OK) {
+ printf("\n\n\r ## stse_set_default_handler_value : "PRINT_RED"ERROR 0x%04X"PRINT_RESET"\n\r", stse_ret);
+ apps_process_error(stse_ret);
+ }
+
+ stse_handle.device_type = STSAFE_L010;
+ stse_handle.io.BusType = STSE_BUS_TYPE_I2C;
+ stse_handle.io.BusSpeed = 100;
+ stse_handle.io.Devaddr = 0x0C;
+
+ printf("\n\n\r ## Initialize target STSAFE-L010");
+ stse_ret = stse_init(&stse_handle);
+ if (stse_ret != STSE_OK) {
+ printf("\n\r ## stse_init : "PRINT_RED"ERROR 0x%04X"PRINT_RESET"\n\r", stse_ret);
+ apps_process_error(stse_ret);
+ }
+
+ /* ## Parse CA self-signed certificate */
+ stse_ret = stse_certificate_parse(ca_selfsigned_cert, &parsed_ca_selfsigned_cert, NULL);
+ if (stse_ret != STSE_OK) {
+ printf("\n\n\r## ST CA stse_certificate_parse ERROR : 0x%04X", stse_ret);
+ apps_process_error(stse_ret);
+ }
+ printf("\n\n\r## CA self-signed certificate : \n\r");
+ stse_certificate_print_parsed_cert(&parsed_ca_selfsigned_cert);
+
+ /* ## Get target STSAFE-L010 Certificate */
+ stse_ret = stse_get_device_certificate_size(&stse_handle, STSAFE_CERTIFICATE_ZONE_0, &certificate_size);
+ if (stse_ret != STSE_OK) {
+ printf("\n\n\r## stse_get_device_certificate_size : "PRINT_RED"ERROR 0x%04X"PRINT_RESET"\n\r", stse_ret);
+ apps_process_error(stse_ret);
+ }
+
+ PLAT_UI8 stse_certificate[certificate_size];
+
+ stse_ret = stse_get_device_certificate(&stse_handle, STSAFE_CERTIFICATE_ZONE_0, certificate_size, stse_certificate);
+ if (stse_ret != STSE_OK) {
+ printf("\n\n\r## stse_get_device_certificate : "PRINT_RED"ERROR 0x%04X"PRINT_RESET"\n\r", stse_ret);
+ apps_process_error(stse_ret);
+ }
+
+ /* ## Parse target STSAFE-L010 certificate */
+ stse_ret = stse_certificate_parse(stse_certificate, &parsed_stse_certificate, NULL);
+ if (stse_ret != STSE_OK) {
+ printf("\n\n\r## STSAFE-L010 stse_certificate_parse : "PRINT_RED"ERROR 0x%04X"PRINT_RESET"\n\r", stse_ret);
+ apps_process_error(stse_ret);
+ }
+ printf("\n\n\r## Target STSAFE-L010 certificate : \n\r");
+ stse_certificate_print_parsed_cert(&parsed_stse_certificate);
+
+ /* ## Verify STSAFE-L010 Certificate with CA self-signed Certificate */
+ stse_ret = stse_certificate_is_parent(&parsed_ca_selfsigned_cert, &parsed_stse_certificate, NULL);
+ if (stse_ret != STSE_OK) {
+ printf("\n\n\r## stse_certificate_is_parent : "PRINT_RED"ERROR 0x%04X"PRINT_RESET"\n\r", stse_ret);
+ apps_process_error(stse_ret);
+ } else {
+ printf("\n\n\r## Device Certificate Verified\n\r");
+ }
+
+ /* ## Extract certificate key type */
+ stse_ecc_key_type_t key_type = stse_certificate_get_key_type(&parsed_stse_certificate);
+ PLAT_UI16 signature_size = stse_ecc_info_table[key_type].signature_size;
+ PLAT_UI8 signature[signature_size];
+
+ /* ## Generate a challenge ( aligned with key type size requirement) */
+ printf("\n\n\r## Host random challenge : \n\r");
+ PLAT_UI16 challenge_size = STSAFEL_ECC_SIGNATURE_CHALLENGE_LENGTH;
+ PLAT_UI8 challenge[challenge_size];
+ apps_randomize_buffer(challenge, challenge_size);
+ apps_print_hex_buffer(challenge, challenge_size);
+
+ /* ## Signature over challenge */
+ stse_ret = stse_ecc_generate_signature(
+ &stse_handle, /* STSE handler */
+ STSE_STATIC_PRIVATE_KEY_SLOT_0, /* Slot number */
+ key_type, /* Certificate key type */
+ challenge, /* Challenge */
+ challenge_size, /* Challenge size */
+ signature); /* Challenge signature */
+
+ if (stse_ret != STSE_OK) {
+ printf("\n\r## stse_ecc_generate_signature : "PRINT_RED"ERROR 0x%04X"PRINT_RESET"\n\r", stse_ret);
+ apps_process_error(stse_ret);
+ }
+ printf("\n\n\r## Device signature over Host challenge: ");
+ apps_print_hex_buffer(signature, signature_size);
+
+ /*## Verify The Signature of the Random Number*/
+
+ stse_ret = stse_certificate_verify_signature(
+ &parsed_stse_certificate,
+ challenge,
+ challenge_size,
+ signature, (signature_size >> 1),
+ &signature[signature_size >> 1], (signature_size >> 1));
+ if (stse_ret != STSE_OK) {
+ printf("\n\n\r## stse_certificate_verify_signature : "PRINT_RED"ERROR 0x%04X"PRINT_RESET"\n\r", stse_ret);
+ } else {
+ printf("\n\n\r## Device Authentication : "PRINT_GREEN"SUCCESS"PRINT_RESET" (Challenge signature verified successfully)");
+ }
+
+ printf(PRINT_RESET "\n\r\n\r*#*# STMICROELECTRONICS #*#*\n\r");
+
+ while (1) {
+ // infinite loop
+ }
+
+ return 0;
+}
diff --git a/Applications/Projects/01_Device_authentication_multi_steps/stse_conf.h b/Applications/Projects/SPL01_Device_authentication_multi_steps/stse_conf.h
similarity index 100%
rename from Applications/Projects/01_Device_authentication_multi_steps/stse_conf.h
rename to Applications/Projects/SPL01_Device_authentication_multi_steps/stse_conf.h
diff --git a/Applications/Projects/01_Echo_loop/README.md b/Applications/Projects/SPL01_Echo_loop/README.md
similarity index 100%
rename from Applications/Projects/01_Echo_loop/README.md
rename to Applications/Projects/SPL01_Echo_loop/README.md
diff --git a/Applications/Projects/01_Device_authentication/STM32CubeIDE/.cproject b/Applications/Projects/SPL01_Echo_loop/STM32CubeIDE/.cproject
similarity index 97%
rename from Applications/Projects/01_Device_authentication/STM32CubeIDE/.cproject
rename to Applications/Projects/SPL01_Echo_loop/STM32CubeIDE/.cproject
index b6b7370..c3adc10 100644
--- a/Applications/Projects/01_Device_authentication/STM32CubeIDE/.cproject
+++ b/Applications/Projects/SPL01_Echo_loop/STM32CubeIDE/.cproject
@@ -25,7 +25,7 @@
-
+
@@ -113,7 +113,7 @@
-
+
@@ -180,7 +180,7 @@
-
+
diff --git a/Applications/Projects/01_Echo_loop/STM32CubeIDE/.project b/Applications/Projects/SPL01_Echo_loop/STM32CubeIDE/.project
similarity index 97%
rename from Applications/Projects/01_Echo_loop/STM32CubeIDE/.project
rename to Applications/Projects/SPL01_Echo_loop/STM32CubeIDE/.project
index eae1dbd..db16b93 100644
--- a/Applications/Projects/01_Echo_loop/STM32CubeIDE/.project
+++ b/Applications/Projects/SPL01_Echo_loop/STM32CubeIDE/.project
@@ -1,6 +1,6 @@
- STSAFE-L010_echo_loop
+ SPL01_Echo_loop
diff --git a/Applications/Projects/01_Echo_loop/main.c b/Applications/Projects/SPL01_Echo_loop/main.c
similarity index 67%
rename from Applications/Projects/01_Echo_loop/main.c
rename to Applications/Projects/SPL01_Echo_loop/main.c
index 7100699..b20bc91 100644
--- a/Applications/Projects/01_Echo_loop/main.c
+++ b/Applications/Projects/SPL01_Echo_loop/main.c
@@ -2,9 +2,9 @@
******************************************************************************
* @file main.c
* @author CS application team
- * @brief STSAFE-A120 Echo loop example
+ * @brief STSAFE-L010 Echo loop example
******************************************************************************
- * COPYRIGHT 2022 STMicroelectronics
+ * COPYRIGHT 2022 STMicroelectronics
*
* This software is licensed under terms that can be found in the LICENSE file in
* the root directory of this software component.
@@ -17,6 +17,8 @@
#include "Apps_utils.h"
+#define ECHO_LOOP_COUNT 5
+
/**
* @brief Main program entry point - STSAFE-L010 Echo loop example
* @details Demonstrates the echo command functionality:
@@ -34,32 +36,37 @@ int main(void) {
/* Initialize Terminal */
apps_terminal_init(115200);
- /* Print Example instruction on terminal */
+ /* ## Print Example instruction on terminal */
printf(PRINT_CLEAR_SCREEN);
printf("----------------------------------------------------------------------------------------------------------------");
- printf("\n\r- STSAFE-A Echo loop example -");
+ printf("\n\r- STSAFE-L010 SPL01 Echo loop example -");
printf("\n\r----------------------------------------------------------------------------------------------------------------");
+ printf("\n\n\r ( Press key to continue )");
+ uart_getc();
- /* Initialize STSAFE-A1xx device handler */
+ /* ## Initialize STSAFE-L010 device handler */
stse_ret = stse_set_default_handler_value(&stse_handle);
if (stse_ret != STSE_OK) {
- printf("\n\r ## stse_set_default_handler_value ERROR : 0x%04X\n\r", stse_ret);
+ printf("\n\r ## stse_set_default_handler_value : "PRINT_RED"ERROR 0x%04X"PRINT_RESET"\n\r", stse_ret);
apps_process_error(stse_ret);
}
stse_handle.device_type = STSAFE_L010;
- stse_handle.io.busID = 1;
+ stse_handle.io.BusType = STSE_BUS_TYPE_I2C;
stse_handle.io.BusSpeed = 100;
stse_handle.io.Devaddr = 0x0C;
- printf("\n\r - Initialize target STSAFE-A120");
+ printf("\n\n\r ## Initialize target STSAFE-L010");
stse_ret = stse_init(&stse_handle);
if (stse_ret != STSE_OK) {
- printf("\n\r ## stse_init ERROR : 0x%04X\n\r", stse_ret);
+ printf("\n\r ## stse_init : "PRINT_RED"ERROR 0x%04X"PRINT_RESET"\n\r", stse_ret);
apps_process_error(stse_ret);
}
- while (1) {
+ for(uint8_t i=0 ; i 500) || (message_length == 0)) {
@@ -74,28 +81,35 @@ int main(void) {
apps_randomize_buffer(message, message_length);
/* Print message */
- printf("\n\r ## Message :\n\r");
+ printf("\n\n\r ## Echo Message %d :\n\r", i);
apps_print_hex_buffer(message, message_length);
/* Perform echo operation */
stse_ret = stse_device_echo(&stse_handle, message, echoed_message, message_length);
if (stse_ret != STSE_OK) {
- printf("\n\r## stse_device_echo ERROR : 0x%04X\n\r", stse_ret);
+ printf("\n\r ## stse_device_echo : "PRINT_RED"ERROR 0x%04X"PRINT_RESET"\n\r", stse_ret);
apps_process_error(stse_ret);
}
/* Compare message and echoed message */
if (apps_compare_buffers(message, echoed_message, message_length)) {
- printf("\n\n \r ## ECHO MESSAGES COMPARE ERROR (%d)", message_length);
+ printf("\n\n\r ## ECHO MESSAGES COMPARE ERROR (%d)", message_length);
printf("\n\r\t Echoed Message :\n\r");
apps_print_hex_buffer(echoed_message, message_length);
}
- printf("\n\n \r ## Echoed Message :\n\r");
+ printf("\n\n\r ## Echoed Message %d :\n\r", i);
apps_print_hex_buffer(echoed_message, message_length);
- printf("\n\r\n\r*#*# STMICROELECTRONICS #*#*\n\r");
/* Wait for 1s */
- apps_delay_ms(1000);
+ apps_delay_ms(500);
}
+
+ printf("\n\n\r----------------------------------------------------------------------------------------------------------------");
+ printf("\n\n\r*#*# STMICROELECTRONICS #*#*\n\r");
+
+ while (1) {
+ // infinite loop
+ }
+
}
diff --git a/Applications/Projects/01_Echo_loop/stse_conf.h b/Applications/Projects/SPL01_Echo_loop/stse_conf.h
similarity index 100%
rename from Applications/Projects/01_Echo_loop/stse_conf.h
rename to Applications/Projects/SPL01_Echo_loop/stse_conf.h
diff --git a/Applications/Projects/01_Secure_data_storage/README.md b/Applications/Projects/SPL01_Secure_data_storage/README.md
similarity index 100%
rename from Applications/Projects/01_Secure_data_storage/README.md
rename to Applications/Projects/SPL01_Secure_data_storage/README.md
diff --git a/Applications/Projects/01_Secure_data_storage/STM32CubeIDE/.cproject b/Applications/Projects/SPL01_Secure_data_storage/STM32CubeIDE/.cproject
similarity index 96%
rename from Applications/Projects/01_Secure_data_storage/STM32CubeIDE/.cproject
rename to Applications/Projects/SPL01_Secure_data_storage/STM32CubeIDE/.cproject
index b6b7370..0fd0e4e 100644
--- a/Applications/Projects/01_Secure_data_storage/STM32CubeIDE/.cproject
+++ b/Applications/Projects/SPL01_Secure_data_storage/STM32CubeIDE/.cproject
@@ -25,7 +25,7 @@
-
+
@@ -113,7 +113,7 @@
-
+
@@ -180,7 +180,7 @@
-
+
diff --git a/Applications/Projects/01_Device_authentication/STM32CubeIDE/.project b/Applications/Projects/SPL01_Secure_data_storage/STM32CubeIDE/.project
similarity index 97%
rename from Applications/Projects/01_Device_authentication/STM32CubeIDE/.project
rename to Applications/Projects/SPL01_Secure_data_storage/STM32CubeIDE/.project
index 8cdd567..f6ca37b 100644
--- a/Applications/Projects/01_Device_authentication/STM32CubeIDE/.project
+++ b/Applications/Projects/SPL01_Secure_data_storage/STM32CubeIDE/.project
@@ -1,6 +1,6 @@
- STSAFE-L010_device_authentication
+ SPL01_Secure_data_storage
diff --git a/Applications/Projects/01_Secure_data_storage/main.c b/Applications/Projects/SPL01_Secure_data_storage/main.c
similarity index 67%
rename from Applications/Projects/01_Secure_data_storage/main.c
rename to Applications/Projects/SPL01_Secure_data_storage/main.c
index bed9b48..570fe31 100644
--- a/Applications/Projects/01_Secure_data_storage/main.c
+++ b/Applications/Projects/SPL01_Secure_data_storage/main.c
@@ -4,7 +4,7 @@
* @author CS application team
* @brief STSAFE-L010 Secure data storage access example
******************************************************************************
- * COPYRIGHT 2022 STMicroelectronics
+ * COPYRIGHT 2022 STMicroelectronics
*
* This software is licensed under terms that can be found in the LICENSE file in
* the root directory of this software component.
@@ -37,7 +37,7 @@
*/
int main(void) {
stse_ReturnCode_t stse_ret = STSE_API_INVALID_PARAMETER;
- stse_Handler_t stse_handler;
+ stse_Handler_t stse_handle;
uint32_t counter_value;
uint8_t readBuffer[READ_BUFFER_SIZE];
@@ -46,7 +46,7 @@ int main(void) {
/* Initialize Terminal */
apps_terminal_init(115200);
- /* - Print Example instruction on terminal */
+ /* ## Print Example instruction on terminal */
printf(PRINT_CLEAR_SCREEN PRINT_RESET);
printf("----------------------------------------------------------------------------------------------------------------");
printf("\n\r- STSAFE-L010 secure data storage zone access example -");
@@ -55,8 +55,6 @@ int main(void) {
printf("\n\r- description : -");
printf("\n\r- This examples illustrates how to makes use of the STSAFE-L data storage APIs by performing following -");
printf("\n\r- accesses/commands to the target STSAFE device -");
- printf("\n\r- o Query STSAFE-L total partition count -");
- printf("\n\r- o Query STSAFE-L partitions information -");
printf("\n\r- o Read STSAFE-L zone 'ZONE_INDEX' -");
printf("\n\r- o Update STSAFE-L zone 'ZONE_INDEX' -");
printf("\n\r- -");
@@ -64,68 +62,101 @@ int main(void) {
printf("\n\r- Accesses parameters must be adapted for other device personalization -");
printf("\n\r- -");
printf("\n\r----------------------------------------------------------------------------------------------------------------");
+ printf("\n\n\r ( Press key to continue )");
+ uart_getc();
- /* ## Initialize STSAFE-L0xx device handler */
- stse_ret = stse_set_default_handler_value(&stse_handler);
+ /* ## Initialize STSAFE-L010 device handler */
+ stse_ret = stse_set_default_handler_value(&stse_handle);
if (stse_ret != STSE_OK) {
- printf(PRINT_RED "\n\r ## stse_set_default_handler_value ERROR : 0x%04X\n\r", stse_ret);
+ printf("\n\r ## stse_set_default_handler_value : "PRINT_RED"ERROR 0x%04X"PRINT_RESET"\n\r", stse_ret);
apps_process_error(stse_ret);
}
- stse_handler.device_type = STSAFE_L010;
- stse_handler.io.busID = 1;
- stse_handler.io.BusSpeed = 100;
- stse_handler.io.Devaddr = 0x0C;
+ stse_handle.device_type = STSAFE_L010;
+ stse_handle.io.BusType = STSE_BUS_TYPE_I2C;
+ stse_handle.io.BusSpeed = 100;
+ stse_handle.io.Devaddr = 0x0C;
- printf("\n\r - Initialize target STSAFE-L010");
- stse_ret = stse_init(&stse_handler);
+ printf("\n\n\r ## Initialize target STSAFE-L010");
+ stse_ret = stse_init(&stse_handle);
if (stse_ret != STSE_OK) {
- printf(PRINT_RED "\n\r ## stse_init ERROR : 0x%04X\n\r", stse_ret);
+ printf("\n\r ## stse_init : "PRINT_RED"ERROR 0x%04X"PRINT_RESET"\n\r", stse_ret);
apps_process_error(stse_ret);
}
/* ## Read zone ZONE_INDEX (counter zone) */
+
+ printf("\n\n\r ## stse_data_storage_read_counter_zone (zone : %d ; associated data length : %d) : ",
+ ZONE_INDEX,
+ sizeof(readBuffer) / sizeof(readBuffer[0])
+ );
+
stse_ret = stse_data_storage_read_counter_zone(
- &stse_handler, /* SE handler */
+ &stse_handle, /* SE handler */
ZONE_INDEX, /* Zone index */
0x0000, /* Read Offset */
readBuffer, /* Read buffer */
sizeof(readBuffer), /* Read length */
04, /* Read chunk size */
&counter_value, /* Counter Value */
- STSE_NO_PROT);
+ STSE_NO_PROT
+ );
+
if (stse_ret != STSE_OK) {
- printf(PRINT_RED "\n\n\r ### stse_data_storage_read_data_zone : ERROR 0x%04X", stse_ret);
+ printf(""PRINT_RED"ERROR 0x%04X"PRINT_RESET"\n\r",
+ stse_ret
+ );
apps_process_error(stse_ret);
} else {
- printf("\n\n\r - stse_data_storage_read_data_zone (zone : %d - length : %d - counter : %lu)", ZONE_INDEX, sizeof(readBuffer) / sizeof(readBuffer[0]), counter_value);
+ printf(PRINT_GREEN"SUCCESS"PRINT_RESET"\n\r");
+ printf("\n\n\r - Associated Data : \n\r");
apps_print_hex_buffer(readBuffer, sizeof(readBuffer));
+ printf("\n\n\r - Current counter value : %lu",counter_value);
}
/*## Generate random number */
+
apps_randomize_buffer(random, sizeof(random));
/* ## Decrement zone ZONE_INDEX counter and store Randomized Associated data */
+
+ printf("\n\n\n\r ## stse_data_storage_decrement_counter_zone (zone = %d ; amount = 1 ; data length = %d) : ",
+ ZONE_INDEX,
+ sizeof(random) / sizeof(random[0])
+ );
+
stse_ret = stse_data_storage_decrement_counter_zone(
- &stse_handler, /* SE handler */
+ &stse_handle, /* SE handler */
ZONE_INDEX, /* Zone index */
1, /* Decrement amount */
0x0000, /* Update Offset */
random, /* Update input buffer */
sizeof(random), /* Update Length */
&counter_value, /* Counter value */
- STSE_NO_PROT);
+ STSE_NO_PROT
+ );
+
if (stse_ret != STSE_OK) {
- printf(PRINT_RED "\n\n\r ### stse_data_storage_decrement_counter_zone : ERROR 0x%04X", stse_ret);
+ printf(PRINT_RED"ERROR 0x%04X"PRINT_RESET"\n\r",
+ stse_ret
+ );
apps_process_error(stse_ret);
} else {
- printf("\n\n\r - stse_data_storage_decrement_counter_zone (zone = %d - length = %d - New counter : %lu)", ZONE_INDEX, sizeof(random) / sizeof(random[0]), counter_value);
+ printf(PRINT_GREEN"SUCCESS"PRINT_RESET"\n\r");
+ printf("\n\n\r - Associated Data : \n\r");
apps_print_hex_buffer(random, sizeof(random));
+ printf("\n\n\r - Current counter value : %lu",counter_value);
}
/* ## Read Zone ZONE_INDEX (counter zone) */
+
+ printf("\n\n\n\r ## stse_data_storage_read_counter_zone (zone : %d ; associated data length : %d) : ",
+ ZONE_INDEX,
+ sizeof(readBuffer) / sizeof(readBuffer[0])
+ );
+
stse_ret = stse_data_storage_read_counter_zone(
- &stse_handler, /* SE handler */
+ &stse_handle, /* SE handler */
ZONE_INDEX, /* Zone index */
0x0000, /* Read Offset */
readBuffer, /* Read buffer */
@@ -133,14 +164,33 @@ int main(void) {
04, /* Read chunk size */
&counter_value, /* Counter Value */
STSE_NO_PROT);
+
if (stse_ret != STSE_OK) {
- printf(PRINT_RED "\n\n\r ### stse_data_storage_read_data_zone : ERROR 0x%04X", stse_ret);
+ printf(""PRINT_RED"ERROR 0x%04X"PRINT_RESET"\n\r",
+ stse_ret
+ );
+ apps_process_error(stse_ret);
} else {
- printf(PRINT_GREEN "\n\n\r - stse_data_storage_read_data_zone (zone : %d - length : %d - counter : %lu)", ZONE_INDEX, sizeof(readBuffer) / sizeof(readBuffer[0]), counter_value);
+ printf(PRINT_GREEN"SUCCESS"PRINT_RESET"\n\r");
+ printf("\n\n\r - Associated Data : \n\r");
apps_print_hex_buffer(readBuffer, sizeof(readBuffer));
+ printf("\n\n\r - Current counter value : %lu",counter_value);
+ }
+
+
+ /* ## Compare Associated data buffers */
+
+ if (apps_compare_buffers(random, readBuffer, sizeof(random))) {
+ printf("\n\n\n\r ## zone %d update : "PRINT_RED"ERROR "PRINT_RESET"\n\r",
+ ZONE_INDEX
+ );
+ } else {
+ printf("\n\n\r ## zone %d update : "PRINT_GREEN"SUCCESS "PRINT_RESET"\n\r",
+ ZONE_INDEX
+ );
}
- printf(PRINT_RESET "\n\r\n\r*#*# STMICROELECTRONICS #*#*\n\r");
+ printf("\n\n\r*#*# STMICROELECTRONICS #*#*\n\r");
while (1) {
// infinite loop
diff --git a/Applications/Projects/01_Secure_data_storage/stse_conf.h b/Applications/Projects/SPL01_Secure_data_storage/stse_conf.h
similarity index 100%
rename from Applications/Projects/01_Secure_data_storage/stse_conf.h
rename to Applications/Projects/SPL01_Secure_data_storage/stse_conf.h
diff --git a/Applications/Projects/SPL02_Device_authentication/README.md b/Applications/Projects/SPL02_Device_authentication/README.md
new file mode 100644
index 0000000..24d7b8c
--- /dev/null
+++ b/Applications/Projects/SPL02_Device_authentication/README.md
@@ -0,0 +1,89 @@
+
+# STSAFE-L Accessory authentication
+
+This project illustrates how to use the STSAFE-L Secure Element and STMicroelectronics Secure Element Library to perform device/accessory authentication.
+When loaded on the target MCU platform , the project performes an STSAFE-L authentication.
+This authentication scheme is typicaly used in accessories authentication use cases.
+
+```mermaid
+sequenceDiagram
+ box Authenticator
+ participant AUTH as Host MCU (CA certificate)
+ end
+ box Accessory
+ participant STSE as STSAFE-L (Leaf-certificate + Priv_key)
+ end
+ activate AUTH
+ AUTH ->>+ STSE : Device Authenticate API
+ STSE -->>- AUTH : Err code
+ Note over AUTH : Verify if Err code is equal to 0
+ deactivate AUTH
+```
+
+The example applicative flowchart is illustrated below :
+
+```mermaid
+flowchart TD
+ A["MAIN"] --> B["Initialize Apps terminal \n(baudrate = 115200)"]
+ B --> C["Print example title and instructions"]
+ C --> D["Initialize STSE Handler"]
+ D --> E["Device Authenticate API"]
+```
+
+STSELib API used in the example are the following :
+
+- stse_init
+- stse_certificate_parse
+- stse_certificate_print_parsed_cert
+- stse_certificate_get_key_type
+- stse_certificate_verify_signature
+- stse_certificate_is_parent
+- stse_ecc_generate_signature
+
+## Hardware and Software Prerequisites
+
+- [NUCLEO-L452RE - STM32L452RE evaluation board](https://www.st.com/en/evaluation-tools/nucleo-l452re.html)
+
+- [X-NUCLEO-ESE02A1 - STSAFE-L010 Secure element expansion board](https://www.st.com/en/evaluation-tools/x-nucleo-ese02a1.html)
+
+- [STM32CubeIDE - Integrated Development Environment for STM32](https://www.st.com/en/development-tools/stm32cubeide.html)
+
+- Serial terminal PC software (i.e. Teraterm)
+
+## Getting started with the project
+
+- Connect the [X-NUCLEO-ESE02A1](https://www.st.com/en/evaluation-tools/x-nucleo-ese02a1.html) expansion board on the top of the [NUCLEO-L452RE](https://www.st.com/en/evaluation-tools/nucleo-l452re.html) evaluation board.
+
+
+
+- Connect the board to the development computer and Open and configure a terminal software as follow (i.e. Teraterm).
+
+
+
+- Open the STM32CubeIDE projects located in Application/STM32CubeIDE
+
+- Build the project by clicking the “**Build the active configurations of selected projects\ **” button and verify that no error is reported by the GCC compiler/Linker.
+
+- Launch a debug session then wait the debugger to stop on the first main routine instruction and press Start button to execute the main routine.
+
+> [!NOTE]
+> - Power configuation Jumper must be set to 3V3-VCC.
+> - The COM port can differ from board to board. Please refer to windows device manager.
+
+Result :
+
+This project reports execution log through the on-board STLINK CDC bridge.
+These logs can be analyzed on development computer using a serial terminal application (i.e.: Teraterm).
+As example below.
+
+
+----------------------------------------------------------------------------------------------------------------
+- STSAFE-L010 Device Authentication Example -
+----------------------------------------------------------------------------------------------------------------
+- This example illustrates STSAFE-L010 device authentication process using Multi-Step approach. -
+- it can be taken as reference for building distant server authentication use cases. -
+----------------------------------------------------------------------------------------------------------------
+ - Initialize target STSAFE-L010
+
+ ## Device authentication over STSE-L SPL01 CA certificate : Successful
+
+ *
+ * This software is licensed under terms that can be found in the LICENSE file in
+ * the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef STSE_CONF_H
+#define STSE_CONF_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "stse_platform_generic.h"
+
+/************************************************************
+ * STSELIB DEVICE SUPPORT
+ ************************************************************/
+//#define STSE_CONF_STSAFE_A_SUPPORT
+#define STSE_CONF_STSAFE_L_SUPPORT
+
+/************************************************************
+ * STSAFE-A API/SERVICE SETTINGS
+ ************************************************************/
+#ifdef STSE_CONF_STSAFE_A_SUPPORT
+
+/* STSAFE-A ECC services configuration */
+#define STSE_CONF_ECC_NIST_P_256
+//#define STSE_CONF_ECC_NIST_P_384
+//#define STSE_CONF_ECC_NIST_P_521
+//#define STSE_CONF_ECC_BRAINPOOL_P_256
+//#define STSE_CONF_ECC_BRAINPOOL_P_384
+//#define STSE_CONF_ECC_BRAINPOOL_P_512
+//#define STSE_CONF_ECC_CURVE_25519
+//#define STSE_CONF_ECC_EDWARD_25519
+
+/* STSAFE-A HASH services configuration */
+//#define STSE_CONF_HASH_SHA_1
+//#define STSE_CONF_HASH_SHA_224
+#define STSE_CONF_HASH_SHA_256
+//#define STSE_CONF_HASH_SHA_384
+//#define STSE_CONF_HASH_SHA_512
+//#define STSE_CONF_HASH_SHA_3_256
+//#define STSE_CONF_HASH_SHA_3_384
+//#define STSE_CONF_HASH_SHA_3_512
+
+/* STSAFE-A STATIC PERSONALIZATION INFORMATIONS */
+//#define STSE_CONF_USE_STATIC_PERSONALIZATION_INFORMATIONS
+
+/* STSAFE-A HOST KEY MANAGEMENT (DEVICE PAIRING) */
+//#define STSE_CONF_USE_HOST_SESSION
+//#define STSE_CONF_USE_HOST_KEY_ESTABLISHMENT
+//#define STSE_CONF_USE_HOST_KEY_PROVISIONING_WRAPPED
+//#define STSE_CONF_USE_HOST_KEY_PROVISIONING_WRAPPED_AUTHENTICATED
+
+/* STSAFE-A SYMMETRIC KEY MANAGEMENT (DEVICE PAIRING) */
+//#define STSE_CONF_USE_SYMMETRIC_KEY_ESTABLISHMENT
+//#define STSE_CONF_USE_SYMMETRIC_KEY_ESTABLISHMENT_AUTHENTICATED
+//#define STSE_CONF_USE_SYMMETRIC_KEY_PROVISIONING_WRAPPED
+//#define STSE_CONF_USE_SYMMETRIC_KEY_PROVISIONING_WRAPPED_AUTHENTICATED
+
+#endif /* STSE_CONF_STSAFE_A_SUPPORT */
+
+/************************************************************
+ * STSAFE-L API/SERVICE SETTINGS
+ ************************************************************/
+#ifdef STSE_CONF_STSAFE_L_SUPPORT
+
+#ifndef STSE_CONF_HASH_SHA_256
+#define STSE_CONF_HASH_SHA_256
+#endif /*STSE_CONF_HASH_SHA_256*/
+
+#ifndef STSE_CONF_ECC_CURVE_25519
+#define STSE_CONF_ECC_CURVE_25519
+#endif /*STSE_CONF_ECC_CURVE_25519*/
+
+#ifndef STSE_CONF_ECC_EDWARD_25519
+#define STSE_CONF_ECC_EDWARD_25519
+#endif /*STSE_CONF_ECC_EDWARD_25519*/
+
+#define STSE_CONF_USE_I2C
+#define STSE_CONF_USE_ST1WIRE
+
+#endif /* STSE_CONF_STSAFE_L_SUPPORT */
+
+/*********************************************************
+ * COMMUNICATION SETTINGS
+ *********************************************************/
+
+#define STSE_USE_RSP_POLLING
+#define STSE_MAX_POLLING_RETRY 100
+#define STSE_FIRST_POLLING_INTERVAL 10
+#define STSE_POLLING_RETRY_INTERVAL 10
+//#define STSE_FRAME_DEBUG_LOG
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* STSE_CONF_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/Applications/Projects/SPL02_Device_authentication_multi_steps/README.md b/Applications/Projects/SPL02_Device_authentication_multi_steps/README.md
new file mode 100644
index 0000000..0b52aaf
--- /dev/null
+++ b/Applications/Projects/SPL02_Device_authentication_multi_steps/README.md
@@ -0,0 +1,229 @@
+
+# STSAFE-L Accessory authentication
+
+This project illustrates how to use the STSAFE-L Secure Element and STMicroelectronics Secure Element Library to perform device/accessory authentication.
+When loaded on the target MCU platform , the project performes an STSAFE-L authentication.
+This authentication scheme is typicaly used in accessories authentication use cases.
+
+```mermaid
+sequenceDiagram
+ box Authenticator
+ participant AUTH as Host MCU (CA certificate)
+ end
+ box Accessory
+ participant STSE as STSAFE-L (Leaf-certificate + Priv_key)
+ end
+ activate AUTH
+ AUTH ->>+ STSE : Get Certificate (read User-NVM zone 0)
+ STSE -->>- AUTH : Accessory leaf-certificate
+ note over AUTH : Verify certificate using public key from CA certificate
+ note over AUTH : Generate Challenge (TRNG)
+ AUTH ->>+ STSE : ECDSA_Sign(Challenge)
+ note over STSE : Generate signature using Priv_ke (ECDSA sign)
+ STSE -->>- AUTH : signature
+ Note over AUTH : Verify signature using public key from CA certificate (ECDSA verify)
+ deactivate AUTH
+```
+
+The example applicative flowchart is illustrated below :
+
+```mermaid
+flowchart TD
+ A["MAIN"] --> B["Initialize Apps terminal \n(baudrate = 115200)"]
+ B --> C["Print example title and instructions"]
+ C --> D["Initialize STSE Handler"]
+ D --> E["Parse and print Root CA certificate"]
+ E --> F["Get STSAFE-L leaf-certificate"]
+ F --> G["Parse and print STSAFE-L leaf-certificate"]
+ G --> H["Verify device certificate signature using Root CA public key"]
+ H --> I["Generate Challenge \n(Random Number)"]
+ I --> J["Get Challenge signature from STSAFE-L "]
+ J --> K["Verify signature using STSAFE-L pubkey"]
+```
+
+STSELib API used in the example are the following :
+
+- stse_init
+- stse_certificate_parse
+- stse_certificate_print_parsed_cert
+- stse_certificate_get_key_type
+- stse_certificate_verify_signature
+- stse_certificate_is_parent
+- stse_ecc_generate_signature
+
+## Hardware and Software Prerequisites
+
+- [NUCLEO-L452RE - STM32L452RE evaluation board](https://www.st.com/en/evaluation-tools/nucleo-l452re.html)
+
+- [X-NUCLEO-ESE01A1 - STSAFE-L010 Secure element expansion board](https://www.st.com/en/evaluation-tools/x-nucleo-ese02a1.html)
+
+- [STM32CubeIDE - Integrated Development Environment for STM32](https://www.st.com/en/development-tools/stm32cubeide.html)
+
+- Serial terminal PC software (i.e. Teraterm)
+
+## Getting started with the project
+
+- Connect the [X-NUCLEO-ESE02A1](https://www.st.com/en/evaluation-tools/x-nucleo-ese02a1.html) expansion board on the top of the [NUCLEO-L452RE](https://www.st.com/en/evaluation-tools/nucleo-l452re.html) evaluation board.
+
+
+
+- Connect the board to the development computer and Open and configure a terminal software as follow (i.e. Teraterm).
+
+
+
+- Open the STM32CubeIDE projects located in Application/STM32CubeIDE
+
+- Build the project by clicking the “**Build the active configurations of selected projects\ **” button and verify that no error is reported by the GCC compiler/Linker.
+
+- Launch a debug session then wait the debugger to stop on the first main routine instruction and press Start button to execute the main routine.
+
+> [!NOTE]
+> - Power configuation Jumper must be set to 3V3-VCC.
+> - The COM port can differ from board to board. Please refer to windows device manager.
+
+Result :
+
+This project reports execution log through the on-board STLINK CDC bridge.
+These logs can be analyzed on development computer using a serial terminal application (i.e.: Teraterm).
+As example below.
+
+
+ *
+ * This software is licensed under terms that can be found in the LICENSE file in
+ * the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef STSE_CONF_H
+#define STSE_CONF_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "stse_platform_generic.h"
+
+/************************************************************
+ * STSELIB DEVICE SUPPORT
+ ************************************************************/
+//#define STSE_CONF_STSAFE_A_SUPPORT
+#define STSE_CONF_STSAFE_L_SUPPORT
+
+/************************************************************
+ * STSAFE-A API/SERVICE SETTINGS
+ ************************************************************/
+#ifdef STSE_CONF_STSAFE_A_SUPPORT
+
+/* STSAFE-A ECC services configuration */
+#define STSE_CONF_ECC_NIST_P_256
+//#define STSE_CONF_ECC_NIST_P_384
+//#define STSE_CONF_ECC_NIST_P_521
+//#define STSE_CONF_ECC_BRAINPOOL_P_256
+//#define STSE_CONF_ECC_BRAINPOOL_P_384
+//#define STSE_CONF_ECC_BRAINPOOL_P_512
+//#define STSE_CONF_ECC_CURVE_25519
+//#define STSE_CONF_ECC_EDWARD_25519
+
+/* STSAFE-A HASH services configuration */
+//#define STSE_CONF_HASH_SHA_1
+//#define STSE_CONF_HASH_SHA_224
+#define STSE_CONF_HASH_SHA_256
+//#define STSE_CONF_HASH_SHA_384
+//#define STSE_CONF_HASH_SHA_512
+//#define STSE_CONF_HASH_SHA_3_256
+//#define STSE_CONF_HASH_SHA_3_384
+//#define STSE_CONF_HASH_SHA_3_512
+
+/* STSAFE-A STATIC PERSONALIZATION INFORMATIONS */
+//#define STSE_CONF_USE_STATIC_PERSONALIZATION_INFORMATIONS
+
+/* STSAFE-A HOST KEY MANAGEMENT (DEVICE PAIRING) */
+//#define STSE_CONF_USE_HOST_SESSION
+//#define STSE_CONF_USE_HOST_KEY_ESTABLISHMENT
+//#define STSE_CONF_USE_HOST_KEY_PROVISIONING_WRAPPED
+//#define STSE_CONF_USE_HOST_KEY_PROVISIONING_WRAPPED_AUTHENTICATED
+
+/* STSAFE-A SYMMETRIC KEY MANAGEMENT (DEVICE PAIRING) */
+//#define STSE_CONF_USE_SYMMETRIC_KEY_ESTABLISHMENT
+//#define STSE_CONF_USE_SYMMETRIC_KEY_ESTABLISHMENT_AUTHENTICATED
+//#define STSE_CONF_USE_SYMMETRIC_KEY_PROVISIONING_WRAPPED
+//#define STSE_CONF_USE_SYMMETRIC_KEY_PROVISIONING_WRAPPED_AUTHENTICATED
+
+#endif /* STSE_CONF_STSAFE_A_SUPPORT */
+
+/************************************************************
+ * STSAFE-L API/SERVICE SETTINGS
+ ************************************************************/
+#ifdef STSE_CONF_STSAFE_L_SUPPORT
+
+#ifndef STSE_CONF_HASH_SHA_256
+#define STSE_CONF_HASH_SHA_256
+#endif /*STSE_CONF_HASH_SHA_256*/
+
+#ifndef STSE_CONF_ECC_CURVE_25519
+#define STSE_CONF_ECC_CURVE_25519
+#endif /*STSE_CONF_ECC_CURVE_25519*/
+
+#ifndef STSE_CONF_ECC_EDWARD_25519
+#define STSE_CONF_ECC_EDWARD_25519
+#endif /*STSE_CONF_ECC_EDWARD_25519*/
+
+#define STSE_CONF_USE_I2C
+#define STSE_CONF_USE_ST1WIRE
+
+#endif /* STSE_CONF_STSAFE_L_SUPPORT */
+
+/*********************************************************
+ * COMMUNICATION SETTINGS
+ *********************************************************/
+
+#define STSE_USE_RSP_POLLING
+#define STSE_MAX_POLLING_RETRY 100
+#define STSE_FIRST_POLLING_INTERVAL 10
+#define STSE_POLLING_RETRY_INTERVAL 10
+//#define STSE_FRAME_DEBUG_LOG
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* STSE_CONF_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/Applications/Projects/SPL02_Echo_loop/README.md b/Applications/Projects/SPL02_Echo_loop/README.md
new file mode 100644
index 0000000..3f2c331
--- /dev/null
+++ b/Applications/Projects/SPL02_Echo_loop/README.md
@@ -0,0 +1,135 @@
+
+# STSAFE-L Echo Example
+
+This project illustrates how to use the STSAFE-L Secure Element and STMicroelectronics Secure Element Library to perform an echo loop between Host and STSAFE-L Secure Element.
+Echo loop scenario is usefull for :
+- SE integration and stability test
+- Accessory hot-plug/presence detection
+
+
+```mermaid
+sequenceDiagram
+ box Authenticator
+ participant HOST as Host MCU
+ end
+ box Accessory
+ participant STSE as STSAFE-L
+ end
+ activate HOST
+loop Echo loop
+ note over HOST : prepare random content and size message
+ HOST ->>+ STSE : Echo (Message)
+ STSE -->>- HOST :echoed Message
+ note over HOST : Compare Message and echoed_message
+ deactivate HOST
+end
+```
+
+The example applicative flowchart is illustrated below :
+
+```mermaid
+flowchart TD
+ A[Start] --> C[Initialize terminal and print example title]
+ C --> E[Set STSE handler values]
+ E --> F[Initialize STSE]
+ F --> I{Infinite Loop}
+ I --> J[Randomize message content and length]
+ J --> K[Print message]
+ K --> L[Call stse_device_echo]
+ L --> M{Echo OK?}
+ M -- No --> N[Print error and halt]
+ M -- Yes --> O[Compare message and echoed_message]
+ O --> P{Match?}
+ P -- No --> Q[Print compare fail, print echoed message, halt]
+ P -- Yes --> R[Print echoed message]
+ R --> S[Wait 1s]
+ S --> I
+```
+
+STSELib API used in the example are the following :
+
+- stse_init
+- stse_echo
+
+## Hardware and Software Prerequisites
+
+- [NUCLEO-L452RE - STM32L452RE evaluation board](https://www.st.com/en/evaluation-tools/nucleo-l452re.html)
+
+- [X-NUCLEO-ESE02A1 - STSAFE-L010 Secure element expansion board](https://www.st.com/en/evaluation-tools/x-nucleo-ese02a1.html)
+
+- [STM32CubeIDE - Integrated Development Environment for STM32](https://www.st.com/en/development-tools/stm32cubeide.html)
+
+- Serial terminal PC software (i.e. Teraterm)
+
+## Getting started with the project
+
+- Connect the [X-NUCLEO-ESE02A1](https://www.st.com/en/evaluation-tools/x-nucleo-ese02a1.html) expansion board on the top of the [NUCLEO-L452RE](https://www.st.com/en/evaluation-tools/nucleo-l452re.html) evaluation board.
+
+
+
+- Connect the board to the development computer and Open and configure a terminal software as follow (i.e. Teraterm).
+
+
+
+- Open the STM32CubeIDE projects located in Application/STM32CubeIDE
+
+- Build the project by clicking the “**Build the active configurations of selected projects\ **” button and verify that no error is reported by the GCC compiler/Linker.
+
+- Launch a debug session then wait the debugger to stop on the first main routine instruction and press Start button to execute the main routine.
+
+> [!NOTE]
+> - Power configuation Jumper must be set to 3V3-VCC.
+> - The COM port can differ from board to board. Please refer to windows device manager.
+
+Result :
+
+This project reports execution log through the on-board STLINK CDC bridge.
+These logs can be analyzed on development computer using a serial terminal application (i.e.: Teraterm).
+As example below.
+
+
+ *
+ * This software is licensed under terms that can be found in the LICENSE file in
+ * the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef STSE_CONF_H
+#define STSE_CONF_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "stse_platform_generic.h"
+
+/************************************************************
+ * STSELIB DEVICE SUPPORT
+ ************************************************************/
+//#define STSE_CONF_STSAFE_A_SUPPORT
+#define STSE_CONF_STSAFE_L_SUPPORT
+
+/************************************************************
+ * STSAFE-A API/SERVICE SETTINGS
+ ************************************************************/
+#ifdef STSE_CONF_STSAFE_A_SUPPORT
+
+/* STSAFE-A ECC services configuration */
+#define STSE_CONF_ECC_NIST_P_256
+//#define STSE_CONF_ECC_NIST_P_384
+//#define STSE_CONF_ECC_NIST_P_521
+//#define STSE_CONF_ECC_BRAINPOOL_P_256
+//#define STSE_CONF_ECC_BRAINPOOL_P_384
+//#define STSE_CONF_ECC_BRAINPOOL_P_512
+//#define STSE_CONF_ECC_CURVE_25519
+//#define STSE_CONF_ECC_EDWARD_25519
+
+/* STSAFE-A HASH services configuration */
+//#define STSE_CONF_HASH_SHA_1
+//#define STSE_CONF_HASH_SHA_224
+#define STSE_CONF_HASH_SHA_256
+//#define STSE_CONF_HASH_SHA_384
+//#define STSE_CONF_HASH_SHA_512
+//#define STSE_CONF_HASH_SHA_3_256
+//#define STSE_CONF_HASH_SHA_3_384
+//#define STSE_CONF_HASH_SHA_3_512
+
+/* STSAFE-A STATIC PERSONALIZATION INFORMATIONS */
+//#define STSE_CONF_USE_STATIC_PERSONALIZATION_INFORMATIONS
+
+/* STSAFE-A HOST KEY MANAGEMENT (DEVICE PAIRING) */
+#define STSE_CONF_USE_HOST_SESSION
+//#define STSE_CONF_USE_HOST_KEY_ESTABLISHMENT
+//#define STSE_CONF_USE_HOST_KEY_PROVISIONING_WRAPPED
+//#define STSE_CONF_USE_HOST_KEY_PROVISIONING_WRAPPED_AUTHENTICATED
+
+/* STSAFE-A SYMMETRIC KEY MANAGEMENT (DEVICE PAIRING) */
+//#define STSE_CONF_USE_SYMMETRIC_KEY_ESTABLISHMENT
+//#define STSE_CONF_USE_SYMMETRIC_KEY_ESTABLISHMENT_AUTHENTICATED
+//#define STSE_CONF_USE_SYMMETRIC_KEY_PROVISIONING_WRAPPED
+//#define STSE_CONF_USE_SYMMETRIC_KEY_PROVISIONING_WRAPPED_AUTHENTICATED
+
+#endif /* STSE_CONF_STSAFE_A_SUPPORT */
+
+/************************************************************
+ * STSAFE-L API/SERVICE SETTINGS
+ ************************************************************/
+#ifdef STSE_CONF_STSAFE_L_SUPPORT
+
+#ifndef STSE_CONF_HASH_SHA_256
+#define STSE_CONF_HASH_SHA_256
+#endif /*STSE_CONF_HASH_SHA_256*/
+
+#ifndef STSE_CONF_ECC_CURVE_25519
+#define STSE_CONF_ECC_CURVE_25519
+#endif /*STSE_CONF_ECC_CURVE_25519*/
+
+#ifndef STSE_CONF_ECC_EDWARD_25519
+#define STSE_CONF_ECC_EDWARD_25519
+#endif /*STSE_CONF_ECC_EDWARD_25519*/
+
+#define STSE_CONF_USE_I2C
+#define STSE_CONF_USE_ST1WIRE
+
+#endif /* STSE_CONF_STSAFE_L_SUPPORT */
+
+/*********************************************************
+ * COMMUNICATION SETTINGS
+ *********************************************************/
+
+#define STSE_USE_RSP_POLLING
+#define STSE_MAX_POLLING_RETRY 100
+#define STSE_FIRST_POLLING_INTERVAL 10
+#define STSE_POLLING_RETRY_INTERVAL 10
+//#define STSE_FRAME_DEBUG_LOG
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* STSE_CONF_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/Applications/Projects/SPL02_Secure_data_storage/README.md b/Applications/Projects/SPL02_Secure_data_storage/README.md
new file mode 100644
index 0000000..ba089b7
--- /dev/null
+++ b/Applications/Projects/SPL02_Secure_data_storage/README.md
@@ -0,0 +1,126 @@
+# STSAFE-L010 Secure data storage
+This project illustrates how to use the STSAFE-L010 Secure Element and STMicroelectronics Secure Element Library to perform data storage through STSAFE-L010 Secure Element.
+When loaded on the target MCU platform , the project performes the storage of 100 bytes through STSAFE-L010 User-NVM Zone 32.
+This storage scheme is typically used to store data securely.
+
+```mermaid
+sequenceDiagram
+ box HOST
+ participant HOST as MCU
+ end
+ box Accessory
+ participant STSE as STSAFE-L010
+ end
+
+ HOST ->>+ STSE : Read User-NVM Zone 32 with associated counter (16 bytes at offset 0x0000)
+ STSE -->>- HOST : 16 bytes from User-NVM Zone 32 & counter value
+ note over HOST : Print 16 bytes read from User-NVM Zone 32 & counter value
+
+ HOST ->>+ STSE : Generate 16 bytes random number (using platform random number generator)
+ STSE -->>- HOST : 16 bytes random number
+ HOST ->>+ STSE : Decrement Zone 32 counter & Update User-NVM Zone 32 with generated random number (16 new bytes at offset 0x0000)
+ note over HOST : Print data stored by API (16 new bytes random number) & new counter value
+ HOST ->>+ STSE : Read User-NVM Zone 32 (16 bytes at offset 0x0000)
+ STSE -->>- HOST : 16 bytes from User-NVM Zone 32
+ note over HOST : Print 16 bytes read from User-NVM Zone 32 These 16 bytes shall be identical to generated 16 bytes random number and different than 16 bytes firstly read The counter value shall be decremented of one unit
+```
+
+The example applicative flowchart is illustrated below :
+
+```mermaid
+flowchart TD
+ A["MAIN"] --> B["Initialize Apps terminal (baudrate = 115200)"]
+ B --> C["Print example title and instructions"]
+ C --> D["Initialize STSE Handler"]
+ D --> E["Print 16 bytes read from User-NVM Zone 32 and associated counter value"]
+ E --> F["Generate Random Number (16 bytes)"]
+ F --> G["Print Random Number"]
+ G --> H["Store Random Number through User-NVM Zone 32 & decrement counter"]
+ H --> I["Print new 16 bytes stored through User-NVM Zone 32 and new associated counter value returned by decrement counter zone command"]
+ I --> J["Print 16 bytes read from User-NVM Zone 32 and associated counter value returned by read counter zone command"]
+```
+
+STSELib API used in the example are the following :
+
+- stse_set_default_handler_value
+- stse_init
+- stse_data_storage_read_counter_zone
+- rng_generate_random_number
+- stse_data_storage_decrement_counter_zone
+
+
+## Hardware and Software Prerequisites
+
+- [NUCLEO-L452RE - STM32L452RE evaluation board](https://www.st.com/en/evaluation-tools/nucleo-l452re.html)
+
+- [X-NUCLEO-ESE02A1 - STSAFE-L010 Secure element expansion board](https://www.st.com/en/ecosystems/x-nucleo-ese02a1.html)
+
+- [STM32CubeIDE - Integrated Development Environment for STM32](https://www.st.com/en/development-tools/stm32cubeide.html)
+
+- Serial terminal PC software (i.e. Teraterm)
+
+## Getting started with the project
+
+- Connect the [X-NUCLEO-ESE02A1](https://www.st.com/en/ecosystems/x-nucleo-ese02a1.html) expansion board on the top of the [NUCLEO-L452RE](https://www.st.com/en/evaluation-tools/nucleo-l452re.html) evaluation board.
+
+
+
+- Connect the board to the development computer and Open and configure a terminal software as follow (i.e. Teraterm).
+
+
+
+- Open the STM32CubeIDE projects located in Application/STM32CubeIDE
+
+- Build the project by clicking the “**Build the active configurations of selected projects\ **” button and verify that no error is reported by the GCC compiler/Linker.
+
+- Launch a debug session then wait the debugger to stop on the first main routine instruction and press Start button to execute the main routine.
+
+> [!NOTE]
+> - Power configuation Jumper must be set to 3V3-VCC.
+> - The COM port can differ from board to board. Please refer to windows device manager.
+
+Result :
+
+This project reports execution log through the on-board STLINK CDC bridge.
+These logs can be analyzed on development computer using a serial terminal application (i.e.: Teraterm).
+As example below.
+
+
+----------------------------------------------------------------------------------------------------------------
+- STSAFE-L010 secure data storage zone access example -
+----------------------------------------------------------------------------------------------------------------
+- -
+- description : -
+- This examples illustrates how to makes use of the STSAFE-L data storage APIs by performing following -
+- accesses/commands to the target STSAFE device -
+- o Query STSAFE-L total partition count -
+- o Query STSAFE-L partitions information -
+- o Read STSAFE-L zone 'ZONE_INDEX' -
+- o Update STSAFE-L zone 'ZONE_INDEX' -
+- -
+- Note : zone IDs used in this example are aligned with STSAFE-L010 SPL01 personalization -
+- Accesses parameters must be adapted for other device personalization -
+- -
+----------------------------------------------------------------------------------------------------------------
+ - Initialize target STSAFE-L010
+
+ - stse_data_storage_read_data_zone (zone : 32 - length : 16 - counter : 16777215)
+ 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
+
+ - stse_data_storage_decrement_counter_zone (zone = 32 - length = 16 - New counter : 16777214)
+ 0x4C 0x20 0xC4 0x0B 0xD1 0x30 0x8F 0x36 0xD6 0x54 0x31 0x54 0x2A 0x28 0x3E 0xC2
+
+ - stse_data_storage_read_data_zone (zone : 32 - length : 16 - counter : 16777214)
+ 0x4C 0x20 0xC4 0x0B 0xD1 0x30 0x8F 0x36 0xD6 0x54 0x31 0x54 0x2A 0x28 0x3E 0xC2
+
+*#*# STMICROELECTRONICS #*#*
+
+
+ ## How to adapt the exemple
+
+ Each STSE handler contains SE's informations mandatory by the STSELib to manage correctly targeted API and services.
+- device_type : STSAFE-A100/ STSAFE-A110/ STSAFE-A120
+- pPersoInfo : pointer to a specific device perso configuration
+- pActive_host_session : active host session managed by the open session API set
+- pActive_other_session : other session managed by the open session API set.
+- Io : communication bus description like I2C device address , I2C speed
diff --git a/Applications/Projects/01_Device_authentication_multi_steps/STM32CubeIDE/.cproject b/Applications/Projects/SPL02_Secure_data_storage/STM32CubeIDE/.cproject
similarity index 96%
rename from Applications/Projects/01_Device_authentication_multi_steps/STM32CubeIDE/.cproject
rename to Applications/Projects/SPL02_Secure_data_storage/STM32CubeIDE/.cproject
index b6b7370..7389a9d 100644
--- a/Applications/Projects/01_Device_authentication_multi_steps/STM32CubeIDE/.cproject
+++ b/Applications/Projects/SPL02_Secure_data_storage/STM32CubeIDE/.cproject
@@ -25,7 +25,7 @@
-
+
@@ -113,7 +113,7 @@
-
+
@@ -180,7 +180,7 @@
-
+
diff --git a/Applications/Projects/SPL02_Secure_data_storage/STM32CubeIDE/.project b/Applications/Projects/SPL02_Secure_data_storage/STM32CubeIDE/.project
new file mode 100644
index 0000000..5626c12
--- /dev/null
+++ b/Applications/Projects/SPL02_Secure_data_storage/STM32CubeIDE/.project
@@ -0,0 +1,63 @@
+
+
+ SPL02_Secure_data_storage
+
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.genmakebuilder
+ clean,full,incremental,
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
+ full,incremental,
+
+
+
+
+
+ org.eclipse.cdt.core.cnature
+ org.eclipse.cdt.managedbuilder.core.managedBuildNature
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
+
+
+
+ Apps_utils
+ 2
+ PARENT-3-PROJECT_LOC/Apps_utils
+
+
+ Documentation
+ 2
+ PARENT-5-PROJECT_LOC/Documentation
+
+
+ Middleware
+ 2
+ PARENT-4-PROJECT_LOC/Middleware
+
+
+ stse-host-platform
+ 2
+ PARENT-4-PROJECT_LOC/stse-host-platform
+
+
+ stse-crypto-platform
+ 2
+ PARENT-4-PROJECT_LOC/stse-crypto-platform
+
+
+ main.c
+ 1
+ PARENT-1-PROJECT_LOC/main.c
+
+
+ stse_conf.h
+ 1
+ PARENT-1-PROJECT_LOC/stse_conf.h
+
+
+
diff --git a/Applications/Projects/SPL02_Secure_data_storage/main.c b/Applications/Projects/SPL02_Secure_data_storage/main.c
new file mode 100644
index 0000000..27cbb80
--- /dev/null
+++ b/Applications/Projects/SPL02_Secure_data_storage/main.c
@@ -0,0 +1,199 @@
+/**
+ ******************************************************************************
+ * @file main.c
+ * @author CS application team
+ * @brief STSAFE-L010 Secure data storage access example
+ ******************************************************************************
+ * COPYRIGHT 2022 STMicroelectronics
+ *
+ * This software is licensed under terms that can be found in the LICENSE file in
+ * the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ ******************************************************************************
+ */
+
+/* Includes ------------------------------------------------------------------*/
+
+#include "Apps_utils.h"
+
+/* Defines -------------------------------------------------------------------*/
+#define READ_BUFFER_SIZE 16 /**< Size of read buffer for zone data */
+#define RANDOM_SIZE 16 /**< Size of random data to write to zone */
+#define ZONE_INDEX 32U /**< Index of the zone */
+
+/**
+ * @brief Main program entry point - STSAFE-L010 Secure data storage zone access
+ * @details Demonstrates data storage partition operations:
+ * - Queries total partition count
+ * - Retrieves and displays partition configuration table
+ * - Reads data from zone 1 and displays content
+ * - Generates random data and writes to zone 1
+ * - Reads back zone 1 to verify the update
+ * - Compares read data with written data
+ * @note Zone IDs are aligned with STSAFE-L010 SPL02 personalization.
+ * Access parameters must be adapted for other personalizations.
+ * @retval Not applicable (infinite loop on success or error)
+ */
+int main(void) {
+ stse_ReturnCode_t stse_ret = STSE_API_INVALID_PARAMETER;
+ stse_Handler_t stse_handle;
+ uint32_t counter_value;
+
+ uint8_t readBuffer[READ_BUFFER_SIZE];
+ uint8_t random[RANDOM_SIZE];
+
+ /* Initialize Terminal */
+ apps_terminal_init(115200);
+
+ /* ## Print Example instruction on terminal */
+ printf(PRINT_CLEAR_SCREEN PRINT_RESET);
+ printf("----------------------------------------------------------------------------------------------------------------");
+ printf("\n\r- STSAFE-L010 secure data storage zone access example -");
+ printf("\n\r----------------------------------------------------------------------------------------------------------------");
+ printf("\n\r- -");
+ printf("\n\r- description : -");
+ printf("\n\r- This examples illustrates how to makes use of the STSAFE-L data storage APIs by performing following -");
+ printf("\n\r- accesses/commands to the target STSAFE device -");
+ printf("\n\r- o Read STSAFE-L zone 'ZONE_INDEX' -");
+ printf("\n\r- o Update STSAFE-L zone 'ZONE_INDEX' -");
+ printf("\n\r- -");
+ printf("\n\r- Note : zone IDs used in this example are aligned with STSAFE-L010 SPL02 personalization -");
+ printf("\n\r- Accesses parameters must be adapted for other device personalization -");
+ printf("\n\r- -");
+ printf("\n\r----------------------------------------------------------------------------------------------------------------");
+ printf("\n\n\r ( Press key to continue )");
+ uart_getc();
+
+ /* ## Initialize STSAFE-L010 device handler */
+ stse_ret = stse_set_default_handler_value(&stse_handle);
+ if (stse_ret != STSE_OK) {
+ printf("\n\r ## stse_set_default_handler_value : "PRINT_RED"ERROR 0x%04X"PRINT_RESET"\n\r", stse_ret);
+ apps_process_error(stse_ret);
+ }
+
+ stse_handle.device_type = STSAFE_L010;
+ stse_handle.io.BusType = STSE_BUS_TYPE_ST1WIRE;
+ stse_handle.io.Devaddr = 0x00;
+
+ printf("\n\n\r ## Initialize target STSAFE-L010");
+ stse_ret = stse_init(&stse_handle);
+ if (stse_ret != STSE_OK) {
+ printf("\n\r ## stse_init : "PRINT_RED"ERROR 0x%04X"PRINT_RESET"\n\r", stse_ret);
+ apps_process_error(stse_ret);
+ }
+
+ /* ## Read zone ZONE_INDEX (counter zone) */
+
+ printf("\n\n\r ## stse_data_storage_read_counter_zone (zone : %d ; associated data length : %d) : ",
+ ZONE_INDEX,
+ sizeof(readBuffer) / sizeof(readBuffer[0])
+ );
+
+ stse_ret = stse_data_storage_read_counter_zone(
+ &stse_handle, /* SE handler */
+ ZONE_INDEX, /* Zone index */
+ 0x0000, /* Read Offset */
+ readBuffer, /* Read buffer */
+ sizeof(readBuffer), /* Read length */
+ 04, /* Read chunk size */
+ &counter_value, /* Counter Value */
+ STSE_NO_PROT
+ );
+
+ if (stse_ret != STSE_OK) {
+ printf(""PRINT_RED"ERROR 0x%04X"PRINT_RESET"\n\r",
+ stse_ret
+ );
+ apps_process_error(stse_ret);
+ } else {
+ printf(PRINT_GREEN"SUCCESS"PRINT_RESET"\n\r");
+ printf("\n\n\r - Associated Data : \n\r");
+ apps_print_hex_buffer(readBuffer, sizeof(readBuffer));
+ printf("\n\n\r - Current counter value : %lu",counter_value);
+ }
+
+ /*## Generate random number */
+
+ apps_randomize_buffer(random, sizeof(random));
+
+ /* ## Decrement zone ZONE_INDEX counter and store Randomized Associated data */
+
+ printf("\n\n\n\r ## stse_data_storage_decrement_counter_zone (zone = %d ; amount = 1 ; data length = %d) : ",
+ ZONE_INDEX,
+ sizeof(random) / sizeof(random[0])
+ );
+
+ stse_ret = stse_data_storage_decrement_counter_zone(
+ &stse_handle, /* SE handler */
+ ZONE_INDEX, /* Zone index */
+ 1, /* Decrement amount */
+ 0x0000, /* Update Offset */
+ random, /* Update input buffer */
+ sizeof(random), /* Update Length */
+ &counter_value, /* Counter value */
+ STSE_NO_PROT
+ );
+
+ if (stse_ret != STSE_OK) {
+ printf(PRINT_RED"ERROR 0x%04X"PRINT_RESET"\n\r",
+ stse_ret
+ );
+ apps_process_error(stse_ret);
+ } else {
+ printf(PRINT_GREEN"SUCCESS"PRINT_RESET"\n\r");
+ printf("\n\n\r - Associated Data : \n\r");
+ apps_print_hex_buffer(random, sizeof(random));
+ printf("\n\n\r - Current counter value : %lu",counter_value);
+ }
+
+ /* ## Read Zone ZONE_INDEX (counter zone) */
+
+ printf("\n\n\n\r ## stse_data_storage_read_counter_zone (zone : %d ; associated data length : %d) : ",
+ ZONE_INDEX,
+ sizeof(readBuffer) / sizeof(readBuffer[0])
+ );
+
+ stse_ret = stse_data_storage_read_counter_zone(
+ &stse_handle, /* SE handler */
+ ZONE_INDEX, /* Zone index */
+ 0x0000, /* Read Offset */
+ readBuffer, /* Read buffer */
+ sizeof(readBuffer), /* Read length */
+ 04, /* Read chunk size */
+ &counter_value, /* Counter Value */
+ STSE_NO_PROT);
+
+ if (stse_ret != STSE_OK) {
+ printf(""PRINT_RED"ERROR 0x%04X"PRINT_RESET"\n\r",
+ stse_ret
+ );
+ apps_process_error(stse_ret);
+ } else {
+ printf(PRINT_GREEN"SUCCESS"PRINT_RESET"\n\r");
+ printf("\n\n\r - Associated Data : \n\r");
+ apps_print_hex_buffer(readBuffer, sizeof(readBuffer));
+ printf("\n\n\r - Current counter value : %lu",counter_value);
+ }
+
+
+ /* ## Compare Associated data buffers */
+
+ if (apps_compare_buffers(random, readBuffer, sizeof(random))) {
+ printf("\n\n\n\r ## zone %d update : "PRINT_RED"ERROR "PRINT_RESET"\n\r",
+ ZONE_INDEX
+ );
+ } else {
+ printf("\n\n\r ## zone %d update : "PRINT_GREEN"SUCCESS "PRINT_RESET"\n\r",
+ ZONE_INDEX
+ );
+ }
+
+ printf("\n\n\r*#*# STMICROELECTRONICS #*#*\n\r");
+
+ while (1) {
+ // infinite loop
+ }
+
+ return 0;
+}
diff --git a/Applications/Projects/SPL02_Secure_data_storage/stse_conf.h b/Applications/Projects/SPL02_Secure_data_storage/stse_conf.h
new file mode 100644
index 0000000..111eadd
--- /dev/null
+++ b/Applications/Projects/SPL02_Secure_data_storage/stse_conf.h
@@ -0,0 +1,114 @@
+/******************************************************************************
+ * \file stse_conf.h
+ * \brief STSecureElement library configuration file
+ * \author STMicroelectronics - CS application team
+ *
+ ******************************************************************************
+ * \attention
+ *
+ *