Virgil IoT KIT
|
Security Box implementation. More...
#include <stdint.h>
#include <virgil/iot/storage_hal/storage_hal.h>
#include <virgil/iot/status_code/status_code.h>
#include <virgil/iot/secmodule/secmodule.h>
Go to the source code of this file.
Enumerations | |
enum | vs_secbox_type_t { VS_SECBOX_SIGNED, VS_SECBOX_SIGNED_AND_ENCRYPTED } |
Security box operation type. More... | |
Functions | |
vs_status_e | vs_secbox_init (vs_storage_op_ctx_t *ctx, vs_secmodule_impl_t *secmodule) |
Initialize Security Box. More... | |
vs_status_e | vs_secbox_deinit (void) |
Destroy Security Box. More... | |
ssize_t | vs_secbox_file_size (vs_storage_element_id_t id) |
Security Box element size. More... | |
vs_status_e | vs_secbox_save (vs_secbox_type_t type, vs_storage_element_id_t id, const uint8_t *data, size_t data_sz) |
Save Security Box element. More... | |
vs_status_e | vs_secbox_load (vs_storage_element_id_t id, uint8_t *data, size_t data_sz) |
Load Security Box element. More... | |
vs_status_e | vs_secbox_del (vs_storage_element_id_t id) |
Delete Security Box element. More... | |
Security Box implementation.
Security Box provides the ability to save/load/delete data on external storage with security options. Data can be save with signature without encryption. Or it can be saved with signature and encryption.
enum vs_secbox_type_t |
vs_status_e vs_secbox_deinit | ( | void | ) |
Destroy Security Box.
Destroys Security Box. This function must be called after all operations with Security Box.
vs_status_e vs_secbox_del | ( | vs_storage_element_id_t | id | ) |
Delete Security Box element.
Deletes file on the disk.
[in] | id | Element ID |
ssize_t vs_secbox_file_size | ( | vs_storage_element_id_t | id | ) |
Security Box element size.
Get saved data size without signatures and encryption.
[in] | id | Element ID |
vs_status_e vs_secbox_init | ( | vs_storage_op_ctx_t * | ctx, |
vs_secmodule_impl_t * | secmodule | ||
) |
Initialize Security Box.
Initializes Security Box. This function must be called before any operations with Security Box.
[in] | ctx | Storage context. Must not be NULL. |
[in] | secmodule | Security Module implementation. Must not be NULL. |
vs_status_e vs_secbox_load | ( | vs_storage_element_id_t | id, |
uint8_t * | data, | ||
size_t | data_sz | ||
) |
Load Security Box element.
Loads data.
[in] | id | Element ID |
[out] | data | Data buffer. Must not be NULL. |
[in] | data_sz | Data size. Must not be zero. |
vs_status_e vs_secbox_save | ( | vs_secbox_type_t | type, |
vs_storage_element_id_t | id, | ||
const uint8_t * | data, | ||
size_t | data_sz | ||
) |
Save Security Box element.
Saves data with specified crypto mode.
[in] | type | Security operation type. |
[in] | id | Element ID |
[in] | data | Data buffer. Must not be NULL. |
[in] | data_sz | Data size. Must not be zero. |