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 arm_uc_certificate.h Source File

arm_uc_certificate.h

00001 // ----------------------------------------------------------------------------
00002 // Copyright 2016-2017 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 ARM_UPDATE_CERTIFICATES_H
00020 #define ARM_UPDATE_CERTIFICATES_H
00021 
00022 #include "update-client-common/arm_uc_common.h"
00023 
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027 
00028 /**
00029  * @brief Add certificate.
00030  * @details [long description]
00031  *
00032  * @param certificate Pointer to certiface being added.
00033  * @param certificate_length Certificate length.
00034  * @param fingerprint Pointer to the fingerprint of the certificate being added.
00035  * @param fingerprint_length Fingerprint length.
00036  * @return Error code.
00037  */
00038  arm_uc_error_t ARM_UC_Certificate_Add(const uint8_t* certificate,
00039                                        uint16_t certificate_size,
00040                                        const uint8_t* fingerprint,
00041                                        uint16_t fingerprint_size,
00042                                        void (*callback)(arm_uc_error_t, const arm_uc_buffer_t*));
00043 
00044 typedef arm_uc_error_t (* arm_uc_certificateStorer)(const arm_uc_buffer_t* certificate,
00045                                                     const arm_uc_buffer_t* fingerprint,
00046                                                     void (*callback)(arm_uc_error_t, const arm_uc_buffer_t*));
00047 
00048 /**
00049  * @brief Fetch a certificate by fingerprint
00050  * @details This API is registered with the hub by the application. The application must handle any required certificate
00051  * chain validation. The API for parsing a certificate chain will be provided by the manifest manager, but the API
00052  * is TBD, so the DERCertificateList should be ignored for now.
00053  *
00054  * @param[out] certificates A pointer to the buffer to populate with the certificate. The buffer's ptr should be updated
00055  *                          to point to the certificate.
00056  * @param[in] fingerprint The fingerprint of the certificate
00057  * @param[in] DERCertificateList The encoded list of certificate fingerprint/URL pairs that define the chain of
00058  *                               certificates used to verify the requested certificate (The requested certificate will
00059  *                               always be the first in the list)
00060  * @param[in] callback The function to call when the certificate is available
00061  */
00062 typedef arm_uc_error_t (*arm_uc_certificateFetcher)(arm_uc_buffer_t* certificate,
00063     const arm_uc_buffer_t* fingerprint,
00064     const arm_uc_buffer_t* DERCertificateList,
00065     void (*callback)(arm_uc_error_t, const arm_uc_buffer_t*, const arm_uc_buffer_t*));
00066 
00067 
00068 struct arm_uc_certificate_api {
00069     arm_uc_certificateFetcher fetch;
00070     arm_uc_certificateStorer  store;
00071 };
00072 
00073 arm_uc_error_t ARM_UC_certificateFetch(arm_uc_buffer_t* certificate,
00074     const arm_uc_buffer_t* fingerprint,
00075     const arm_uc_buffer_t* DERCertificateList,
00076     void (*callback)(arm_uc_error_t, const arm_uc_buffer_t*, const arm_uc_buffer_t*));
00077 
00078 #ifdef __cplusplus
00079 };
00080 #endif
00081 
00082 #endif // ARM_UPDATE_CERTIFICATES_H