nRF Connect SDK API 3.4.99
Loading...
Searching...
No Matches

◆ nrf_cloud_credentials_key_generate()

int nrf_cloud_credentials_key_generate ( uint32_t sec_tag)

#include <include/net/nrf_cloud_credentials_keygen.h>

Generate the device private key on-device for the given sec tag.

Creates a persistent, non-exportable ECC P-256 key pair in PSA secure key storage and registers it with the TLS credentials module as an opaque key (TLS_CREDENTIAL_PRIVATE_KEY_PSA). The private key never leaves the device.

Parameters
sec_tagThe security tag the key is associated with.
Return values
0If successful.
-EALREADYIf a key already exists for the sec tag. Delete it first.
-ENOTSUPIf a key is already registered for a different sec tag. Only one on-device key sec tag is supported at a time.
Returns
A negative value indicates an error.