1/**
2 * \file certs.h
3 *
4 * \brief Sample certificates and DHM parameters for testing
5 */
6/*
7 * Copyright The Mbed TLS Contributors
8 * SPDX-License-Identifier: Apache-2.0
9 *
10 * Licensed under the Apache License, Version 2.0 (the "License"); you may
11 * not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
13 *
14 * http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
18 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 */
22#ifndef MBEDTLS_CERTS_H
23#define MBEDTLS_CERTS_H
24
25#if !defined(MBEDTLS_CONFIG_FILE)
26#include "mbedtls/config.h"
27#else
28#include MBEDTLS_CONFIG_FILE
29#endif
30
31#include <stddef.h>
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37/* List of all PEM-encoded CA certificates, terminated by NULL;
38 * PEM encoded if MBEDTLS_PEM_PARSE_C is enabled, DER encoded
39 * otherwise. */
40extern const char *mbedtls_test_cas[];
41extern const size_t mbedtls_test_cas_len[];
42
43/* List of all DER-encoded CA certificates, terminated by NULL */
44extern const unsigned char *mbedtls_test_cas_der[];
45extern const size_t mbedtls_test_cas_der_len[];
46
47#if defined(MBEDTLS_PEM_PARSE_C)
48/* Concatenation of all CA certificates in PEM format if available */
49extern const char mbedtls_test_cas_pem[];
50extern const size_t mbedtls_test_cas_pem_len;
51#endif /* MBEDTLS_PEM_PARSE_C */
52
53/*
54 * CA test certificates
55 */
56
57extern const char mbedtls_test_ca_crt_ec_pem[];
58extern const char mbedtls_test_ca_key_ec_pem[];
59extern const char mbedtls_test_ca_pwd_ec_pem[];
60extern const char mbedtls_test_ca_key_rsa_pem[];
61extern const char mbedtls_test_ca_pwd_rsa_pem[];
62extern const char mbedtls_test_ca_crt_rsa_sha1_pem[];
63extern const char mbedtls_test_ca_crt_rsa_sha256_pem[];
64
65extern const unsigned char mbedtls_test_ca_crt_ec_der[];
66extern const unsigned char mbedtls_test_ca_key_ec_der[];
67extern const unsigned char mbedtls_test_ca_key_rsa_der[];
68extern const unsigned char mbedtls_test_ca_crt_rsa_sha1_der[];
69extern const unsigned char mbedtls_test_ca_crt_rsa_sha256_der[];
70
71extern const size_t mbedtls_test_ca_crt_ec_pem_len;
72extern const size_t mbedtls_test_ca_key_ec_pem_len;
73extern const size_t mbedtls_test_ca_pwd_ec_pem_len;
74extern const size_t mbedtls_test_ca_key_rsa_pem_len;
75extern const size_t mbedtls_test_ca_pwd_rsa_pem_len;
76extern const size_t mbedtls_test_ca_crt_rsa_sha1_pem_len;
77extern const size_t mbedtls_test_ca_crt_rsa_sha256_pem_len;
78
79extern const size_t mbedtls_test_ca_crt_ec_der_len;
80extern const size_t mbedtls_test_ca_key_ec_der_len;
81extern const size_t mbedtls_test_ca_pwd_ec_der_len;
82extern const size_t mbedtls_test_ca_key_rsa_der_len;
83extern const size_t mbedtls_test_ca_pwd_rsa_der_len;
84extern const size_t mbedtls_test_ca_crt_rsa_sha1_der_len;
85extern const size_t mbedtls_test_ca_crt_rsa_sha256_der_len;
86
87/* Config-dependent dispatch between PEM and DER encoding
88 * (PEM if enabled, otherwise DER) */
89
90extern const char mbedtls_test_ca_crt_ec[];
91extern const char mbedtls_test_ca_key_ec[];
92extern const char mbedtls_test_ca_pwd_ec[];
93extern const char mbedtls_test_ca_key_rsa[];
94extern const char mbedtls_test_ca_pwd_rsa[];
95extern const char mbedtls_test_ca_crt_rsa_sha1[];
96extern const char mbedtls_test_ca_crt_rsa_sha256[];
97
98extern const size_t mbedtls_test_ca_crt_ec_len;
99extern const size_t mbedtls_test_ca_key_ec_len;
100extern const size_t mbedtls_test_ca_pwd_ec_len;
101extern const size_t mbedtls_test_ca_key_rsa_len;
102extern const size_t mbedtls_test_ca_pwd_rsa_len;
103extern const size_t mbedtls_test_ca_crt_rsa_sha1_len;
104extern const size_t mbedtls_test_ca_crt_rsa_sha256_len;
105
106/* Config-dependent dispatch between SHA-1 and SHA-256
107 * (SHA-256 if enabled, otherwise SHA-1) */
108
109extern const char mbedtls_test_ca_crt_rsa[];
110extern const size_t mbedtls_test_ca_crt_rsa_len;
111
112/* Config-dependent dispatch between EC and RSA
113 * (RSA if enabled, otherwise EC) */
114
115extern const char *mbedtls_test_ca_crt;
116extern const char *mbedtls_test_ca_key;
117extern const char *mbedtls_test_ca_pwd;
118extern const size_t mbedtls_test_ca_crt_len;
119extern const size_t mbedtls_test_ca_key_len;
120extern const size_t mbedtls_test_ca_pwd_len;
121
122/*
123 * Server test certificates
124 */
125
126extern const char mbedtls_test_srv_crt_ec_pem[];
127extern const char mbedtls_test_srv_key_ec_pem[];
128extern const char mbedtls_test_srv_pwd_ec_pem[];
129extern const char mbedtls_test_srv_key_rsa_pem[];
130extern const char mbedtls_test_srv_pwd_rsa_pem[];
131extern const char mbedtls_test_srv_crt_rsa_sha1_pem[];
132extern const char mbedtls_test_srv_crt_rsa_sha256_pem[];
133
134extern const unsigned char mbedtls_test_srv_crt_ec_der[];
135extern const unsigned char mbedtls_test_srv_key_ec_der[];
136extern const unsigned char mbedtls_test_srv_key_rsa_der[];
137extern const unsigned char mbedtls_test_srv_crt_rsa_sha1_der[];
138extern const unsigned char mbedtls_test_srv_crt_rsa_sha256_der[];
139
140extern const size_t mbedtls_test_srv_crt_ec_pem_len;
141extern const size_t mbedtls_test_srv_key_ec_pem_len;
142extern const size_t mbedtls_test_srv_pwd_ec_pem_len;
143extern const size_t mbedtls_test_srv_key_rsa_pem_len;
144extern const size_t mbedtls_test_srv_pwd_rsa_pem_len;
145extern const size_t mbedtls_test_srv_crt_rsa_sha1_pem_len;
146extern const size_t mbedtls_test_srv_crt_rsa_sha256_pem_len;
147
148extern const size_t mbedtls_test_srv_crt_ec_der_len;
149extern const size_t mbedtls_test_srv_key_ec_der_len;
150extern const size_t mbedtls_test_srv_pwd_ec_der_len;
151extern const size_t mbedtls_test_srv_key_rsa_der_len;
152extern const size_t mbedtls_test_srv_pwd_rsa_der_len;
153extern const size_t mbedtls_test_srv_crt_rsa_sha1_der_len;
154extern const size_t mbedtls_test_srv_crt_rsa_sha256_der_len;
155
156/* Config-dependent dispatch between PEM and DER encoding
157 * (PEM if enabled, otherwise DER) */
158
159extern const char mbedtls_test_srv_crt_ec[];
160extern const char mbedtls_test_srv_key_ec[];
161extern const char mbedtls_test_srv_pwd_ec[];
162extern const char mbedtls_test_srv_key_rsa[];
163extern const char mbedtls_test_srv_pwd_rsa[];
164extern const char mbedtls_test_srv_crt_rsa_sha1[];
165extern const char mbedtls_test_srv_crt_rsa_sha256[];
166
167extern const size_t mbedtls_test_srv_crt_ec_len;
168extern const size_t mbedtls_test_srv_key_ec_len;
169extern const size_t mbedtls_test_srv_pwd_ec_len;
170extern const size_t mbedtls_test_srv_key_rsa_len;
171extern const size_t mbedtls_test_srv_pwd_rsa_len;
172extern const size_t mbedtls_test_srv_crt_rsa_sha1_len;
173extern const size_t mbedtls_test_srv_crt_rsa_sha256_len;
174
175/* Config-dependent dispatch between SHA-1 and SHA-256
176 * (SHA-256 if enabled, otherwise SHA-1) */
177
178extern const char mbedtls_test_srv_crt_rsa[];
179extern const size_t mbedtls_test_srv_crt_rsa_len;
180
181/* Config-dependent dispatch between EC and RSA
182 * (RSA if enabled, otherwise EC) */
183
184extern const char *mbedtls_test_srv_crt;
185extern const char *mbedtls_test_srv_key;
186extern const char *mbedtls_test_srv_pwd;
187extern const size_t mbedtls_test_srv_crt_len;
188extern const size_t mbedtls_test_srv_key_len;
189extern const size_t mbedtls_test_srv_pwd_len;
190
191/*
192 * Client test certificates
193 */
194
195extern const char mbedtls_test_cli_crt_ec_pem[];
196extern const char mbedtls_test_cli_key_ec_pem[];
197extern const char mbedtls_test_cli_pwd_ec_pem[];
198extern const char mbedtls_test_cli_key_rsa_pem[];
199extern const char mbedtls_test_cli_pwd_rsa_pem[];
200extern const char mbedtls_test_cli_crt_rsa_pem[];
201
202extern const unsigned char mbedtls_test_cli_crt_ec_der[];
203extern const unsigned char mbedtls_test_cli_key_ec_der[];
204extern const unsigned char mbedtls_test_cli_key_rsa_der[];
205extern const unsigned char mbedtls_test_cli_crt_rsa_der[];
206
207extern const size_t mbedtls_test_cli_crt_ec_pem_len;
208extern const size_t mbedtls_test_cli_key_ec_pem_len;
209extern const size_t mbedtls_test_cli_pwd_ec_pem_len;
210extern const size_t mbedtls_test_cli_key_rsa_pem_len;
211extern const size_t mbedtls_test_cli_pwd_rsa_pem_len;
212extern const size_t mbedtls_test_cli_crt_rsa_pem_len;
213
214extern const size_t mbedtls_test_cli_crt_ec_der_len;
215extern const size_t mbedtls_test_cli_key_ec_der_len;
216extern const size_t mbedtls_test_cli_key_rsa_der_len;
217extern const size_t mbedtls_test_cli_crt_rsa_der_len;
218
219/* Config-dependent dispatch between PEM and DER encoding
220 * (PEM if enabled, otherwise DER) */
221
222extern const char mbedtls_test_cli_crt_ec[];
223extern const char mbedtls_test_cli_key_ec[];
224extern const char mbedtls_test_cli_pwd_ec[];
225extern const char mbedtls_test_cli_key_rsa[];
226extern const char mbedtls_test_cli_pwd_rsa[];
227extern const char mbedtls_test_cli_crt_rsa[];
228
229extern const size_t mbedtls_test_cli_crt_ec_len;
230extern const size_t mbedtls_test_cli_key_ec_len;
231extern const size_t mbedtls_test_cli_pwd_ec_len;
232extern const size_t mbedtls_test_cli_key_rsa_len;
233extern const size_t mbedtls_test_cli_pwd_rsa_len;
234extern const size_t mbedtls_test_cli_crt_rsa_len;
235
236/* Config-dependent dispatch between EC and RSA
237 * (RSA if enabled, otherwise EC) */
238
239extern const char *mbedtls_test_cli_crt;
240extern const char *mbedtls_test_cli_key;
241extern const char *mbedtls_test_cli_pwd;
242extern const size_t mbedtls_test_cli_crt_len;
243extern const size_t mbedtls_test_cli_key_len;
244extern const size_t mbedtls_test_cli_pwd_len;
245
246#ifdef __cplusplus
247}
248#endif
249
250#endif /* certs.h */
251