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/certificate-enrollment-client/source/include/ce_internal.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 2018 ARM Ltd. |
leothedragon | 0:8f0bb79ddd48 | 3 | // |
leothedragon | 0:8f0bb79ddd48 | 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
leothedragon | 0:8f0bb79ddd48 | 5 | // you may not use this file except in compliance with the License. |
leothedragon | 0:8f0bb79ddd48 | 6 | // You may obtain a copy of the License at |
leothedragon | 0:8f0bb79ddd48 | 7 | // |
leothedragon | 0:8f0bb79ddd48 | 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
leothedragon | 0:8f0bb79ddd48 | 9 | // |
leothedragon | 0:8f0bb79ddd48 | 10 | // Unless required by applicable law or agreed to in writing, software |
leothedragon | 0:8f0bb79ddd48 | 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
leothedragon | 0:8f0bb79ddd48 | 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
leothedragon | 0:8f0bb79ddd48 | 13 | // See the License for the specific language governing permissions and |
leothedragon | 0:8f0bb79ddd48 | 14 | // limitations under the License. |
leothedragon | 0:8f0bb79ddd48 | 15 | // ---------------------------------------------------------------------------- |
leothedragon | 0:8f0bb79ddd48 | 16 | |
leothedragon | 0:8f0bb79ddd48 | 17 | #ifndef CE_INTERNAL_H |
leothedragon | 0:8f0bb79ddd48 | 18 | #define CE_INTERNAL_H |
leothedragon | 0:8f0bb79ddd48 | 19 | |
leothedragon | 0:8f0bb79ddd48 | 20 | #include <stdlib.h> |
leothedragon | 0:8f0bb79ddd48 | 21 | #include <stdbool.h> |
leothedragon | 0:8f0bb79ddd48 | 22 | #include <inttypes.h> |
leothedragon | 0:8f0bb79ddd48 | 23 | #include "cs_hash.h" |
leothedragon | 0:8f0bb79ddd48 | 24 | #include "kcm_defs.h" |
leothedragon | 0:8f0bb79ddd48 | 25 | #include "est_defs.h" |
leothedragon | 0:8f0bb79ddd48 | 26 | #include "ce_status.h" |
leothedragon | 0:8f0bb79ddd48 | 27 | #include "storage.h" |
leothedragon | 0:8f0bb79ddd48 | 28 | |
leothedragon | 0:8f0bb79ddd48 | 29 | #ifdef __cplusplus |
leothedragon | 0:8f0bb79ddd48 | 30 | extern "C" { |
leothedragon | 0:8f0bb79ddd48 | 31 | #endif |
leothedragon | 0:8f0bb79ddd48 | 32 | |
leothedragon | 0:8f0bb79ddd48 | 33 | #define CE_MAX_SIZE_OF_KCM_ITEM_NAME 100 |
leothedragon | 0:8f0bb79ddd48 | 34 | |
leothedragon | 0:8f0bb79ddd48 | 35 | /*! The API sets private key, public key and certificate item names according to its base name. |
leothedragon | 0:8f0bb79ddd48 | 36 | * |
leothedragon | 0:8f0bb79ddd48 | 37 | * @param[in] item_name item name string. |
leothedragon | 0:8f0bb79ddd48 | 38 | * @param[in] is_public_key flag that indicates if public key exists in the storage. |
leothedragon | 0:8f0bb79ddd48 | 39 | * |
leothedragon | 0:8f0bb79ddd48 | 40 | * @returns |
leothedragon | 0:8f0bb79ddd48 | 41 | * true/false |
leothedragon | 0:8f0bb79ddd48 | 42 | */ |
leothedragon | 0:8f0bb79ddd48 | 43 | bool ce_set_item_names(const char *item_name, char **private_key_name_out, char **public_key_name_out, char **certificate_name_out); |
leothedragon | 0:8f0bb79ddd48 | 44 | |
leothedragon | 0:8f0bb79ddd48 | 45 | /*! The API creates a copy of renewal items. |
leothedragon | 0:8f0bb79ddd48 | 46 | * |
leothedragon | 0:8f0bb79ddd48 | 47 | * @param[in] item_name item name string. |
leothedragon | 0:8f0bb79ddd48 | 48 | * @param[in] is_public_key flag that indicates if public key exists in the storage. |
leothedragon | 0:8f0bb79ddd48 | 49 | * |
leothedragon | 0:8f0bb79ddd48 | 50 | * @returns |
leothedragon | 0:8f0bb79ddd48 | 51 | * KCM_STATUS_SUCCESS in case of success or one of the `::kcm_status_e` errors otherwise. |
leothedragon | 0:8f0bb79ddd48 | 52 | */ |
leothedragon | 0:8f0bb79ddd48 | 53 | kcm_status_e ce_create_backup_items(const char *item_name, bool is_public_key); |
leothedragon | 0:8f0bb79ddd48 | 54 | |
leothedragon | 0:8f0bb79ddd48 | 55 | /*! The API restores backup items and moves it to original source, if the operation succeeded, the backup items deleted. |
leothedragon | 0:8f0bb79ddd48 | 56 | * @param[in] item_name item name string. |
leothedragon | 0:8f0bb79ddd48 | 57 | * @param[in] is_public_key public key flag - indicates if public key is in the storage. |
leothedragon | 0:8f0bb79ddd48 | 58 | * @returns |
leothedragon | 0:8f0bb79ddd48 | 59 | * KCM_STATUS_SUCCESS in case of success or one of the `::kcm_status_e` errors otherwise. |
leothedragon | 0:8f0bb79ddd48 | 60 | */ |
leothedragon | 0:8f0bb79ddd48 | 61 | kcm_status_e ce_restore_backup_items(const char *item_name); |
leothedragon | 0:8f0bb79ddd48 | 62 | |
leothedragon | 0:8f0bb79ddd48 | 63 | /*! The API deletes set of items (key pair and certificate/certificate chain) according to given name and source type. |
leothedragon | 0:8f0bb79ddd48 | 64 | * @param[in] item_name item name string. |
leothedragon | 0:8f0bb79ddd48 | 65 | * @param[in] source_data_type type of data type to verify (backup or original) |
leothedragon | 0:8f0bb79ddd48 | 66 | * @param[in] is_public_key flag that indicates if public key exists in the storage. |
leothedragon | 0:8f0bb79ddd48 | 67 | * @returns |
leothedragon | 0:8f0bb79ddd48 | 68 | * KCM_STATUS_SUCCESS in case of success or one of the `::kcm_status_e` errors otherwise. |
leothedragon | 0:8f0bb79ddd48 | 69 | */ |
leothedragon | 0:8f0bb79ddd48 | 70 | kcm_status_e ce_clean_items(const char *item_name, kcm_data_source_type_e data_source_type, bool is_public_key); |
leothedragon | 0:8f0bb79ddd48 | 71 | |
leothedragon | 0:8f0bb79ddd48 | 72 | /*! The API creates renewal status file with item_name data. |
leothedragon | 0:8f0bb79ddd48 | 73 | * @param[in] item_name item name string. |
leothedragon | 0:8f0bb79ddd48 | 74 | * @returns |
leothedragon | 0:8f0bb79ddd48 | 75 | * KCM_STATUS_SUCCESS in case of success or one of the `::kcm_status_e` errors otherwise. |
leothedragon | 0:8f0bb79ddd48 | 76 | */ |
leothedragon | 0:8f0bb79ddd48 | 77 | kcm_status_e ce_create_renewal_status(const char *item_name); |
leothedragon | 0:8f0bb79ddd48 | 78 | |
leothedragon | 0:8f0bb79ddd48 | 79 | /*! The API deletes renewal status file. |
leothedragon | 0:8f0bb79ddd48 | 80 | * @returns |
leothedragon | 0:8f0bb79ddd48 | 81 | * KCM_STATUS_SUCCESS in case of success or one of the `::kcm_status_e` errors otherwise. |
leothedragon | 0:8f0bb79ddd48 | 82 | */ |
leothedragon | 0:8f0bb79ddd48 | 83 | |
leothedragon | 0:8f0bb79ddd48 | 84 | kcm_status_e ce_delete_renewal_status(void); |
leothedragon | 0:8f0bb79ddd48 | 85 | |
leothedragon | 0:8f0bb79ddd48 | 86 | /*! The API stores new certificate/certificate chain to original source. |
leothedragon | 0:8f0bb79ddd48 | 87 | * @param[in] item_name item name string. |
leothedragon | 0:8f0bb79ddd48 | 88 | * @returns |
leothedragon | 0:8f0bb79ddd48 | 89 | * KCM_STATUS_SUCCESS in case of success or one of the `::kcm_status_e` errors otherwise. |
leothedragon | 0:8f0bb79ddd48 | 90 | */ |
leothedragon | 0:8f0bb79ddd48 | 91 | kcm_status_e ce_store_new_certificate(const char *certificate_name, struct cert_chain_context_s *certificate_data); |
leothedragon | 0:8f0bb79ddd48 | 92 | |
leothedragon | 0:8f0bb79ddd48 | 93 | #ifdef __cplusplus |
leothedragon | 0:8f0bb79ddd48 | 94 | } |
leothedragon | 0:8f0bb79ddd48 | 95 | #endif |
leothedragon | 0:8f0bb79ddd48 | 96 | |
leothedragon | 0:8f0bb79ddd48 | 97 | #endif //CE_INTERNAL_H |
leothedragon | 0:8f0bb79ddd48 | 98 |