Simple interface for Mbed Cloud Client

Dependents:  

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers fcc_bundle_handler.h Source File

fcc_bundle_handler.h

Go to the documentation of this file.
00001 // ----------------------------------------------------------------------------
00002 // Copyright 2016-2017 ARM Ltd.
00003 //  
00004 // Licensed under the Apache License, Version 2.0 (the "License");
00005 // you may not use this file except in compliance with the License.
00006 // You may obtain a copy of the License at
00007 //  
00008 //     http://www.apache.org/licenses/LICENSE-2.0
00009 //  
00010 // Unless required by applicable law or agreed to in writing, software
00011 // distributed under the License is distributed on an "AS IS" BASIS,
00012 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013 // See the License for the specific language governing permissions and
00014 // limitations under the License.
00015 // ----------------------------------------------------------------------------
00016 
00017 #ifndef __FCC_BUNDLE_HANDLER_H__
00018 #define __FCC_BUNDLE_HANDLER_H__
00019 
00020 #include <stdlib.h>
00021 #include <inttypes.h>
00022 #include "fcc_status.h"
00023 
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027 
00028 /**
00029 * @file fcc_bundle_handler.h
00030 *  \brief The fcc bundle handler APIs.
00031 * This layer handles a device configuration bundle created by factory configurator utility (FCU).
00032 */
00033 /**
00034 * Name of keys group.
00035 */
00036 #define FCC_KEY_GROUP_NAME                   "Keys"
00037 /**
00038 * Name of certificates group
00039 */
00040 #define FCC_CERTIFICATE_GROUP_NAME           "Certificates"
00041 /**
00042 * Name of CSRs group.
00043 */
00044 #define FCC_CSR_GROUP_NAME                   "Csrs"
00045 /**
00046 * Name of configuration parameters group.
00047 */
00048 #define FCC_CONFIG_PARAM_GROUP_NAME           "ConfigParams"
00049 /**
00050 * Name of certificate chain group.
00051 */
00052 #define FCC_CERTIFICATE_CHAIN_GROUP_NAME       "CertificateChains"
00053 /**
00054 * Name of scheme version group.
00055 */
00056 #define FCC_BUNDLE_SCHEME_GROUP_NAME          "SchemeVersion"
00057 /**
00058 * Name of Entropy group.
00059 */
00060 #define FCC_ENTROPY_NAME       "Entropy"
00061 /**
00062 * Name of RoT group.
00063 */
00064 #define FCC_ROT_NAME          "ROT"
00065 /**
00066 * Name of device verify readiness group.
00067 */
00068 #define FCC_VERIFY_DEVICE_IS_READY_GROUP_NAME          "Verify"
00069 /**
00070 * Name of device verify readiness group.
00071 */
00072 #define FCC_FACTORY_DISABLE_GROUP_NAME          "Disable"
00073 
00074 /**
00075 * Name of error info group.
00076 */
00077 //Fixme : rename "infoMessage" to ErrorInfo" when Factory tool will be ready for the change
00078 #define FCC_ERROR_INFO_GROUP_NAME              "InfoMessage"
00079 /**
00080 * Name of return status group.
00081 */
00082 #define FCC_RETURN_STATUS_GROUP_NAME          "ReturnStatus"
00083 /**
00084 * Name of warning info group.
00085 */
00086 #define FCC_WARNING_INFO_GROUP_NAME            "WarningInfo"
00087 
00088 /** Decodes and processes an inbound device configuration bundle created by FCU.
00089 * Also creates an outbound bundle that should be sent to FCU.
00090 * The function assumes that the bundle includes four groups represented as cbor maps.
00091 * The names of the groups are `SchemeVersion`, `Keys`, `Certificates` and `ConfigParams`.
00092 * Each group contains a list of items, and for each item, there are a number of relevant parameters.
00093 *
00094 * @param encoded_bundle The encoded FCU bundle that is written into a secure storage.
00095 * @param encoded_blob_size The encoded FCU bundle size in bytes.
00096 * @param bundle_response_out The encoded outbound bundle. It may contain data such as CSR and different types of key schemes.
00097 *        The response associates a descriptive error in case of a fault. Will be NULL if response not created successfully.
00098 * @param bundle_response_size_out The encoded outbound bundle size in bytes.
00099 *
00100 * @return
00101 *       FCC_STATUS_SUCCESS in case of success or one of the `::fcc_status_e` errors otherwise.
00102 */
00103 fcc_status_e  fcc_bundle_handler(const uint8_t *encoded_bundle, size_t encoded_bundle_size, uint8_t **bundle_response_out, size_t *bundle_response_size_out);
00104 
00105 
00106 #ifdef __cplusplus
00107 }
00108 #endif
00109 
00110 #endif //__FCC_BUNDLE_HANDLER_H__