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.
simple-mbed-cloud-client/mbed-cloud-client/source/include/CloudClientStorage.h@0:8f0bb79ddd48, 2021-05-04 (annotated)
- Committer:
- leothedragon
- Date:
- Tue May 04 08:55:12 2021 +0000
- Revision:
- 0:8f0bb79ddd48
nmn
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
leothedragon | 0:8f0bb79ddd48 | 1 | // ---------------------------------------------------------------------------- |
leothedragon | 0:8f0bb79ddd48 | 2 | // Copyright 2016-2018 ARM Ltd. |
leothedragon | 0:8f0bb79ddd48 | 3 | // |
leothedragon | 0:8f0bb79ddd48 | 4 | // SPDX-License-Identifier: Apache-2.0 |
leothedragon | 0:8f0bb79ddd48 | 5 | // |
leothedragon | 0:8f0bb79ddd48 | 6 | // Licensed under the Apache License, Version 2.0 (the "License"); |
leothedragon | 0:8f0bb79ddd48 | 7 | // you may not use this file except in compliance with the License. |
leothedragon | 0:8f0bb79ddd48 | 8 | // You may obtain a copy of the License at |
leothedragon | 0:8f0bb79ddd48 | 9 | // |
leothedragon | 0:8f0bb79ddd48 | 10 | // http://www.apache.org/licenses/LICENSE-2.0 |
leothedragon | 0:8f0bb79ddd48 | 11 | // |
leothedragon | 0:8f0bb79ddd48 | 12 | // Unless required by applicable law or agreed to in writing, software |
leothedragon | 0:8f0bb79ddd48 | 13 | // distributed under the License is distributed on an "AS IS" BASIS, |
leothedragon | 0:8f0bb79ddd48 | 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
leothedragon | 0:8f0bb79ddd48 | 15 | // See the License for the specific language governing permissions and |
leothedragon | 0:8f0bb79ddd48 | 16 | // limitations under the License. |
leothedragon | 0:8f0bb79ddd48 | 17 | // ---------------------------------------------------------------------------- |
leothedragon | 0:8f0bb79ddd48 | 18 | |
leothedragon | 0:8f0bb79ddd48 | 19 | #ifndef CLOUD_CLIENT_STORAGE_H |
leothedragon | 0:8f0bb79ddd48 | 20 | #define CLOUD_CLIENT_STORAGE_H |
leothedragon | 0:8f0bb79ddd48 | 21 | |
leothedragon | 0:8f0bb79ddd48 | 22 | #include <stddef.h> |
leothedragon | 0:8f0bb79ddd48 | 23 | #include <stdint.h> |
leothedragon | 0:8f0bb79ddd48 | 24 | |
leothedragon | 0:8f0bb79ddd48 | 25 | #define KEY_ACCOUNT_ID "mbed.AccountID" |
leothedragon | 0:8f0bb79ddd48 | 26 | #define KEY_INTERNAL_ENDPOINT "mbed.InternalEndpoint" |
leothedragon | 0:8f0bb79ddd48 | 27 | #define KEY_DEVICE_SOFTWAREVERSION "mbed.SoftwareVersion" |
leothedragon | 0:8f0bb79ddd48 | 28 | #define KEY_FIRST_TO_CLAIM "mbed.FirstToClaim" |
leothedragon | 0:8f0bb79ddd48 | 29 | |
leothedragon | 0:8f0bb79ddd48 | 30 | #ifdef __cplusplus |
leothedragon | 0:8f0bb79ddd48 | 31 | extern "C" { |
leothedragon | 0:8f0bb79ddd48 | 32 | #endif |
leothedragon | 0:8f0bb79ddd48 | 33 | |
leothedragon | 0:8f0bb79ddd48 | 34 | typedef enum { |
leothedragon | 0:8f0bb79ddd48 | 35 | CCS_STATUS_MEMORY_ERROR = -4, |
leothedragon | 0:8f0bb79ddd48 | 36 | CCS_STATUS_VALIDATION_FAIL = -3, |
leothedragon | 0:8f0bb79ddd48 | 37 | CCS_STATUS_KEY_DOESNT_EXIST = -2, |
leothedragon | 0:8f0bb79ddd48 | 38 | CCS_STATUS_ERROR = -1, |
leothedragon | 0:8f0bb79ddd48 | 39 | CCS_STATUS_SUCCESS = 0 |
leothedragon | 0:8f0bb79ddd48 | 40 | } ccs_status_e; |
leothedragon | 0:8f0bb79ddd48 | 41 | |
leothedragon | 0:8f0bb79ddd48 | 42 | /** |
leothedragon | 0:8f0bb79ddd48 | 43 | * CCS item types |
leothedragon | 0:8f0bb79ddd48 | 44 | * Keep these sync with ones that found from kcm_defs.h |
leothedragon | 0:8f0bb79ddd48 | 45 | */ |
leothedragon | 0:8f0bb79ddd48 | 46 | typedef enum { |
leothedragon | 0:8f0bb79ddd48 | 47 | CCS_PRIVATE_KEY_ITEM, //!< KCM private key item type. KCM Supports ECC keys with curves defined in palGroupIndex_t(pal_Crypto.h) |
leothedragon | 0:8f0bb79ddd48 | 48 | CCS_PUBLIC_KEY_ITEM, //!< KCM public key item type. KCM Supports ECC keys with curves defined in palGroupIndex_t(pal_Crypto.h) |
leothedragon | 0:8f0bb79ddd48 | 49 | CCS_SYMMETRIC_KEY_ITEM, //!< KCM symmetric key item type. |
leothedragon | 0:8f0bb79ddd48 | 50 | CCS_CERTIFICATE_ITEM, //!< KCM certificate item type. Supported x509 certificates in der format. |
leothedragon | 0:8f0bb79ddd48 | 51 | CCS_CONFIG_ITEM //!< KCM configuration parameter item type. |
leothedragon | 0:8f0bb79ddd48 | 52 | } ccs_item_type_e; |
leothedragon | 0:8f0bb79ddd48 | 53 | |
leothedragon | 0:8f0bb79ddd48 | 54 | /** |
leothedragon | 0:8f0bb79ddd48 | 55 | * \brief Uninitializes the CFStore handle. |
leothedragon | 0:8f0bb79ddd48 | 56 | */ |
leothedragon | 0:8f0bb79ddd48 | 57 | ccs_status_e uninitialize_storage(void); |
leothedragon | 0:8f0bb79ddd48 | 58 | |
leothedragon | 0:8f0bb79ddd48 | 59 | /** |
leothedragon | 0:8f0bb79ddd48 | 60 | * \brief Initializes the CFStore handle. |
leothedragon | 0:8f0bb79ddd48 | 61 | */ |
leothedragon | 0:8f0bb79ddd48 | 62 | ccs_status_e initialize_storage(void); |
leothedragon | 0:8f0bb79ddd48 | 63 | |
leothedragon | 0:8f0bb79ddd48 | 64 | /* Bootstrap credential handling methods */ |
leothedragon | 0:8f0bb79ddd48 | 65 | ccs_status_e ccs_get_string_item(const char* key, uint8_t *buffer, const size_t buffer_size, ccs_item_type_e item_type); |
leothedragon | 0:8f0bb79ddd48 | 66 | ccs_status_e ccs_check_item(const char* key, ccs_item_type_e item_type); |
leothedragon | 0:8f0bb79ddd48 | 67 | ccs_status_e ccs_delete_item(const char* key, ccs_item_type_e item_type); |
leothedragon | 0:8f0bb79ddd48 | 68 | ccs_status_e ccs_get_item(const char* key, uint8_t *buffer, const size_t buffer_size, size_t *value_length, ccs_item_type_e item_type); |
leothedragon | 0:8f0bb79ddd48 | 69 | ccs_status_e ccs_set_item(const char* key, const uint8_t *buffer, const size_t buffer_size, ccs_item_type_e item_type); |
leothedragon | 0:8f0bb79ddd48 | 70 | ccs_status_e ccs_item_size(const char* key, size_t* size_out, ccs_item_type_e item_type); |
leothedragon | 0:8f0bb79ddd48 | 71 | |
leothedragon | 0:8f0bb79ddd48 | 72 | /* Certificate chain handling methods */ |
leothedragon | 0:8f0bb79ddd48 | 73 | void *ccs_create_certificate_chain(const char *chain_file_name, size_t chain_len); |
leothedragon | 0:8f0bb79ddd48 | 74 | void *ccs_open_certificate_chain(const char *chain_file_name, size_t *chain_size); |
leothedragon | 0:8f0bb79ddd48 | 75 | ccs_status_e ccs_close_certificate_chain(void *chain_handle); |
leothedragon | 0:8f0bb79ddd48 | 76 | ccs_status_e ccs_add_next_cert_chain(void *chain_handle, const uint8_t *cert_data, size_t data_size); |
leothedragon | 0:8f0bb79ddd48 | 77 | ccs_status_e ccs_get_next_cert_chain(void *chain_handle, void *cert_data, size_t *data_size); |
leothedragon | 0:8f0bb79ddd48 | 78 | ccs_status_e ccs_parse_cert_chain_and_store(const uint8_t *cert_chain_name, |
leothedragon | 0:8f0bb79ddd48 | 79 | const size_t cert_chain_name_len, |
leothedragon | 0:8f0bb79ddd48 | 80 | const uint8_t *cert_chain_data, |
leothedragon | 0:8f0bb79ddd48 | 81 | const uint16_t cert_chain_data_len); |
leothedragon | 0:8f0bb79ddd48 | 82 | #ifdef __cplusplus |
leothedragon | 0:8f0bb79ddd48 | 83 | } |
leothedragon | 0:8f0bb79ddd48 | 84 | #endif |
leothedragon | 0:8f0bb79ddd48 | 85 | #endif // CLOUD_CLIENT_STORAGE_H |