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