SharkSSL C/C++ Reference
TLS, cryptography, certificates, and PSA integration
SharkSslPSAKeyStorage Struct Reference

#include <SharkSslPSAStorage.h>

Data Fields

void * context
 
psa_status_t(* read )(void *context, psa_key_attributes_t *attributes, uint8_t *material, size_t *length, psa_key_id_t id, size_t capacity)
 
psa_status_t(* create )(void *context, const psa_key_attributes_t *attributes, const uint8_t *material, size_t length)
 
psa_status_t(* remove )(void *context, psa_key_id_t id)
 

Detailed Description

Platform storage for local persistent keys.

Callbacks run under the provider key-store lock and must not call PSA or this registration function. The context must remain alive until the backend is unregistered. The provider copies the callback table; registration requires an empty RAM key store. Register at startup or at a quiescent point with no cryptographic operations in progress. A backend must not be switched while its IDs remain in use.

read with material == NULL and capacity == 0 queries attributes and length. A second read returns the same complete record or an error. Missing records return PSA_ERROR_DOES_NOT_EXIST. create must atomically create a new record, never replace an existing ID, and return PSA_ERROR_ALREADY_EXISTS on collision. Successful create means attributes and material are durable; a recoverable create failure leaves no new record. remove must erase a record and return DOES_NOT_EXIST if absent; recoverable failure preserves it for a retry. If storage fails during rollback, its durable outcome can be uncertain. Report STORAGE_FAILURE and refuse further callbacks until storage has been repaired and the affected ID reconciled. The provider returns no new handle for failed creation; it cannot recover or prove durability for failed media.

The backend owns serialization, format versioning, integrity, confidentiality, access isolation, power-loss atomicity and secure deletion. Raw C attributes are not a portable disk format. No filesystem or flash backend is installed by default. Only PSA_KEY_LIFETIME_PERSISTENT in local storage is supported.

Field Documentation

◆ context

void* SharkSslPSAKeyStorage::context

◆ create

psa_status_t(* SharkSslPSAKeyStorage::create) (void *context, const psa_key_attributes_t *attributes, const uint8_t *material, size_t length)

◆ read

psa_status_t(* SharkSslPSAKeyStorage::read) (void *context, psa_key_attributes_t *attributes, uint8_t *material, size_t *length, psa_key_id_t id, size_t capacity)

◆ remove

psa_status_t(* SharkSslPSAKeyStorage::remove) (void *context, psa_key_id_t id)