Skip to content

4. ECC Key Generation and EdDSA Signing Example Tutorial

This example demonstrates ECC key generation and EdDSA signing on the TROPIC01. In this example, you will learn about the following functions:

  • lt_init(): function used to initialize context for communication with the TROPIC01,
  • lt_verify_chip_and_start_secure_session(): helper function to start Secure Session and allow L3 communication,
  • lt_ecc_key_erase(): L3 command to erase an ECC key slot,
  • lt_ecc_key_generate(): L3 command to generate an ECC key pair on the chip,
  • lt_ecc_key_read(): L3 command to read the public key from an ECC key slot,
  • lt_ecc_eddsa_sign(): L3 command to sign a message using EdDSA,
  • lt_session_abort(): L3 command to abort Secure Session,
  • lt_deinit(): function used to deinitialize context.

This example erases ECC slot 0

This example erases any existing key in ECC slot 0 at the beginning and at the end of execution. If you have a key stored in slot 0 that you need, back it up or use a different slot before running this example.

Build and Run

Building and running the example

Go to the example's project directory:

cd examples/linux/usb_devkit/ecc_eddsa/

Create a build/ directory and switch to it:

mkdir build/
cd build/

And finally, build and run the example:

cmake ..
make
./libtropic_ecc_eddsa

TBA

TBA

After this, you should see an output in your terminal.

Configuration

In addition to the Libtropic CMake options used to configure Libtropic, this example provides the following CMake options:

  • LT_USB_DEVKIT_PATH (default: "/dev/ttyACM0") sets the path to the USB device representing the USB DevKit serial port:

    Configuring USB DevKit serial port
    cmake -DLT_USB_DEVKIT_PATH=<serial_port_path> ..
    make
    ./libtropic_ecc_eddsa
    

    TBA

    TBA

  • LT_SH0_KEYS (default: "prod0") selects which pairing keys in slot 0 are used. Switch to engineering-sample pairing keys if your TROPIC01 is provisioned with them:

    Switching to engineering sample pairing keys
    cmake -DLT_SH0_KEYS="eng_sample" ..
    make
    ./libtropic_ecc_eddsa
    

    TBA

    TBA

    Additionally, see Default Pairing Keys for a Secure Channel Handshake for more information.

Next example