blob: 216481d5a182d334b1806275e65246f252588bba [file] [log] [blame]
Paul Bakker7c6b2c32013-09-16 13:49:26 +02001/**
Simon Butcher5b331b92016-01-03 16:14:14 +00002 * \file x509_crt.h
Paul Bakker7c6b2c32013-09-16 13:49:26 +02003 *
4 * \brief X.509 certificate parsing and writing
Darryl Greena40a1012018-01-05 15:33:17 +00005 */
6/*
Manuel Pégourié-Gonnard6fb81872015-07-27 11:11:48 +02007 * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
Bence Szépkúti4e9f7122020-06-05 13:02:18 +02008 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
9 *
10 * This file is provided under the Apache License 2.0, or the
11 * GNU General Public License v2.0 or later.
12 *
13 * **********
14 * Apache License 2.0:
Manuel Pégourié-Gonnard37ff1402015-09-04 14:21:07 +020015 *
16 * Licensed under the Apache License, Version 2.0 (the "License"); you may
17 * not use this file except in compliance with the License.
18 * You may obtain a copy of the License at
19 *
20 * http://www.apache.org/licenses/LICENSE-2.0
21 *
22 * Unless required by applicable law or agreed to in writing, software
23 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
24 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25 * See the License for the specific language governing permissions and
26 * limitations under the License.
Paul Bakker7c6b2c32013-09-16 13:49:26 +020027 *
Bence Szépkúti4e9f7122020-06-05 13:02:18 +020028 * **********
29 *
30 * **********
31 * GNU General Public License v2.0 or later:
32 *
33 * This program is free software; you can redistribute it and/or modify
34 * it under the terms of the GNU General Public License as published by
35 * the Free Software Foundation; either version 2 of the License, or
36 * (at your option) any later version.
37 *
38 * This program is distributed in the hope that it will be useful,
39 * but WITHOUT ANY WARRANTY; without even the implied warranty of
40 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
41 * GNU General Public License for more details.
42 *
43 * You should have received a copy of the GNU General Public License along
44 * with this program; if not, write to the Free Software Foundation, Inc.,
45 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
46 *
47 * **********
48 *
Manuel Pégourié-Gonnardfe446432015-03-06 13:17:10 +000049 * This file is part of mbed TLS (https://tls.mbed.org)
Paul Bakker7c6b2c32013-09-16 13:49:26 +020050 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020051#ifndef MBEDTLS_X509_CRT_H
52#define MBEDTLS_X509_CRT_H
Paul Bakker7c6b2c32013-09-16 13:49:26 +020053
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020054#if !defined(MBEDTLS_CONFIG_FILE)
Paul Bakker7c6b2c32013-09-16 13:49:26 +020055#include "config.h"
Manuel Pégourié-Gonnardcef4ad22014-04-29 12:39:06 +020056#else
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020057#include MBEDTLS_CONFIG_FILE
Manuel Pégourié-Gonnardcef4ad22014-04-29 12:39:06 +020058#endif
Paul Bakker7c6b2c32013-09-16 13:49:26 +020059
60#include "x509.h"
Paul Bakker7c6b2c32013-09-16 13:49:26 +020061#include "x509_crl.h"
Paul Bakker7c6b2c32013-09-16 13:49:26 +020062
63/**
64 * \addtogroup x509_module
65 * \{
66 */
67
68#ifdef __cplusplus
69extern "C" {
70#endif
71
72/**
73 * \name Structures and functions for parsing and writing X.509 certificates
74 * \{
75 */
76
77/**
78 * Container for an X.509 certificate. The certificate may be chained.
79 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020080typedef struct mbedtls_x509_crt
Paul Bakker7c6b2c32013-09-16 13:49:26 +020081{
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020082 mbedtls_x509_buf raw; /**< The raw certificate data (DER). */
83 mbedtls_x509_buf tbs; /**< The raw certificate body (DER). The part that is To Be Signed. */
Paul Bakker7c6b2c32013-09-16 13:49:26 +020084
Manuel Pégourié-Gonnardf4e1b642014-06-19 11:39:46 +020085 int version; /**< The X.509 version. (1=v1, 2=v2, 3=v3) */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020086 mbedtls_x509_buf serial; /**< Unique id for certificate issued by a specific CA. */
87 mbedtls_x509_buf sig_oid; /**< Signature algorithm, e.g. sha1RSA */
Paul Bakker7c6b2c32013-09-16 13:49:26 +020088
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020089 mbedtls_x509_buf issuer_raw; /**< The raw issuer data (DER). Used for quick comparison. */
90 mbedtls_x509_buf subject_raw; /**< The raw subject data (DER). Used for quick comparison. */
Paul Bakker7c6b2c32013-09-16 13:49:26 +020091
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020092 mbedtls_x509_name issuer; /**< The parsed issuer data (named information object). */
93 mbedtls_x509_name subject; /**< The parsed subject data (named information object). */
Paul Bakker7c6b2c32013-09-16 13:49:26 +020094
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020095 mbedtls_x509_time valid_from; /**< Start time of certificate validity. */
96 mbedtls_x509_time valid_to; /**< End time of certificate validity. */
Paul Bakker7c6b2c32013-09-16 13:49:26 +020097
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020098 mbedtls_pk_context pk; /**< Container for the public key context. */
Paul Bakker7c6b2c32013-09-16 13:49:26 +020099
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200100 mbedtls_x509_buf issuer_id; /**< Optional X.509 v2/v3 issuer unique identifier. */
101 mbedtls_x509_buf subject_id; /**< Optional X.509 v2/v3 subject unique identifier. */
102 mbedtls_x509_buf v3_ext; /**< Optional X.509 v3 extensions. */
103 mbedtls_x509_sequence subject_alt_names; /**< Optional list of Subject Alternative Names (Only dNSName supported). */
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200104
105 int ext_types; /**< Bit string containing detected and parsed extensions */
106 int ca_istrue; /**< Optional Basic Constraint extension value: 1 if this certificate belongs to a CA, 0 otherwise. */
107 int max_pathlen; /**< Optional Basic Constraint extension value: The maximum path length to the root certificate. Path length is 1 higher than RFC 5280 'meaning', so 1+ */
108
Manuel Pégourié-Gonnard1d0ca1a2015-03-27 16:50:00 +0100109 unsigned int key_usage; /**< Optional key usage extension value: See the values in x509.h */
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200110
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200111 mbedtls_x509_sequence ext_key_usage; /**< Optional list of extended key usage OIDs. */
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200112
Manuel Pégourié-Gonnardb28487d2014-04-01 12:19:09 +0200113 unsigned char ns_cert_type; /**< Optional Netscape certificate type extension value: See the values in x509.h */
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200114
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200115 mbedtls_x509_buf sig; /**< Signature: hash of the tbs part signed with the private key. */
116 mbedtls_md_type_t sig_md; /**< Internal representation of the MD algorithm of the signature algorithm, e.g. MBEDTLS_MD_SHA256 */
117 mbedtls_pk_type_t sig_pk; /**< Internal representation of the Public Key algorithm of the signature algorithm, e.g. MBEDTLS_PK_RSA */
118 void *sig_opts; /**< Signature options to be passed to mbedtls_pk_verify_ext(), e.g. for RSASSA-PSS */
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200119
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200120 struct mbedtls_x509_crt *next; /**< Next certificate in the CA-chain. */
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200121}
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200122mbedtls_x509_crt;
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200123
Manuel Pégourié-Gonnard88db5da2015-06-15 14:34:59 +0200124/**
Manuel Pégourié-Gonnardf8ea8562015-06-15 15:33:19 +0200125 * Build flag from an algorithm/curve identifier (pk, md, ecp)
126 * Since 0 is always XXX_NONE, ignore it.
127 */
Hanno Becker0af25e72018-10-15 12:13:38 +0100128#define MBEDTLS_X509_ID_FLAG( id ) ( 1 << ( ( id ) - 1 ) )
Manuel Pégourié-Gonnardf8ea8562015-06-15 15:33:19 +0200129
130/**
Manuel Pégourié-Gonnard88db5da2015-06-15 14:34:59 +0200131 * Security profile for certificate verification.
Manuel Pégourié-Gonnard95051642015-06-15 10:39:46 +0200132 *
Manuel Pégourié-Gonnardf8ea8562015-06-15 15:33:19 +0200133 * All lists are bitfields, built by ORing flags from MBEDTLS_X509_ID_FLAG().
Manuel Pégourié-Gonnard95051642015-06-15 10:39:46 +0200134 */
135typedef struct
136{
Manuel Pégourié-Gonnardf8ea8562015-06-15 15:33:19 +0200137 uint32_t allowed_mds; /**< MDs for signatures */
138 uint32_t allowed_pks; /**< PK algs for signatures */
139 uint32_t allowed_curves; /**< Elliptic curves for ECDSA */
140 uint32_t rsa_min_bitlen; /**< Minimum size for RSA keys */
Manuel Pégourié-Gonnard95051642015-06-15 10:39:46 +0200141}
142mbedtls_x509_crt_profile;
143
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200144#define MBEDTLS_X509_CRT_VERSION_1 0
145#define MBEDTLS_X509_CRT_VERSION_2 1
146#define MBEDTLS_X509_CRT_VERSION_3 2
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200147
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200148#define MBEDTLS_X509_RFC5280_MAX_SERIAL_LEN 32
149#define MBEDTLS_X509_RFC5280_UTC_TIME_LEN 15
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200150
Andres AGf9113192016-09-02 14:06:04 +0100151#if !defined( MBEDTLS_X509_MAX_FILE_PATH_LEN )
152#define MBEDTLS_X509_MAX_FILE_PATH_LEN 512
153#endif
154
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200155/**
156 * Container for writing a certificate (CRT)
157 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200158typedef struct mbedtls_x509write_cert
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200159{
160 int version;
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200161 mbedtls_mpi serial;
162 mbedtls_pk_context *subject_key;
163 mbedtls_pk_context *issuer_key;
164 mbedtls_asn1_named_data *subject;
165 mbedtls_asn1_named_data *issuer;
166 mbedtls_md_type_t md_alg;
167 char not_before[MBEDTLS_X509_RFC5280_UTC_TIME_LEN + 1];
168 char not_after[MBEDTLS_X509_RFC5280_UTC_TIME_LEN + 1];
169 mbedtls_asn1_named_data *extensions;
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200170}
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200171mbedtls_x509write_cert;
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200172
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200173#if defined(MBEDTLS_X509_CRT_PARSE_C)
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200174/**
Manuel Pégourié-Gonnard88db5da2015-06-15 14:34:59 +0200175 * Default security profile. Should provide a good balance between security
176 * and compatibility with current deployments.
177 */
178extern const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_default;
179
180/**
181 * Expected next default profile. Recommended for new deployments.
182 * Currently targets a 128-bit security level, except for RSA-2048.
183 */
184extern const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_next;
185
186/**
187 * NSA Suite B profile.
188 */
189extern const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_suiteb;
190
191/**
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200192 * \brief Parse a single DER formatted certificate and add it
193 * to the chained list.
194 *
195 * \param chain points to the start of the chain
196 * \param buf buffer holding the certificate DER data
197 * \param buflen size of the buffer
198 *
199 * \return 0 if successful, or a specific X509 or PEM error code
200 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200201int mbedtls_x509_crt_parse_der( mbedtls_x509_crt *chain, const unsigned char *buf,
Paul Bakkerddf26b42013-09-18 13:46:23 +0200202 size_t buflen );
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200203
204/**
Hanno Beckerca16cf62018-08-23 16:14:00 +0100205 * \brief Parse one DER-encoded or one or more concatenated PEM-encoded
Hanno Beckerca8c3b42018-08-23 15:46:33 +0100206 * certificates and add them to the chained list.
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200207 *
Hanno Becker6728d3c2018-08-24 10:01:17 +0100208 * For CRTs in PEM encoding, the function parses permissively:
209 * if at least one certificate can be parsed, the function
Hanno Beckerca8c3b42018-08-23 15:46:33 +0100210 * returns the number of certificates for which parsing failed
211 * (hence \c 0 if all certificates were parsed successfully).
212 * If no certificate could be parsed, the function returns
213 * the first (negative) error encountered during parsing.
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200214 *
Hanno Beckerca8c3b42018-08-23 15:46:33 +0100215 * PEM encoded certificates may be interleaved by other data
216 * such as human readable descriptions of their content, as
217 * long as the certificates are enclosed in the PEM specific
218 * '-----{BEGIN/END} CERTIFICATE-----' delimiters.
219 *
220 * \param chain The chain to which to add the parsed certificates.
221 * \param buf The buffer holding the certificate data in PEM or DER format.
222 * For certificates in PEM encoding, this may be a concatenation
223 * of multiple certificates; for DER encoding, the buffer must
224 * comprise exactly one certificate.
225 * \param buflen The size of \p buf, including the terminating \c NULL byte
226 * in case of PEM encoded data.
227 *
228 * \return \c 0 if all certificates were parsed successfully.
229 * \return The (positive) number of certificates that couldn't
230 * be parsed if parsing was partly successful (see above).
Hanno Beckerca16cf62018-08-23 16:14:00 +0100231 * \return A negative X509 or PEM error code otherwise.
Hanno Beckerca8c3b42018-08-23 15:46:33 +0100232 *
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200233 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200234int mbedtls_x509_crt_parse( mbedtls_x509_crt *chain, const unsigned char *buf, size_t buflen );
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200235
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200236#if defined(MBEDTLS_FS_IO)
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200237/**
238 * \brief Load one or more certificates and add them
239 * to the chained list. Parses permissively. If some
240 * certificates can be parsed, the result is the number
241 * of failed certificates it encountered. If none complete
242 * correctly, the first error is returned.
243 *
244 * \param chain points to the start of the chain
245 * \param path filename to read the certificates from
246 *
247 * \return 0 if all certificates parsed successfully, a positive number
248 * if partly successful or a specific X509 or PEM error code
249 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200250int mbedtls_x509_crt_parse_file( mbedtls_x509_crt *chain, const char *path );
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200251
252/**
253 * \brief Load one or more certificate files from a path and add them
254 * to the chained list. Parses permissively. If some
255 * certificates can be parsed, the result is the number
256 * of failed certificates it encountered. If none complete
257 * correctly, the first error is returned.
258 *
259 * \param chain points to the start of the chain
260 * \param path directory / folder to read the certificate files from
261 *
262 * \return 0 if all certificates parsed successfully, a positive number
263 * if partly successful or a specific X509 or PEM error code
264 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200265int mbedtls_x509_crt_parse_path( mbedtls_x509_crt *chain, const char *path );
266#endif /* MBEDTLS_FS_IO */
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200267
268/**
269 * \brief Returns an informational string about the
270 * certificate.
271 *
272 * \param buf Buffer to write to
273 * \param size Maximum size of buffer
274 * \param prefix A line prefix
275 * \param crt The X509 certificate to represent
276 *
Manuel Pégourié-Gonnarde244f9f2015-06-23 12:10:45 +0200277 * \return The length of the string written (not including the
278 * terminated nul byte), or a negative error code.
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200279 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200280int mbedtls_x509_crt_info( char *buf, size_t size, const char *prefix,
281 const mbedtls_x509_crt *crt );
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200282
283/**
Manuel Pégourié-Gonnardb5f48ad2015-04-20 10:38:13 +0100284 * \brief Returns an informational string about the
285 * verification status of a certificate.
286 *
287 * \param buf Buffer to write to
288 * \param size Maximum size of buffer
289 * \param prefix A line prefix
290 * \param flags Verification flags created by mbedtls_x509_crt_verify()
291 *
Manuel Pégourié-Gonnarde244f9f2015-06-23 12:10:45 +0200292 * \return The length of the string written (not including the
293 * terminated nul byte), or a negative error code.
Manuel Pégourié-Gonnardb5f48ad2015-04-20 10:38:13 +0100294 */
295int mbedtls_x509_crt_verify_info( char *buf, size_t size, const char *prefix,
Manuel Pégourié-Gonnarde6ef16f2015-05-11 19:54:43 +0200296 uint32_t flags );
Manuel Pégourié-Gonnard39a183a2015-04-17 16:14:32 +0200297
298/**
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200299 * \brief Verify the certificate signature
300 *
301 * The verify callback is a user-supplied callback that
302 * can clear / modify / add flags for a certificate. If set,
303 * the verification callback is called for each
304 * certificate in the chain (from the trust-ca down to the
305 * presented crt). The parameters for the callback are:
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200306 * (void *parameter, mbedtls_x509_crt *crt, int certificate_depth,
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200307 * int *flags). With the flags representing current flags for
308 * that specific certificate and the certificate depth from
309 * the bottom (Peer cert depth = 0).
310 *
311 * All flags left after returning from the callback
312 * are also returned to the application. The function should
Manuel Pégourié-Gonnard31458a12017-06-26 10:11:49 +0200313 * return 0 for anything (including invalid certificates)
314 * other than fatal error, as a non-zero return code
315 * immediately aborts the verification process. For fatal
316 * errors, a specific error code should be used (different
317 * from MBEDTLS_ERR_X509_CERT_VERIFY_FAILED which should not
318 * be returned at this point), or MBEDTLS_ERR_X509_FATAL_ERROR
319 * can be used if no better code is available.
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200320 *
Manuel Pégourié-Gonnardb5f48ad2015-04-20 10:38:13 +0100321 * \note In case verification failed, the results can be displayed
322 * using \c mbedtls_x509_crt_verify_info()
323 *
Manuel Pégourié-Gonnard95051642015-06-15 10:39:46 +0200324 * \note Same as \c mbedtls_x509_crt_verify_with_profile() with the
325 * default security profile.
326 *
Manuel Pégourié-Gonnardeeef9472016-02-22 11:36:55 +0100327 * \note It is your responsibility to provide up-to-date CRLs for
328 * all trusted CAs. If no CRL is provided for the CA that was
329 * used to sign the certificate, CRL verification is skipped
330 * silently, that is *without* setting any flag.
331 *
Manuel Pégourié-Gonnard75d35602018-03-05 13:22:59 +0100332 * \note The \c trust_ca list can contain two types of certificates:
Manuel Pégourié-Gonnard3a130842017-06-21 09:35:44 +0200333 * (1) those of trusted root CAs, so that certificates
334 * chaining up to those CAs will be trusted, and (2)
335 * self-signed end-entity certificates to be trusted (for
336 * specific peers you know) - in that case, the self-signed
Manuel Pégourié-Gonnard2f1633e2018-03-05 13:19:41 +0100337 * certificate doesn't need to have the CA bit set.
Manuel Pégourié-Gonnard3a130842017-06-21 09:35:44 +0200338 *
Manuel Pégourié-Gonnardeeef9472016-02-22 11:36:55 +0100339 * \param crt a certificate (chain) to be verified
Manuel Pégourié-Gonnard3a130842017-06-21 09:35:44 +0200340 * \param trust_ca the list of trusted CAs (see note above)
Manuel Pégourié-Gonnardeeef9472016-02-22 11:36:55 +0100341 * \param ca_crl the list of CRLs for trusted CAs (see note above)
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200342 * \param cn expected Common Name (can be set to
343 * NULL if the CN must not be verified)
344 * \param flags result of the verification
345 * \param f_vrfy verification function
346 * \param p_vrfy verification parameter
347 *
Manuel Pégourié-Gonnard760c9b92017-07-06 15:00:32 +0200348 * \return 0 (and flags set to 0) if the chain was verified and valid,
349 * MBEDTLS_ERR_X509_CERT_VERIFY_FAILED if the chain was verified
350 * but found to be invalid, in which case *flags will have one
351 * or more MBEDTLS_X509_BADCERT_XXX or MBEDTLS_X509_BADCRL_XXX
352 * flags set, or another error (and flags set to 0xffffffff)
353 * in case of a fatal error encountered during the
354 * verification process.
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200355 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200356int mbedtls_x509_crt_verify( mbedtls_x509_crt *crt,
357 mbedtls_x509_crt *trust_ca,
358 mbedtls_x509_crl *ca_crl,
Manuel Pégourié-Gonnarde6ef16f2015-05-11 19:54:43 +0200359 const char *cn, uint32_t *flags,
360 int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *),
Paul Bakkerddf26b42013-09-18 13:46:23 +0200361 void *p_vrfy );
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200362
Manuel Pégourié-Gonnard95051642015-06-15 10:39:46 +0200363/**
364 * \brief Verify the certificate signature according to profile
365 *
366 * \note Same as \c mbedtls_x509_crt_verify(), but with explicit
367 * security profile.
368 *
Manuel Pégourié-Gonnard27716cc2015-06-17 11:49:39 +0200369 * \note The restrictions on keys (RSA minimum size, allowed curves
Manuel Pégourié-Gonnard65eefc82015-10-23 14:08:48 +0200370 * for ECDSA) apply to all certificates: trusted root,
371 * intermediate CAs if any, and end entity certificate.
Manuel Pégourié-Gonnard27716cc2015-06-17 11:49:39 +0200372 *
Manuel Pégourié-Gonnardeeef9472016-02-22 11:36:55 +0100373 * \param crt a certificate (chain) to be verified
374 * \param trust_ca the list of trusted CAs
375 * \param ca_crl the list of CRLs for trusted CAs
Manuel Pégourié-Gonnard95051642015-06-15 10:39:46 +0200376 * \param profile security profile for verification
377 * \param cn expected Common Name (can be set to
378 * NULL if the CN must not be verified)
379 * \param flags result of the verification
380 * \param f_vrfy verification function
381 * \param p_vrfy verification parameter
382 *
383 * \return 0 if successful or MBEDTLS_ERR_X509_CERT_VERIFY_FAILED
384 * in which case *flags will have one or more
385 * MBEDTLS_X509_BADCERT_XXX or MBEDTLS_X509_BADCRL_XXX flags
386 * set,
387 * or another error in case of a fatal error encountered
388 * during the verification process.
389 */
390int mbedtls_x509_crt_verify_with_profile( mbedtls_x509_crt *crt,
391 mbedtls_x509_crt *trust_ca,
392 mbedtls_x509_crl *ca_crl,
393 const mbedtls_x509_crt_profile *profile,
394 const char *cn, uint32_t *flags,
395 int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *),
396 void *p_vrfy );
397
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200398#if defined(MBEDTLS_X509_CHECK_KEY_USAGE)
Manuel Pégourié-Gonnard603116c2014-04-09 09:50:03 +0200399/**
400 * \brief Check usage of certificate against keyUsage extension.
401 *
402 * \param crt Leaf certificate used.
Manuel Pégourié-Gonnard655a9642015-06-23 10:48:44 +0200403 * \param usage Intended usage(s) (eg MBEDTLS_X509_KU_KEY_ENCIPHERMENT
404 * before using the certificate to perform an RSA key
405 * exchange).
406 *
407 * \note Except for decipherOnly and encipherOnly, a bit set in the
408 * usage argument means this bit MUST be set in the
409 * certificate. For decipherOnly and encipherOnly, it means
410 * that bit MAY be set.
Manuel Pégourié-Gonnard603116c2014-04-09 09:50:03 +0200411 *
412 * \return 0 is these uses of the certificate are allowed,
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200413 * MBEDTLS_ERR_X509_BAD_INPUT_DATA if the keyUsage extension
Manuel Pégourié-Gonnard655a9642015-06-23 10:48:44 +0200414 * is present but does not match the usage argument.
Manuel Pégourié-Gonnard603116c2014-04-09 09:50:03 +0200415 *
416 * \note You should only call this function on leaf certificates, on
417 * (intermediate) CAs the keyUsage extension is automatically
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200418 * checked by \c mbedtls_x509_crt_verify().
Manuel Pégourié-Gonnard603116c2014-04-09 09:50:03 +0200419 */
Manuel Pégourié-Gonnard655a9642015-06-23 10:48:44 +0200420int mbedtls_x509_crt_check_key_usage( const mbedtls_x509_crt *crt,
421 unsigned int usage );
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200422#endif /* MBEDTLS_X509_CHECK_KEY_USAGE) */
Manuel Pégourié-Gonnard603116c2014-04-09 09:50:03 +0200423
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200424#if defined(MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE)
Manuel Pégourié-Gonnard7afb8a02014-04-10 17:53:56 +0200425/**
Andres Amaya Garcia5a6da632017-11-14 21:40:51 +0000426 * \brief Check usage of certificate against extendedKeyUsage.
Manuel Pégourié-Gonnard7afb8a02014-04-10 17:53:56 +0200427 *
Andres Amaya Garcia5a6da632017-11-14 21:40:51 +0000428 * \param crt Leaf certificate used.
429 * \param usage_oid Intended usage (eg MBEDTLS_OID_SERVER_AUTH or
430 * MBEDTLS_OID_CLIENT_AUTH).
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200431 * \param usage_len Length of usage_oid (eg given by MBEDTLS_OID_SIZE()).
Manuel Pégourié-Gonnard7afb8a02014-04-10 17:53:56 +0200432 *
Andres Amaya Garcia5a6da632017-11-14 21:40:51 +0000433 * \return 0 if this use of the certificate is allowed,
434 * MBEDTLS_ERR_X509_BAD_INPUT_DATA if not.
Manuel Pégourié-Gonnard7afb8a02014-04-10 17:53:56 +0200435 *
Andres Amaya Garcia5a6da632017-11-14 21:40:51 +0000436 * \note Usually only makes sense on leaf certificates.
Manuel Pégourié-Gonnard7afb8a02014-04-10 17:53:56 +0200437 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200438int mbedtls_x509_crt_check_extended_key_usage( const mbedtls_x509_crt *crt,
Andres Amaya Garcia5a6da632017-11-14 21:40:51 +0000439 const char *usage_oid,
440 size_t usage_len );
Andres Amaya Garciac81fcb92017-11-14 21:40:02 +0000441#endif /* MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE */
Manuel Pégourié-Gonnard7afb8a02014-04-10 17:53:56 +0200442
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200443#if defined(MBEDTLS_X509_CRL_PARSE_C)
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200444/**
Manuel Pégourié-Gonnardcbf3ef32013-09-23 12:20:02 +0200445 * \brief Verify the certificate revocation status
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200446 *
447 * \param crt a certificate to be verified
448 * \param crl the CRL to verify against
449 *
450 * \return 1 if the certificate is revoked, 0 otherwise
451 *
452 */
Manuel Pégourié-Gonnardc730ed32015-06-02 10:38:50 +0100453int mbedtls_x509_crt_is_revoked( const mbedtls_x509_crt *crt, const mbedtls_x509_crl *crl );
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200454#endif /* MBEDTLS_X509_CRL_PARSE_C */
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200455
456/**
Paul Bakker369d2eb2013-09-18 11:58:25 +0200457 * \brief Initialize a certificate (chain)
458 *
459 * \param crt Certificate chain to initialize
460 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200461void mbedtls_x509_crt_init( mbedtls_x509_crt *crt );
Paul Bakker369d2eb2013-09-18 11:58:25 +0200462
463/**
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200464 * \brief Unallocate all certificate data
465 *
466 * \param crt Certificate chain to free
467 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200468void mbedtls_x509_crt_free( mbedtls_x509_crt *crt );
469#endif /* MBEDTLS_X509_CRT_PARSE_C */
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200470
471/* \} name */
472/* \} addtogroup x509_module */
473
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200474#if defined(MBEDTLS_X509_CRT_WRITE_C)
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200475/**
476 * \brief Initialize a CRT writing context
477 *
478 * \param ctx CRT context to initialize
479 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200480void mbedtls_x509write_crt_init( mbedtls_x509write_cert *ctx );
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200481
482/**
483 * \brief Set the verion for a Certificate
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200484 * Default: MBEDTLS_X509_CRT_VERSION_3
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200485 *
486 * \param ctx CRT context to use
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200487 * \param version version to set (MBEDTLS_X509_CRT_VERSION_1, MBEDTLS_X509_CRT_VERSION_2 or
488 * MBEDTLS_X509_CRT_VERSION_3)
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200489 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200490void mbedtls_x509write_crt_set_version( mbedtls_x509write_cert *ctx, int version );
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200491
492/**
493 * \brief Set the serial number for a Certificate.
494 *
495 * \param ctx CRT context to use
496 * \param serial serial number to set
497 *
498 * \return 0 if successful
499 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200500int mbedtls_x509write_crt_set_serial( mbedtls_x509write_cert *ctx, const mbedtls_mpi *serial );
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200501
502/**
503 * \brief Set the validity period for a Certificate
504 * Timestamps should be in string format for UTC timezone
505 * i.e. "YYYYMMDDhhmmss"
506 * e.g. "20131231235959" for December 31st 2013
507 * at 23:59:59
508 *
509 * \param ctx CRT context to use
510 * \param not_before not_before timestamp
511 * \param not_after not_after timestamp
512 *
513 * \return 0 if timestamp was parsed successfully, or
514 * a specific error code
515 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200516int mbedtls_x509write_crt_set_validity( mbedtls_x509write_cert *ctx, const char *not_before,
Paul Bakker50dc8502013-10-28 21:19:10 +0100517 const char *not_after );
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200518
519/**
520 * \brief Set the issuer name for a Certificate
521 * Issuer names should contain a comma-separated list
522 * of OID types and values:
Manuel Pégourié-Gonnardb4fe3cb2015-01-22 16:11:05 +0000523 * e.g. "C=UK,O=ARM,CN=mbed TLS CA"
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200524 *
525 * \param ctx CRT context to use
526 * \param issuer_name issuer name to set
527 *
528 * \return 0 if issuer name was parsed successfully, or
529 * a specific error code
530 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200531int mbedtls_x509write_crt_set_issuer_name( mbedtls_x509write_cert *ctx,
Paul Bakker50dc8502013-10-28 21:19:10 +0100532 const char *issuer_name );
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200533
534/**
535 * \brief Set the subject name for a Certificate
536 * Subject names should contain a comma-separated list
537 * of OID types and values:
Manuel Pégourié-Gonnardb4fe3cb2015-01-22 16:11:05 +0000538 * e.g. "C=UK,O=ARM,CN=mbed TLS Server 1"
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200539 *
540 * \param ctx CRT context to use
541 * \param subject_name subject name to set
542 *
543 * \return 0 if subject name was parsed successfully, or
544 * a specific error code
545 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200546int mbedtls_x509write_crt_set_subject_name( mbedtls_x509write_cert *ctx,
Paul Bakker50dc8502013-10-28 21:19:10 +0100547 const char *subject_name );
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200548
549/**
550 * \brief Set the subject public key for the certificate
551 *
552 * \param ctx CRT context to use
553 * \param key public key to include
554 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200555void mbedtls_x509write_crt_set_subject_key( mbedtls_x509write_cert *ctx, mbedtls_pk_context *key );
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200556
557/**
558 * \brief Set the issuer key used for signing the certificate
559 *
560 * \param ctx CRT context to use
561 * \param key private key to sign with
562 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200563void mbedtls_x509write_crt_set_issuer_key( mbedtls_x509write_cert *ctx, mbedtls_pk_context *key );
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200564
565/**
566 * \brief Set the MD algorithm to use for the signature
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200567 * (e.g. MBEDTLS_MD_SHA1)
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200568 *
569 * \param ctx CRT context to use
Paul Bakkera36d23e2013-12-30 17:57:27 +0100570 * \param md_alg MD algorithm to use
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200571 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200572void mbedtls_x509write_crt_set_md_alg( mbedtls_x509write_cert *ctx, mbedtls_md_type_t md_alg );
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200573
574/**
575 * \brief Generic function to add to or replace an extension in the
576 * CRT
577 *
578 * \param ctx CRT context to use
579 * \param oid OID of the extension
580 * \param oid_len length of the OID
581 * \param critical if the extension is critical (per the RFC's definition)
582 * \param val value of the extension OCTET STRING
583 * \param val_len length of the value data
584 *
Manuel Pégourié-Gonnard6a8ca332015-05-28 09:33:39 +0200585 * \return 0 if successful, or a MBEDTLS_ERR_X509_ALLOC_FAILED
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200586 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200587int mbedtls_x509write_crt_set_extension( mbedtls_x509write_cert *ctx,
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200588 const char *oid, size_t oid_len,
589 int critical,
590 const unsigned char *val, size_t val_len );
591
592/**
593 * \brief Set the basicConstraints extension for a CRT
594 *
595 * \param ctx CRT context to use
596 * \param is_ca is this a CA certificate
597 * \param max_pathlen maximum length of certificate chains below this
598 * certificate (only for CA certificates, -1 is
599 * inlimited)
600 *
Manuel Pégourié-Gonnard6a8ca332015-05-28 09:33:39 +0200601 * \return 0 if successful, or a MBEDTLS_ERR_X509_ALLOC_FAILED
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200602 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200603int mbedtls_x509write_crt_set_basic_constraints( mbedtls_x509write_cert *ctx,
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200604 int is_ca, int max_pathlen );
605
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200606#if defined(MBEDTLS_SHA1_C)
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200607/**
608 * \brief Set the subjectKeyIdentifier extension for a CRT
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200609 * Requires that mbedtls_x509write_crt_set_subject_key() has been
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200610 * called before
611 *
612 * \param ctx CRT context to use
613 *
Manuel Pégourié-Gonnard6a8ca332015-05-28 09:33:39 +0200614 * \return 0 if successful, or a MBEDTLS_ERR_X509_ALLOC_FAILED
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200615 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200616int mbedtls_x509write_crt_set_subject_key_identifier( mbedtls_x509write_cert *ctx );
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200617
618/**
619 * \brief Set the authorityKeyIdentifier extension for a CRT
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200620 * Requires that mbedtls_x509write_crt_set_issuer_key() has been
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200621 * called before
622 *
623 * \param ctx CRT context to use
624 *
Manuel Pégourié-Gonnard6a8ca332015-05-28 09:33:39 +0200625 * \return 0 if successful, or a MBEDTLS_ERR_X509_ALLOC_FAILED
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200626 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200627int mbedtls_x509write_crt_set_authority_key_identifier( mbedtls_x509write_cert *ctx );
628#endif /* MBEDTLS_SHA1_C */
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200629
630/**
631 * \brief Set the Key Usage Extension flags
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200632 * (e.g. MBEDTLS_X509_KU_DIGITAL_SIGNATURE | MBEDTLS_X509_KU_KEY_CERT_SIGN)
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200633 *
634 * \param ctx CRT context to use
635 * \param key_usage key usage flags to set
636 *
Manuel Pégourié-Gonnard6a8ca332015-05-28 09:33:39 +0200637 * \return 0 if successful, or MBEDTLS_ERR_X509_ALLOC_FAILED
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200638 */
Manuel Pégourié-Gonnard1cd10ad2015-06-23 11:07:37 +0200639int mbedtls_x509write_crt_set_key_usage( mbedtls_x509write_cert *ctx,
640 unsigned int key_usage );
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200641
642/**
643 * \brief Set the Netscape Cert Type flags
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200644 * (e.g. MBEDTLS_X509_NS_CERT_TYPE_SSL_CLIENT | MBEDTLS_X509_NS_CERT_TYPE_EMAIL)
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200645 *
646 * \param ctx CRT context to use
647 * \param ns_cert_type Netscape Cert Type flags to set
648 *
Manuel Pégourié-Gonnard6a8ca332015-05-28 09:33:39 +0200649 * \return 0 if successful, or MBEDTLS_ERR_X509_ALLOC_FAILED
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200650 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200651int mbedtls_x509write_crt_set_ns_cert_type( mbedtls_x509write_cert *ctx,
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200652 unsigned char ns_cert_type );
653
654/**
655 * \brief Free the contents of a CRT write context
656 *
657 * \param ctx CRT context to free
658 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200659void mbedtls_x509write_crt_free( mbedtls_x509write_cert *ctx );
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200660
661/**
662 * \brief Write a built up certificate to a X509 DER structure
663 * Note: data is written at the end of the buffer! Use the
664 * return value to determine where you should start
665 * using the buffer
666 *
Paul Bakkera36d23e2013-12-30 17:57:27 +0100667 * \param ctx certificate to write away
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200668 * \param buf buffer to write to
669 * \param size size of the buffer
670 * \param f_rng RNG function (for signature, see note)
671 * \param p_rng RNG parameter
672 *
673 * \return length of data written if successful, or a specific
674 * error code
675 *
676 * \note f_rng may be NULL if RSA is used for signature and the
677 * signature is made offline (otherwise f_rng is desirable
678 * for countermeasures against timing attacks).
679 * ECDSA signatures always require a non-NULL f_rng.
680 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200681int mbedtls_x509write_crt_der( mbedtls_x509write_cert *ctx, unsigned char *buf, size_t size,
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200682 int (*f_rng)(void *, unsigned char *, size_t),
683 void *p_rng );
684
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200685#if defined(MBEDTLS_PEM_WRITE_C)
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200686/**
687 * \brief Write a built up certificate to a X509 PEM string
688 *
Paul Bakkera36d23e2013-12-30 17:57:27 +0100689 * \param ctx certificate to write away
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200690 * \param buf buffer to write to
691 * \param size size of the buffer
692 * \param f_rng RNG function (for signature, see note)
693 * \param p_rng RNG parameter
694 *
Manuel Pégourié-Gonnard81abefd2015-05-29 12:53:47 +0200695 * \return 0 if successful, or a specific error code
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200696 *
697 * \note f_rng may be NULL if RSA is used for signature and the
698 * signature is made offline (otherwise f_rng is desirable
699 * for countermeasures against timing attacks).
700 * ECDSA signatures always require a non-NULL f_rng.
701 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200702int mbedtls_x509write_crt_pem( mbedtls_x509write_cert *ctx, unsigned char *buf, size_t size,
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200703 int (*f_rng)(void *, unsigned char *, size_t),
704 void *p_rng );
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200705#endif /* MBEDTLS_PEM_WRITE_C */
706#endif /* MBEDTLS_X509_CRT_WRITE_C */
Paul Bakker7c6b2c32013-09-16 13:49:26 +0200707
708#ifdef __cplusplus
709}
710#endif
711
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200712#endif /* mbedtls_x509_crt.h */