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