1 /* 2 Copyright (c) 2021 Fraunhofer AISEC. See the COPYRIGHT 3 file at the top-level directory of this distribution. 4 5 Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or 6 http://www.apache.org/licenses/LICENSE-2.0> or the MIT license 7 <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your 8 option. This file may not be copied, modified, or distributed 9 except according to those terms. 10 */ 11 #ifndef CERT_H 12 #define CERT_H 13 14 #include <stdint.h> 15 16 #include "edhoc.h" 17 #include "common/byte_array.h" 18 #include "common/oscore_edhoc_error.h" 19 20 /** 21 * @brief Verifies a c509 certificate. 22 * 23 * @param[in] cert A native CBOR encoded certificate. 24 * @param[in] cred_array An array containing credentials. 25 * @param[out] pk Public key contained in the certificate. 26 * @param verified True if the verification is successful. 27 * @retval Ok or error code. 28 */ 29 enum err cert_c509_verify(struct const_byte_array *cert, 30 const struct cred_array *cred_array, 31 struct byte_array *pk, bool *verified); 32 33 /** 34 * @brief Verifies a x509 certificate. 35 * 36 * @param[in] cert A X.509 encoded certificate. 37 * @param[in] cred_array An array containing credentials. 38 * @param[out] pk Public key contained in the certificate. 39 * @param verified True if the verification is successful. 40 * @retval Ok or error code. 41 */ 42 enum err cert_x509_verify(struct const_byte_array *cert, 43 const struct cred_array *cred_array, 44 struct byte_array *pk, bool *verified); 45 #endif 46