Skip to main content

v2n-secure-element-sign

Init the OPTIGA Trust M on V2N's BRD_I2C, read its product info as a sanity check, and issue an ECDSA-P256 sign APDU against a fixed SHA-256 message digest.

Source: examples/v2n/v2n-secure-element-sign/.

What it shows

  1. Opening BRD_I2C at 400 kHz and initialising optiga_trust_m_t. optiga_trust_m_init performs the data-link-layer OPEN_APPLICATION handshake.
  2. optiga_trust_m_read_product_info confirms APDU-level liveness and prints the firmware identifier / build number.
  3. A hand-rolled CalcSign (0x31) APDU per Infineon's Solution Reference Manual table 16:
    Cmd=0x31 | Param=0x11(ECDSA-SHA256) | InLen(BE16)
    Tag=0x01 Len(BE16)=32 digest[32]
    Tag=0x03 Len(BE16)=2 OID[2]=0xE0 0xF0
  4. optiga_trust_m_send_apdu clocks the APDU out, waits up to 1 s for the reply, and prints the first 16 bytes of the ECDSA signature.

board.yaml

schema_version: 2

som:
sku: E1M-V2N101

carrier:
name: E1M-X-EVK

cores:
m33_sm:
os: zephyr
app: ./src
peripherals: [i2c]

chips:
- optiga_trust_m

diagnostics:
log_level: info

Expected output (provisioned chip)

[se] product info: chip_type=8C8FCA0F00B2 fw_id=2624 build=0E16
[se] CalcSign reply: stacode=0x00 outlen=70 total=74
[se] signature[0..15]: 304402206A...

Expected output (factory-fresh / unprovisioned chip)

[se] CalcSign reply: stacode=0x01  outlen=2  total=6
[se] chip reported error; check production provisioning for key slot 0xE0F0

See also

Questions about this page? Discuss in Community Forum