The STSAFE-A Software Development Kit offers developers a collection of application examples demonstrating the use of the STSAFE-A secure element from STMicroelectronics. This SDK serves as software reference implementations for integrating STSELib and STSAFE-A on host microcontroller platforms.
+------------------------+---------------------------------------------------------------------+
| | |
| | +-------------------------------------------------------------+ |
| APPLICATION | | Example Projects / Tools | |
| | +-------------------------------------------------------------+ |
| | |
|========================|=====================================================================|
| | +-------------------------------------------------------------+ |
| | | | | |
| | | | | |
| MIDDLEWARE | | STSELib | STM32Cryptolib | |
| | | | (CMOX) | |
| | | | | |
| | +-------------------------------------------------------------+ |
| | |
|========================|=====================================================================|
| | |
| | +-------------------------------------------------------------+ |
| PLATFORM | | NUCLEO-L452RE | |
| | +-------------------------------------------------------------+ |
| | |
+------------------------+---------------------------------------------------------------------+
The following hardware (HW) and software (SW) prerequisites are required to work with this package:
-
Hardware prerequisites
- NUCLEO-L452RE STM32 development board
- X-NUCLEO-ESE01A1 Nucleo expansion board
-
Software prerequisites
The steps below use STM32CubeIDE and the 01_Echo_loop example to check communication with the STSAFE-A120 before running other examples.
- With power disconnected, plug the X-NUCLEO-ESE01A1 expansion board onto the NUCLEO-L452RE Arduino connectors. Check the connector alignment and ensure the boards are fully seated.
- Connect the NUCLEO-L452RE to your PC through its ST-LINK USB connector using a data-capable USB cable. This connection powers the board and provides programming, debugging, and a virtual COM port.
- Check that your PC detects the ST-LINK interface and the virtual COM port. On Windows, the COM port appears under Ports (COM & LPT) in Device Manager. If the interfaces are not detected, check the cable and install the ST-LINK USB driver.
The SDK uses Git submodules for Middleware/STSELib, stse-host-platform, and stse-crypto-platform. Clone the repository with its dependencies:
git clone --recurse-submodules https://github.com/STMicroelectronics/stsafe-a-sdk.git
cd stsafe-a-sdkIf you already cloned the repository without submodules, run the following from the repository root:
git submodule update --init --recursiveUse Git rather than GitHub's Download ZIP option, which does not include the submodule contents.
CMOX is distributed separately and is not included in this repository. Install it before building a project:
- Download X-CUBE-CRYPTOLIB v4.5.0 from STMicroelectronics and extract the archive.
- Locate
STM32CubeExpansion_Crypto_V4.5.0/Middlewares/ST/STM32_Cryptographic/in the extracted package. - Copy the contents of that directory into
Middleware/STM32_Cryptographic/in this repository. Do not create an extra nestedSTM32_Cryptographicdirectory.
The destination should contain:
Middleware/STM32_Cryptographic/
|-- ReadMe.md # SDK installation instructions (already present)
|-- CMOX.chm
|-- LICENSE.txt
|-- ReadMe.txt
|-- Release_Notes.html
|-- _htmresc/
|-- include/
|-- interface/
| `-- cmox_low_level_template.c
|-- legacy_v3/
`-- lib/
- Open
Middleware/STM32_Cryptographic/interface/cmox_low_level_template.cand comment out these two lines incmox_ll_init():
// __HAL_RCC_CRC_RELEASE_RESET();
// __HAL_RCC_CRC_CLK_ENABLE();CRC clock management is already handled by the project's system.c. See the local CMOX installation instructions for the complete function example.
- Launch STM32CubeIDE and select or create a workspace.
- Select File > Import > General > Existing Projects into Workspace.
- Set the root directory to
Applications/Projects/01_Echo_loop/STM32CubeIDE/inside your clone and select the detected project. Leave Copy projects into workspace unchecked so the project's relative paths to shared SDK files remain valid, then select Finish. - Right-click the imported project in Project Explorer and select Build Project. Check the Console view for a successful build.
- With the board connected, select Run > Debug to program it and start a debug session. If prompted, select the project's STM32 debug configuration.
- Open the serial terminal as described below before resuming execution. If the debugger stops at
main(), select Resume (F8) to run the example.
If the build reports missing STSELib or platform files, repeat the submodule initialization in step 2. For missing CMOX headers or libraries, check the destination directory in step 3.
The project template also includes EWARM and MDK-ARM project folders for IAR and Keil users; the walkthrough above uses STM32CubeIDE.
Open your serial terminal on the ST-LINK virtual COM port with these settings:
| Setting | Value |
|---|---|
| Baud rate | 115200 |
| Data bits | 8 |
| Parity | None |
| Stop bits | 1 |
| Flow control | None |
The echo example starts immediately and repeatedly prints a generated message and the message returned by the STSAFE-A120. It does not require a key press. Other examples may display a prompt; press a key only when requested.
If no output appears, check the COM port and serial settings, ensure execution has resumed in the debugger, and reset the board to see the startup output. If initialization or echo errors appear, check the expansion board connection before proceeding to provisioning examples.
Start with group 01, which does not require running a provisioning example first:
| Example | Purpose |
|---|---|
| 01_Echo_loop | Check communication by sending and verifying echoed messages |
| 01_Device_authentication | Authenticate the device |
| 01_Device_authentication_multi_steps | Follow the individual device authentication steps |
| 01_Random_number | Generate random data with the secure element |
| 01_Hash | Compute a hash |
The numeric prefix indicates dependencies between example groups:
| Group | Prerequisite groups |
|---|---|
00 |
None (project template) |
01 |
None |
02 |
None (configuration examples) |
03 |
02 |
04 |
None (configuration examples) |
05 |
02 and 04 |
Configuration and provisioning examples change device settings or keys. Read the selected example's source and any accompanying README before running it, and follow the project dependency guide rather than running all examples indiscriminately.
stsafe-a-sdk/
|-- Applications/
| |-- Apps_utils/ # Shared application utilities
| `-- Projects/ # Example projects and IDE configurations
|-- Middleware/
| |-- STM32_Cryptographic/ # CMOX library (install separately)
| `-- STSELib/ # Secure element library (Git submodule)
|-- stse-crypto-platform/ # Cryptographic adaptation layer (Git submodule)
`-- stse-host-platform/ # Host hardware adaptation layer (Git submodule)
A dedicated wiki page is available on GitHub.
This wiki can be used as an entry point for embedded system developers. It covers the application hardware and software description, and provides developers with product information and standard STSAFE-A use cases.