-
Notifications
You must be signed in to change notification settings - Fork 2
[ Example ] Project template
This template provides a minimal starting point for developing custom STSAFE-A120 application projects.
It includes the basic initialization and structure needed to communicate with the STSAFE-A120 secure element, allowing developers to quickly build their own examples and applications.
The template demonstrates the essential setup steps required for any STSAFE-A120 application, including terminal initialization and the main application loop structure. Developers can use this as a foundation and add their specific functionality.
The following flowchart illustrates the basic template structure:
The template provides the following structure:
/**
* @brief Main program entry point
* @note This is a template project for STSAFE-A120 examples
* Add your application code here
* @retval Not applicable (infinite loop)
*/
int main(void) {
/* Initialize Terminal */
apps_terminal_init(115200);
while (1) {
/* Infinite loop - add your application code here */
}
}To create a new STSAFE-A120 application project:
-
Copy the Template:
- Duplicate the
00_Projec_templatedirectory - Rename it according to your project name
- Duplicate the
-
Add Device Initialization:
stse_ReturnCode_t stse_ret; stse_Handler_t stse_handler; /* Initialize STSAFE-A device handler */ stse_ret = stse_set_default_handler_value(&stse_handler); stse_handler.device_type = STSAFE_A120; stse_handler.io.busID = 1; stse_handler.io.BusSpeed = 400; /* Initialize device */ stse_ret = stse_init(&stse_handler);
-
Add Your Application Logic:
- Implement your specific STSAFE-A120 operations
- Add error handling
- Configure device features as needed
-
Customize Configuration:
- Modify
stse_conf.hto enable/disable specific features - Adjust memory allocations and buffer sizes
- Modify
Typical additions to the template include:
-
Device Authentication:
stse_device_authenticate(&stse_handler, ca_cert, cert_zone, key_slot);
-
Key Generation:
stse_generate_key_pair(&stse_handler, slot_number, key_type);
-
Data Storage:
stse_data_partition_write(&stse_handler, zone_id, offset, data, length); stse_data_partition_read(&stse_handler, zone_id, offset, buffer, length);
-
Cryptographic Operations:
stse_generate_random(&stse_handler, random_buffer, length); stse_compute_hash(&stse_handler, algo, message, msg_len, hash, hash_len); stse_aes_cmac(&stse_handler, key_slot, message, length, mac);
When developing your STSAFE-A120 application:
- Error Handling: Always check return codes from STSE API calls
- Resource Management: Properly allocate and free buffers
- Security: Follow secure coding practices, especially for key handling
- Documentation: Document your code with Doxygen comments
- Testing: Test thoroughly with different device configurations
- Logging: Use the terminal output for debugging and status messages
The template can be extended for various applications:
- Custom Security Solutions: Implement proprietary security protocols
- Integration Testing: Develop test applications for device validation
- Proof of Concept: Quickly prototype new security features
- Educational Projects: Learn STSAFE-A120 programming with a clean starting point
- Production Applications: Build production-ready firmware from the template base
A typical project based on the template includes:
00_Project_template/
├── main.c # Application entry point
├── stse_conf.h # STSAFE library configuration
├── <IDE files> # Project files for STM32CubeIDE, Keil, IAR
Refer to other example projects in the package to see complete implementations of specific STSAFE-A120 features and use cases.
- STSAFE-A120 Secure Element
- STSAFE-A110 Secure Element
- Feature Description
- Standard Use-cases
- Product Perso Profile
- STSAFE-A120 : X-NUCLEO-ESE01A1
- STSAFE-A110 : X-NUCLEO-SAFEA1
- Software Package Architecture
- Getting Started with Software Package
-
Project examples list
- Project template
- Echo loop
- Random number generation
- NIST P-256 key pair generation
- NIST P-512 key pair generation
- BRAINPOOL P-512 Key Pair Generation
- Edwards-25519 Key Pair Generation
- Secure Data Storage Zone Access
- Secure data storage counter access
- Hash
- Device authentication
- Multi-step device authentication
- Host key provisioning
- Host key provisioning (Wrapped)
- Command Access Condition provisioning
- Secret or key wrapping
- ECDH
- Symmetric key provisioning Control Fields
- Symmetric key establishment AES-128 CMAC
- Symmetric key establishment AES-256 CCM
- Symmetric Key Management AES-128 CMAC
- Symmetric Key Management AES-256 CCM
- Wrapped Symmetric Key Provisioning - AES-128 CMAC
- Wrapped Symmetric Key Provisioning - AES-256 CCM*