Simulated product dispenser

Dependencies:   HTS221

Fork of mbed-cloud-workshop-connect-HTS221 by Jim Carver

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers CloudClientStorage.h Source File

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 #define KEY_ACCOUNT_ID                          "mbed.AccountID"
00023 #define KEY_INTERNAL_ENDPOINT                   "mbed.InternalEndpoint"
00024 #define KEY_DEVICE_SOFTWAREVERSION              "mbed.SoftwareVersion"
00025 #define KEY_FIRST_TO_CLAIM                      "mbed.FirstToClaim"
00026 
00027 #ifdef __cplusplus
00028 extern "C" {
00029 #endif
00030 
00031 typedef enum {
00032     CCS_STATUS_MEMORY_ERROR = -4,
00033     CCS_STATUS_VALIDATION_FAIL = -3,
00034     CCS_STATUS_KEY_DOESNT_EXIST = -2,
00035     CCS_STATUS_ERROR = -1,
00036     CCS_STATUS_SUCCESS = 0
00037 } ccs_status_e;
00038 
00039 /**
00040 * CCS item types
00041 * Keep these sync with ones that found from kcm_defs.h
00042 */
00043 typedef enum {
00044     CCS_PRIVATE_KEY_ITEM,          //!< KCM private key item type. KCM Supports ECC keys with curves defined in palGroupIndex_t(pal_Crypto.h)
00045     CCS_PUBLIC_KEY_ITEM,           //!< KCM public key item type.  KCM Supports ECC keys with curves defined in palGroupIndex_t(pal_Crypto.h)
00046     CCS_SYMMETRIC_KEY_ITEM,        //!< KCM symmetric key item type.
00047     CCS_CERTIFICATE_ITEM,          //!< KCM certificate item type. Supported x509 certificates in der format.
00048     CCS_CONFIG_ITEM                //!< KCM configuration parameter item type.
00049 } ccs_item_type_e;
00050 
00051 /**
00052 *  \brief Uninitializes the CFStore handle.
00053 */
00054 ccs_status_e uninitialize_storage(void);
00055 
00056 /**
00057 *  \brief Initializes the CFStore handle.
00058 */
00059 ccs_status_e initialize_storage(void);
00060 
00061 /* Bootstrap credential handling methods */
00062 ccs_status_e ccs_get_string_item(const char* key, uint8_t *buffer, const size_t buffer_size, ccs_item_type_e item_type);
00063 ccs_status_e ccs_check_item(const char* key, ccs_item_type_e item_type);
00064 ccs_status_e ccs_delete_item(const char* key, ccs_item_type_e item_type);
00065 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);
00066 ccs_status_e ccs_set_item(const char* key, const uint8_t *buffer, const size_t buffer_size, ccs_item_type_e item_type);
00067 ccs_status_e ccs_item_size(const char* key, size_t* size_out, ccs_item_type_e item_type);
00068 
00069 /* Certificate chain handling methods */
00070 void *ccs_create_certificate_chain(const char *chain_file_name, size_t chain_len);
00071 void *ccs_open_certificate_chain(const char *chain_file_name, size_t *chain_size);
00072 ccs_status_e ccs_close_certificate_chain(void *chain_handle);
00073 ccs_status_e ccs_add_next_cert_chain(void *chain_handle, const uint8_t *cert_data, size_t data_size);
00074 ccs_status_e ccs_get_next_cert_chain(void *chain_handle, void *cert_data, size_t *data_size);
00075 ccs_status_e ccs_parse_cert_chain_and_store(const uint8_t *cert_chain_name,
00076                                             const size_t cert_chain_name_len,
00077                                             const uint8_t *cert_chain_data,
00078                                             const uint16_t cert_chain_data_len);
00079 #ifdef __cplusplus
00080 }
00081 #endif
00082 #endif // CLOUD_CLIENT_STORAGE_H