The Infineon OPTIGA™ Trust X - ECDSA Simple Example is an example project that demonstrates the major ECDSA-related cryptographic functions offered by Trust X.
- Note
- The Infineon OPTIGA™ Trust X hardware security module must be acquired separately. For more information, visit Infineon.com - OPTIGA™ Trust X SLS 32AIA .
This example application demonstrates the use of some of the Trust X features. It does not demonstrate a secured system. In a productive system, it depends on the system's security requirements and the system's security architecture, among other factors, which entity and processor conducts which operations (for example, a remote server, a cloud service, or a smartphone).
The example application uses the following two Infineon libraries:
The example application shows the initialization and three Trust X function groups, using the high-level command library ( Infineon OPTIGA™ Trust X Command Library ).
-
Initialization:
- Initialize the Trust X hardware module using optiga_init() and optiga_open_application().
-
Generation of random numbers:
- Retrieve 16 bytes of cryptographic-quality random numbers from Trust X using optiga_get_random().
-
One-way authentication:
- Calculate a SHA-256 digest of a challenge, using optiga_calc_hash().
- Sign (ECDSA) the challenge digest using optiga_calc_sign().
- Read the Trust X device certificate using optiga_get_data_object().
- Verify the signature using mbed TLS and the public key contained in the device certificate.
-
Key generation and message authentication:
- Generate an elliptic curve (EC) private/public key pair and export the public key, using optiga_generate_key_pair().
- Calculate a SHA-256 digest of a message, using optiga_calc_hash().
- Sign (ECDSA) the message digest using the generated private key.
- Verify the challenge signature with the exported public key, using optiga_verify_signature().
- Verify the challenge signature with the exported public key, using mbed TLS signature verification.
The result of each step is explained and output using NRF_LOG_RAW_INFO and NRF_LOG_RAW_HEXDUMP statements.
A sample output, as it can be observed with SEGGER RTT Viewer, looks similar to the following example:
Setup
You can find the source code and the project file of the example in the following folder:
<InstallFolder>\examples\crypto\ifx_optiga_ecdsa_simple
Testing
- Note
- The application executes the described procedure once and then waits for an external reset.
Test the application by observing the debugging output via SEGGER J-Link RTT Viewer:
- Enable the nRF logging module (if not activated by default).
- Compile and program the application.
- Turn on SEGGER RTT Viewer to observe the output.
- Restart the app on the nRF52 device to observe the process again.
Alternatively, a debugger in any supported IDE can be used to step through the example application code in main.c and the host library files.