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