Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
SecureStore Class Reference
#include <SecureStore.h>
Inherits mbed::KVStore.
Public Types | |
typedef struct mbed::KVStore::info | info_t |
Holds key information. | |
Public Member Functions | |
SecureStore (KVStore *underlying_kv, KVStore *rbp_kv=0) | |
Class constructor. | |
virtual | ~SecureStore () |
Class destructor. | |
virtual int | init () |
Initialize SecureStore class. | |
virtual int | deinit () |
Deinitialize SecureStore class, free handles and memory allocations. | |
virtual int | reset () |
Reset KVStore contents (clear all keys) Warning: This function is not thread safe. | |
virtual int | set (const char *key, const void *buffer, size_t size, uint32_t create_flags) |
Set one KVStore item, given key and value. | |
virtual int | get (const char *key, void *buffer, size_t buffer_size, size_t *actual_size=NULL, size_t offset=0) |
Get one KVStore item, given key. | |
virtual int | get_info (const char *key, info_t *info) |
Get information of a given key. | |
virtual int | remove (const char *key) |
Remove a KVStore item, given key. | |
virtual int | set_start (set_handle_t *handle, const char *key, size_t final_data_size, uint32_t create_flags) |
Start an incremental KVStore set sequence. | |
virtual int | set_add_data (set_handle_t handle, const void *value_data, size_t data_size) |
Add data to incremental KVStore set sequence. | |
virtual int | set_finalize (set_handle_t handle) |
Finalize an incremental KVStore set sequence. | |
virtual int | iterator_open (iterator_t *it, const char *prefix=NULL) |
Start an iteration over KVStore keys. | |
virtual int | iterator_next (iterator_t it, char *key, size_t key_size) |
Get next key in iteration. | |
virtual int | iterator_close (iterator_t it) |
Close iteration. | |
bool | is_valid_key (const char *key) const |
Convenience function for checking key validity. |
Detailed Description
TDBStore class.
Lightweight Key Value storage over a block device
Definition at line 53 of file SecureStore.h.
Member Typedef Documentation
typedef struct mbed::KVStore::info info_t [inherited] |
Holds key information.
Constructor & Destructor Documentation
SecureStore | ( | KVStore * | underlying_kv, |
KVStore * | rbp_kv = 0 |
||
) |
Class constructor.
- Parameters:
-
[in] underlying_kv KVStore that will hold the data. [in] rbp_kv Additional KVStore used for rollback protection.
- Returns:
- none
Definition at line 168 of file SecureStore.cpp.
~SecureStore | ( | ) | [virtual] |
Member Function Documentation
int deinit | ( | ) | [virtual] |
Deinitialize SecureStore class, free handles and memory allocations.
- Returns:
- MBED_SUCCESS Success. or any other error from underlying KVStore instances.
Implements KVStore.
Definition at line 783 of file SecureStore.cpp.
int get | ( | const char * | key, |
void * | buffer, | ||
size_t | buffer_size, | ||
size_t * | actual_size = NULL , |
||
size_t | offset = 0 |
||
) | [virtual] |
Get one KVStore item, given key.
- Parameters:
-
[in] key Key - must not include '*' '/' '?' ':' ';' '\' '"' '|' ' ' '<' '>' '\'. [in] buffer Value data buffer. [in] buffer_size Value data buffer size. [out] actual_size Actual read size. [in] offset Offset to read from in data.
- Returns:
- MBED_SUCCESS Success. MBED_ERROR_NOT_READY Not initialized. MBED_ERROR_READ_FAILED Unable to read from media. MBED_ERROR_INVALID_ARGUMENT Invalid argument given in function arguments. MBED_ERROR_INVALID_SIZE Invalid size given in function arguments. MBED_ERROR_FAILED_OPERATION Internal error. MBED_ERROR_ITEM_NOT_FOUND No such key. MBED_ERROR_AUTHENTICATION_FAILED Data authentication failed. MBED_ERROR_AUTHENTICATION_RBP_FAILED Rollback protection data authentication failed. or any other error from underlying KVStore instances.
Implements KVStore.
Definition at line 721 of file SecureStore.cpp.
int get_info | ( | const char * | key, |
info_t * | info | ||
) | [virtual] |
Get information of a given key.
- Parameters:
-
[in] key Key - must not include '*' '/' '?' ':' ';' '\' '"' '|' ' ' '<' '>' '\'. [out] info Returned information structure containing size and flags.
- Returns:
- MBED_SUCCESS Success. MBED_ERROR_NOT_READY Not initialized. MBED_ERROR_READ_FAILED Unable to read from media. MBED_ERROR_INVALID_ARGUMENT Invalid argument given in function arguments. MBED_ERROR_FAILED_OPERATION Internal error. MBED_ERROR_ITEM_NOT_FOUND No such key. MBED_ERROR_AUTHENTICATION_FAILED Data authentication failed. MBED_ERROR_AUTHENTICATION_RBP_FAILED Rollback protection data authentication failed. or any other error from underlying KVStore instances.
Implements KVStore.
Definition at line 731 of file SecureStore.cpp.
int init | ( | ) | [virtual] |
Initialize SecureStore class.
It will also initialize the underlying KVStore and the rollback protection KVStore.
- Returns:
- MBED_SUCCESS Success. or any other error from underlying KVStore instances.
Implements KVStore.
Definition at line 741 of file SecureStore.cpp.
bool is_valid_key | ( | const char * | key ) | const [inherited] |
int iterator_close | ( | iterator_t | it ) | [virtual] |
Close iteration.
- Returns:
- MBED_SUCCESS Success. MBED_ERROR_NOT_READY Not initialized. MBED_ERROR_INVALID_ARGUMENT Invalid argument given in function arguments. or any other error from underlying KVStore instances.
- 0 on success or a negative error code on failure
Implements KVStore.
Definition at line 876 of file SecureStore.cpp.
int iterator_next | ( | iterator_t | it, |
char * | key, | ||
size_t | key_size | ||
) | [virtual] |
Get next key in iteration.
There are no issue with any other operation while iterator is open.
- Parameters:
-
[in] it Iterator handle. [in] key Buffer for returned key. [in] key_size Key buffer size.
- Returns:
- MBED_SUCCESS Success. MBED_ERROR_NOT_READY Not initialized. MBED_ERROR_INVALID_ARGUMENT Invalid argument given in function arguments. or any other error from underlying KVStore instances.
Implements KVStore.
Definition at line 863 of file SecureStore.cpp.
int iterator_open | ( | iterator_t * | it, |
const char * | prefix = NULL |
||
) | [virtual] |
Start an iteration over KVStore keys.
There are no issue with any other operation while iterator is open.
- Parameters:
-
[out] it Returned iterator handle. [in] prefix Key prefix (null for all keys).
- Returns:
- MBED_SUCCESS Success. MBED_ERROR_NOT_READY Not initialized. MBED_ERROR_INVALID_ARGUMENT Invalid argument given in function arguments. or any other error from underlying KVStore instances.
Implements KVStore.
Definition at line 845 of file SecureStore.cpp.
int remove | ( | const char * | key ) | [virtual] |
Remove a KVStore item, given key.
- Parameters:
-
[in] key Key - must not include '*' '/' '?' ':' ';' '\' '"' '|' ' ' '<' '>' '\'.
- Returns:
- MBED_SUCCESS Success. MBED_ERROR_NOT_READY Not initialized. MBED_ERROR_READ_FAILED Unable to read from media. MBED_ERROR_INVALID_ARGUMENT Invalid argument given in function arguments. MBED_ERROR_WRITE_PROTECTED Already stored with "write once" flag. MBED_ERROR_FAILED_OPERATION Internal error. or any other error from underlying KVStore instances.
Implements KVStore.
Definition at line 478 of file SecureStore.cpp.
int reset | ( | void | ) | [virtual] |
Reset KVStore contents (clear all keys) Warning: This function is not thread safe.
- Returns:
- MBED_SUCCESS Success. MBED_ERROR_NOT_READY Not initialized. or any other error from underlying KVStore instances.
Implements KVStore.
Definition at line 819 of file SecureStore.cpp.
int set | ( | const char * | key, |
const void * | buffer, | ||
size_t | size, | ||
uint32_t | create_flags | ||
) | [virtual] |
Set one KVStore item, given key and value.
- Parameters:
-
[in] key Key - must not include '*' '/' '?' ':' ';' '\' '"' '|' ' ' '<' '>' '\'. [in] buffer Value data buffer. [in] size Value data size. [in] create_flags Flag mask - WRITE_ONCE_FLAG|REQUIRE_CONFIDENTIALITY_FLAG| REQUIRE_INTEGRITY_FLAG|REQUIRE_REPLAY_PROTECTION_FLAG
- Returns:
- MBED_SUCCESS Success. MBED_ERROR_NOT_READY Not initialized. MBED_ERROR_READ_FAILED Unable to read from media. MBED_ERROR_INVALID_ARGUMENT Invalid argument given in function arguments. MBED_ERROR_INVALID_SIZE Invalid size given in function arguments. MBED_ERROR_WRITE_PROTECTED Already stored with "write once" flag. MBED_ERROR_FAILED_OPERATION Internal error. or any other error from underlying KVStore instances.
Implements KVStore.
Definition at line 454 of file SecureStore.cpp.
int set_add_data | ( | set_handle_t | handle, |
const void * | value_data, | ||
size_t | data_size | ||
) | [virtual] |
Add data to incremental KVStore set sequence.
This operation is blocking other operations. Any get/set/remove operation will be blocked until set_finalize is called.
- Parameters:
-
[in] handle Incremental set handle. [in] value_data value data to add. [in] data_size value data size.
- Returns:
- MBED_SUCCESS Success. MBED_ERROR_NOT_READY Not initialized. MBED_ERROR_INVALID_ARGUMENT Invalid argument given in function arguments. MBED_ERROR_INVALID_SIZE Invalid size given in function arguments. MBED_ERROR_FAILED_OPERATION Internal error. or any other error from underlying KVStore instances.
Implements KVStore.
Definition at line 317 of file SecureStore.cpp.
int set_finalize | ( | set_handle_t | handle ) | [virtual] |
Finalize an incremental KVStore set sequence.
- Parameters:
-
[in] handle Incremental set handle.
- Returns:
- MBED_SUCCESS Success. MBED_ERROR_NOT_READY Not initialized. MBED_ERROR_INVALID_ARGUMENT Invalid argument given in function arguments. MBED_ERROR_INVALID_SIZE Invalid size given in function arguments. MBED_ERROR_FAILED_OPERATION Internal error. or any other error from underlying KVStore instances.
Implements KVStore.
Definition at line 395 of file SecureStore.cpp.
int set_start | ( | set_handle_t * | handle, |
const char * | key, | ||
size_t | final_data_size, | ||
uint32_t | create_flags | ||
) | [virtual] |
Start an incremental KVStore set sequence.
This operation is blocking other operations. Any get/set/remove/iterator operation will be blocked until set_finalize is called.
- Parameters:
-
[out] handle Returned incremental set handle. [in] key Key - must not include '*' '/' '?' ':' ';' '\' '"' '|' ' ' '<' '>' '\'. [in] final_data_size Final value data size. [in] create_flags Flag mask - WRITE_ONCE_FLAG|REQUIRE_CONFIDENTIALITY_FLAG| REQUIRE_INTEGRITY_FLAG|REQUIRE_REPLAY_PROTECTION_FLAG
- Returns:
- MBED_SUCCESS Success. MBED_ERROR_NOT_READY Not initialized. MBED_ERROR_READ_FAILED Unable to read from media. MBED_ERROR_INVALID_ARGUMENT Invalid argument given in function arguments. MBED_ERROR_INVALID_SIZE Invalid size given in function arguments. MBED_ERROR_WRITE_PROTECTED Already stored with "write once" flag. MBED_ERROR_FAILED_OPERATION Internal error. or any other error from underlying KVStore instances.
Implements KVStore.
Definition at line 180 of file SecureStore.cpp.
Generated on Tue Jul 12 2022 13:55:43 by
