Mayank Gupta / Mbed OS pelion-example-frdm

Dependencies:   FXAS21002 FXOS8700Q

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ce_internal.h Source File

ce_internal.h

00001 // ----------------------------------------------------------------------------
00002 // Copyright 2018 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 CE_INTERNAL_H
00018 #define CE_INTERNAL_H
00019 
00020 #include <stdlib.h>
00021 #include <stdbool.h>
00022 #include <inttypes.h>
00023 #include "cs_hash.h"
00024 #include "kcm_defs.h"
00025 #include "est_defs.h"
00026 #include "ce_status.h"
00027 #include "storage.h"
00028 
00029 #ifdef __cplusplus
00030 extern "C" {
00031 #endif
00032 
00033 #define CE_MAX_SIZE_OF_KCM_ITEM_NAME 100
00034 
00035     /*! The API sets private key, public key and certificate item names according to its base name.
00036     *
00037     *    @param[in] item_name                item name string.
00038     *    @param[in] is_public_key            flag that indicates if public key exists in the storage.
00039     *
00040     *    @returns
00041     *        true/false
00042     */
00043     bool ce_set_item_names(const char *item_name, char **private_key_name_out, char **public_key_name_out, char **certificate_name_out);
00044 
00045     /*! The API creates a copy of renewal items.
00046     *
00047     *    @param[in] item_name                item name string.
00048     *    @param[in] is_public_key            flag that indicates if public key exists in the storage.
00049     *
00050     *    @returns
00051     *        KCM_STATUS_SUCCESS in case of success or one of the `::kcm_status_e` errors otherwise.
00052     */
00053     kcm_status_e  ce_create_backup_items(const char *item_name, bool is_public_key);
00054 
00055     /*! The API restores backup items and moves it to original source, if the operation succeeded, the backup items deleted.
00056     *    @param[in] item_name                item name string.
00057     *    @param[in] is_public_key            public key flag - indicates if public key is in the storage.
00058     *    @returns
00059     *        KCM_STATUS_SUCCESS in case of success or one of the `::kcm_status_e` errors otherwise.
00060     */
00061     kcm_status_e  ce_restore_backup_items(const char *item_name);
00062 
00063     /*! The API deletes set of items (key pair and certificate/certificate chain) according to given name and source type.
00064     *    @param[in] item_name                item name string.
00065     *    @param[in] source_data_type         type of data type to verify (backup or original)
00066     *    @param[in] is_public_key                    flag that indicates if public key exists in the storage.
00067     *    @returns
00068     *        KCM_STATUS_SUCCESS in case of success or one of the `::kcm_status_e` errors otherwise.
00069     */
00070     kcm_status_e  ce_clean_items(const char *item_name, kcm_data_source_type_e data_source_type, bool is_public_key);
00071 
00072     /*! The API creates renewal status file with item_name data.
00073     *    @param[in] item_name                item name string.
00074     *    @returns
00075     *        KCM_STATUS_SUCCESS in case of success or one of the `::kcm_status_e` errors otherwise.
00076     */
00077     kcm_status_e  ce_create_renewal_status(const char *item_name);
00078 
00079     /*! The API deletes renewal status file.
00080     *    @returns
00081     *        KCM_STATUS_SUCCESS in case of success or one of the `::kcm_status_e` errors otherwise.
00082     */
00083 
00084     kcm_status_e  ce_delete_renewal_status(void);
00085 
00086     /*! The API stores new certificate/certificate chain to original source.
00087     *    @param[in] item_name                item name string.
00088     *    @returns
00089     *        KCM_STATUS_SUCCESS in case of success or one of the `::kcm_status_e` errors otherwise.
00090     */
00091     kcm_status_e  ce_store_new_certificate(const char *certificate_name, struct cert_chain_context_s *certificate_data);
00092 
00093 #ifdef __cplusplus
00094 }
00095 #endif
00096 
00097 #endif //CE_INTERNAL_H
00098