Go to the source code of this file.
See Choose a SharkSSL API for build scope and the owning API layer.
◆ SHARKSSL_PSA_FILE_STORAGE_INIT
◆ SHARKSSL_PSA_FILE_WRAPPING_KEY_SIZE
| #define SHARKSSL_PSA_FILE_WRAPPING_KEY_SIZE 32 |
◆ SharkSslPSAFileStorage
Optional encrypted filesystem adapter for Windows and Linux hosts.
Initialize with SHARKSSL_PSA_FILE_STORAGE_INIT. The object and its callback table must remain alive while registered. Do not copy an open object. open does not register the table.
◆ SharkSslPSAFileStorage_close()
Unregister the callback table and quiesce all operations before close.
Destroy volatile keys and purge persistent caches before unregistering. close releases the OS lock and clears the wrapping key. It does not remove stored keys, automatically unregister callbacks, or provide physical erasure.
- Parameters
-
| o | SharkSslPSAFileStorage *; object to close, or NULL. Unregister and quiesce its callbacks first; a successful open must have matching cleanup. |
◆ SharkSslPSAFileStorage_open()
Open or create a private directory, locking it exclusively until close.
directory is UTF-8 on Windows. wrapping_key must contain 32 independently provisioned bytes; retain the same key outside this directory across restarts. The adapter copies and clears its own key on close; it never persists it. Existing directories must belong to the current user and exclude other users. Windows requires a protected owner-only DACL; Linux requires mode 0700. Parent directories must be trusted. Local filesystems are required. AES-256-GCM is required; unsupported targets/configurations return NOT_SUPPORTED. Files are encrypted and authenticated; rollback of an old valid record and physical secure erasure of filesystem copies are outside this adapter. Nonces come from BCryptGenRandom/getrandom. Use a dedicated wrapping key and manage its lifetime externally, including the random-IV GCM invocation limit. Inherited contexts are rejected after fork; reopen in a quiescent process. If rollback I/O fails, the instance refuses further storage callbacks. Repair storage and reconcile the affected ID before resuming after reopen.
- Parameters
-
| o | SharkSslPSAFileStorage *; required caller-owned object initialized with SHARKSSL_PSA_FILE_STORAGE_INIT, with no open state. |
| directory | const char *; required NUL-terminated trusted local directory path. UTF-8 on Windows; an absolute path on Linux. Borrowed for this call. |
| wrapping_key | const uint8_t[32]; required separately provisioned AES wrapping key, copied into the adapter. Keep the same key available externally across restarts. |
- Returns
- psa_status_t: PSA_SUCCESS; otherwise an error such as INVALID_ARGUMENT, BAD_STATE, INSUFFICIENT_MEMORY, NOT_PERMITTED, STORAGE_FAILURE, or NOT_SUPPORTED. No callback table is registered by this function.