Function anj_crypto_storage_create_record

Function Documentation

int anj_crypto_storage_create_record(void *crypto_ctx, anj_crypto_security_info_t *out_info, const void *data, size_t data_size)

Experimental:

This is an experimental API. This API can change in the future versions without any notice.

Creates and stores certificate or key data in the specified security record.

This function is called to create a new security information record. The implementation should allocate and initialize a new record on the underlying storage side, and then copy it from data.

The out_info->tag and out_info->source are set by the caller to identify the type and source of the security information being stored.

Note

In case of an error, this function is responsible for performing any necessary cleanup. Anjay will not call anj_crypto_storage_delete_record for records that were not successfully created.

Parameters:
  • crypto_ctx – Cryptographic context.

  • out_info[inout] Pointer to a structure that will receive the newly created security information record.

  • data – Pointer to the data to store.

  • data_size – Size of the provided data chunk in bytes.

Returns:

0 on success, or a negative value on failure.