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.
Dependencies: FXAS21002 FXOS8700Q
CloudClientStorage.h
00001 // ---------------------------------------------------------------------------- 00002 // Copyright 2016-2018 ARM Ltd. 00003 // 00004 // SPDX-License-Identifier: Apache-2.0 00005 // 00006 // Licensed under the Apache License, Version 2.0 (the "License"); 00007 // you may not use this file except in compliance with the License. 00008 // You may obtain a copy of the License at 00009 // 00010 // http://www.apache.org/licenses/LICENSE-2.0 00011 // 00012 // Unless required by applicable law or agreed to in writing, software 00013 // distributed under the License is distributed on an "AS IS" BASIS, 00014 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 // See the License for the specific language governing permissions and 00016 // limitations under the License. 00017 // ---------------------------------------------------------------------------- 00018 00019 #ifndef CLOUD_CLIENT_STORAGE_H 00020 #define CLOUD_CLIENT_STORAGE_H 00021 00022 #include <stddef.h> 00023 #include <stdint.h> 00024 00025 #define KEY_ACCOUNT_ID "mbed.AccountID" 00026 #define KEY_INTERNAL_ENDPOINT "mbed.InternalEndpoint" 00027 #define KEY_DEVICE_SOFTWAREVERSION "mbed.SoftwareVersion" 00028 #define KEY_FIRST_TO_CLAIM "mbed.FirstToClaim" 00029 00030 #ifdef __cplusplus 00031 extern "C" { 00032 #endif 00033 00034 typedef enum { 00035 CCS_STATUS_MEMORY_ERROR = -4, 00036 CCS_STATUS_VALIDATION_FAIL = -3, 00037 CCS_STATUS_KEY_DOESNT_EXIST = -2, 00038 CCS_STATUS_ERROR = -1, 00039 CCS_STATUS_SUCCESS = 0 00040 } ccs_status_e; 00041 00042 /** 00043 * CCS item types 00044 * Keep these sync with ones that found from kcm_defs.h 00045 */ 00046 typedef enum { 00047 CCS_PRIVATE_KEY_ITEM, //!< KCM private key item type. KCM Supports ECC keys with curves defined in palGroupIndex_t(pal_Crypto.h) 00048 CCS_PUBLIC_KEY_ITEM, //!< KCM public key item type. KCM Supports ECC keys with curves defined in palGroupIndex_t(pal_Crypto.h) 00049 CCS_SYMMETRIC_KEY_ITEM, //!< KCM symmetric key item type. 00050 CCS_CERTIFICATE_ITEM, //!< KCM certificate item type. Supported x509 certificates in der format. 00051 CCS_CONFIG_ITEM //!< KCM configuration parameter item type. 00052 } ccs_item_type_e; 00053 00054 /** 00055 * \brief Uninitializes the CFStore handle. 00056 */ 00057 ccs_status_e uninitialize_storage(void); 00058 00059 /** 00060 * \brief Initializes the CFStore handle. 00061 */ 00062 ccs_status_e initialize_storage(void); 00063 00064 /* Bootstrap credential handling methods */ 00065 ccs_status_e ccs_get_string_item(const char* key, uint8_t *buffer, const size_t buffer_size, ccs_item_type_e item_type); 00066 ccs_status_e ccs_check_item(const char* key, ccs_item_type_e item_type); 00067 ccs_status_e ccs_delete_item(const char* key, ccs_item_type_e item_type); 00068 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); 00069 ccs_status_e ccs_set_item(const char* key, const uint8_t *buffer, const size_t buffer_size, ccs_item_type_e item_type); 00070 ccs_status_e ccs_item_size(const char* key, size_t* size_out, ccs_item_type_e item_type); 00071 00072 /* Certificate chain handling methods */ 00073 void *ccs_create_certificate_chain(const char *chain_file_name, size_t chain_len); 00074 void *ccs_open_certificate_chain(const char *chain_file_name, size_t *chain_size); 00075 ccs_status_e ccs_close_certificate_chain(void *chain_handle); 00076 ccs_status_e ccs_add_next_cert_chain(void *chain_handle, const uint8_t *cert_data, size_t data_size); 00077 ccs_status_e ccs_get_next_cert_chain(void *chain_handle, void *cert_data, size_t *data_size); 00078 ccs_status_e ccs_parse_cert_chain_and_store(const uint8_t *cert_chain_name, 00079 const size_t cert_chain_name_len, 00080 const uint8_t *cert_chain_data, 00081 const uint16_t cert_chain_data_len); 00082 #ifdef __cplusplus 00083 } 00084 #endif 00085 #endif // CLOUD_CLIENT_STORAGE_H
Generated on Tue Jul 12 2022 20:20:58 by
