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
34 extern "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. */
40 extern const char * mbedtls_test_cas[];
41 extern const size_t mbedtls_test_cas_len[];
42 
43 /* List of all DER-encoded CA certificates, terminated by NULL */
44 extern const unsigned char * mbedtls_test_cas_der[];
45 extern 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 */
49 extern const char   mbedtls_test_cas_pem[];
50 extern const size_t mbedtls_test_cas_pem_len;
51 #endif /* MBEDTLS_PEM_PARSE_C */
52 
53 /*
54  * CA test certificates
55  */
56 
57 extern const char mbedtls_test_ca_crt_ec_pem[];
58 extern const char mbedtls_test_ca_key_ec_pem[];
59 extern const char mbedtls_test_ca_pwd_ec_pem[];
60 extern const char mbedtls_test_ca_key_rsa_pem[];
61 extern const char mbedtls_test_ca_pwd_rsa_pem[];
62 extern const char mbedtls_test_ca_crt_rsa_sha1_pem[];
63 extern const char mbedtls_test_ca_crt_rsa_sha256_pem[];
64 
65 extern const unsigned char mbedtls_test_ca_crt_ec_der[];
66 extern const unsigned char mbedtls_test_ca_key_ec_der[];
67 extern const unsigned char mbedtls_test_ca_key_rsa_der[];
68 extern const unsigned char mbedtls_test_ca_crt_rsa_sha1_der[];
69 extern const unsigned char mbedtls_test_ca_crt_rsa_sha256_der[];
70 
71 extern const size_t mbedtls_test_ca_crt_ec_pem_len;
72 extern const size_t mbedtls_test_ca_key_ec_pem_len;
73 extern const size_t mbedtls_test_ca_pwd_ec_pem_len;
74 extern const size_t mbedtls_test_ca_key_rsa_pem_len;
75 extern const size_t mbedtls_test_ca_pwd_rsa_pem_len;
76 extern const size_t mbedtls_test_ca_crt_rsa_sha1_pem_len;
77 extern const size_t mbedtls_test_ca_crt_rsa_sha256_pem_len;
78 
79 extern const size_t mbedtls_test_ca_crt_ec_der_len;
80 extern const size_t mbedtls_test_ca_key_ec_der_len;
81 extern const size_t mbedtls_test_ca_pwd_ec_der_len;
82 extern const size_t mbedtls_test_ca_key_rsa_der_len;
83 extern const size_t mbedtls_test_ca_pwd_rsa_der_len;
84 extern const size_t mbedtls_test_ca_crt_rsa_sha1_der_len;
85 extern 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 
90 extern const char mbedtls_test_ca_crt_ec[];
91 extern const char mbedtls_test_ca_key_ec[];
92 extern const char mbedtls_test_ca_pwd_ec[];
93 extern const char mbedtls_test_ca_key_rsa[];
94 extern const char mbedtls_test_ca_pwd_rsa[];
95 extern const char mbedtls_test_ca_crt_rsa_sha1[];
96 extern const char mbedtls_test_ca_crt_rsa_sha256[];
97 
98 extern const size_t mbedtls_test_ca_crt_ec_len;
99 extern const size_t mbedtls_test_ca_key_ec_len;
100 extern const size_t mbedtls_test_ca_pwd_ec_len;
101 extern const size_t mbedtls_test_ca_key_rsa_len;
102 extern const size_t mbedtls_test_ca_pwd_rsa_len;
103 extern const size_t mbedtls_test_ca_crt_rsa_sha1_len;
104 extern 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 
109 extern const char mbedtls_test_ca_crt_rsa[];
110 extern 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 
115 extern const char * mbedtls_test_ca_crt;
116 extern const char * mbedtls_test_ca_key;
117 extern const char * mbedtls_test_ca_pwd;
118 extern const size_t mbedtls_test_ca_crt_len;
119 extern const size_t mbedtls_test_ca_key_len;
120 extern const size_t mbedtls_test_ca_pwd_len;
121 
122 /*
123  * Server test certificates
124  */
125 
126 extern const char mbedtls_test_srv_crt_ec_pem[];
127 extern const char mbedtls_test_srv_key_ec_pem[];
128 extern const char mbedtls_test_srv_pwd_ec_pem[];
129 extern const char mbedtls_test_srv_key_rsa_pem[];
130 extern const char mbedtls_test_srv_pwd_rsa_pem[];
131 extern const char mbedtls_test_srv_crt_rsa_sha1_pem[];
132 extern const char mbedtls_test_srv_crt_rsa_sha256_pem[];
133 
134 extern const unsigned char mbedtls_test_srv_crt_ec_der[];
135 extern const unsigned char mbedtls_test_srv_key_ec_der[];
136 extern const unsigned char mbedtls_test_srv_key_rsa_der[];
137 extern const unsigned char mbedtls_test_srv_crt_rsa_sha1_der[];
138 extern const unsigned char mbedtls_test_srv_crt_rsa_sha256_der[];
139 
140 extern const size_t mbedtls_test_srv_crt_ec_pem_len;
141 extern const size_t mbedtls_test_srv_key_ec_pem_len;
142 extern const size_t mbedtls_test_srv_pwd_ec_pem_len;
143 extern const size_t mbedtls_test_srv_key_rsa_pem_len;
144 extern const size_t mbedtls_test_srv_pwd_rsa_pem_len;
145 extern const size_t mbedtls_test_srv_crt_rsa_sha1_pem_len;
146 extern const size_t mbedtls_test_srv_crt_rsa_sha256_pem_len;
147 
148 extern const size_t mbedtls_test_srv_crt_ec_der_len;
149 extern const size_t mbedtls_test_srv_key_ec_der_len;
150 extern const size_t mbedtls_test_srv_pwd_ec_der_len;
151 extern const size_t mbedtls_test_srv_key_rsa_der_len;
152 extern const size_t mbedtls_test_srv_pwd_rsa_der_len;
153 extern const size_t mbedtls_test_srv_crt_rsa_sha1_der_len;
154 extern 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 
159 extern const char mbedtls_test_srv_crt_ec[];
160 extern const char mbedtls_test_srv_key_ec[];
161 extern const char mbedtls_test_srv_pwd_ec[];
162 extern const char mbedtls_test_srv_key_rsa[];
163 extern const char mbedtls_test_srv_pwd_rsa[];
164 extern const char mbedtls_test_srv_crt_rsa_sha1[];
165 extern const char mbedtls_test_srv_crt_rsa_sha256[];
166 
167 extern const size_t mbedtls_test_srv_crt_ec_len;
168 extern const size_t mbedtls_test_srv_key_ec_len;
169 extern const size_t mbedtls_test_srv_pwd_ec_len;
170 extern const size_t mbedtls_test_srv_key_rsa_len;
171 extern const size_t mbedtls_test_srv_pwd_rsa_len;
172 extern const size_t mbedtls_test_srv_crt_rsa_sha1_len;
173 extern 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 
178 extern const char mbedtls_test_srv_crt_rsa[];
179 extern 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 
184 extern const char * mbedtls_test_srv_crt;
185 extern const char * mbedtls_test_srv_key;
186 extern const char * mbedtls_test_srv_pwd;
187 extern const size_t mbedtls_test_srv_crt_len;
188 extern const size_t mbedtls_test_srv_key_len;
189 extern const size_t mbedtls_test_srv_pwd_len;
190 
191 /*
192  * Client test certificates
193  */
194 
195 extern const char mbedtls_test_cli_crt_ec_pem[];
196 extern const char mbedtls_test_cli_key_ec_pem[];
197 extern const char mbedtls_test_cli_pwd_ec_pem[];
198 extern const char mbedtls_test_cli_key_rsa_pem[];
199 extern const char mbedtls_test_cli_pwd_rsa_pem[];
200 extern const char mbedtls_test_cli_crt_rsa_pem[];
201 
202 extern const unsigned char mbedtls_test_cli_crt_ec_der[];
203 extern const unsigned char mbedtls_test_cli_key_ec_der[];
204 extern const unsigned char mbedtls_test_cli_key_rsa_der[];
205 extern const unsigned char mbedtls_test_cli_crt_rsa_der[];
206 
207 extern const size_t mbedtls_test_cli_crt_ec_pem_len;
208 extern const size_t mbedtls_test_cli_key_ec_pem_len;
209 extern const size_t mbedtls_test_cli_pwd_ec_pem_len;
210 extern const size_t mbedtls_test_cli_key_rsa_pem_len;
211 extern const size_t mbedtls_test_cli_pwd_rsa_pem_len;
212 extern const size_t mbedtls_test_cli_crt_rsa_pem_len;
213 
214 extern const size_t mbedtls_test_cli_crt_ec_der_len;
215 extern const size_t mbedtls_test_cli_key_ec_der_len;
216 extern const size_t mbedtls_test_cli_key_rsa_der_len;
217 extern 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 
222 extern const char mbedtls_test_cli_crt_ec[];
223 extern const char mbedtls_test_cli_key_ec[];
224 extern const char mbedtls_test_cli_pwd_ec[];
225 extern const char mbedtls_test_cli_key_rsa[];
226 extern const char mbedtls_test_cli_pwd_rsa[];
227 extern const char mbedtls_test_cli_crt_rsa[];
228 
229 extern const size_t mbedtls_test_cli_crt_ec_len;
230 extern const size_t mbedtls_test_cli_key_ec_len;
231 extern const size_t mbedtls_test_cli_pwd_ec_len;
232 extern const size_t mbedtls_test_cli_key_rsa_len;
233 extern const size_t mbedtls_test_cli_pwd_rsa_len;
234 extern 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 
239 extern const char * mbedtls_test_cli_crt;
240 extern const char * mbedtls_test_cli_key;
241 extern const char * mbedtls_test_cli_pwd;
242 extern const size_t mbedtls_test_cli_crt_len;
243 extern const size_t mbedtls_test_cli_key_len;
244 extern const size_t mbedtls_test_cli_pwd_len;
245 
246 #ifdef __cplusplus
247 }
248 #endif
249 
250 #endif /* certs.h */
251