x509_common.h
Go to the documentation of this file.
1 /**
2  * @file x509_common.h
3  * @brief X.509 common definitions
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2026 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneCRYPTO Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.6.4
29  **/
30 
31 #ifndef _X509_COMMON_H
32 #define _X509_COMMON_H
33 
34 //Dependencies
35 #include "core/crypto.h"
36 #include "pkc/sign_algorithms.h"
37 #include "pkc/rsa.h"
38 #include "pkc/dsa.h"
39 #include "ecc/ecdsa.h"
40 #include "ecc/eddsa.h"
41 #include "pqc/mldsa.h"
42 #include "date_time.h"
43 
44 //Signature generation/verification callback functions
45 #ifndef X509_SIGN_CALLBACK_SUPPORT
46  #define X509_SIGN_CALLBACK_SUPPORT DISABLED
47 #elif (X509_SIGN_CALLBACK_SUPPORT != ENABLED && X509_SIGN_CALLBACK_SUPPORT != DISABLED)
48  #error X509_SIGN_CALLBACK_SUPPORT parameter is not valid
49 #endif
50 
51 //RSA signature support
52 #ifndef X509_RSA_SUPPORT
53  #define X509_RSA_SUPPORT ENABLED
54 #elif (X509_RSA_SUPPORT != ENABLED && X509_RSA_SUPPORT != DISABLED)
55  #error X509_RSA_SUPPORT parameter is not valid
56 #endif
57 
58 //RSA-PSS signature support
59 #ifndef X509_RSA_PSS_SUPPORT
60  #define X509_RSA_PSS_SUPPORT DISABLED
61 #elif (X509_RSA_PSS_SUPPORT != ENABLED && X509_RSA_PSS_SUPPORT != DISABLED)
62  #error X509_RSA_PSS_SUPPORT parameter is not valid
63 #endif
64 
65 //DSA signature support
66 #ifndef X509_DSA_SUPPORT
67  #define X509_DSA_SUPPORT DISABLED
68 #elif (X509_DSA_SUPPORT != ENABLED && X509_DSA_SUPPORT != DISABLED)
69  #error X509_DSA_SUPPORT parameter is not valid
70 #endif
71 
72 //ECDSA signature support
73 #ifndef X509_ECDSA_SUPPORT
74  #define X509_ECDSA_SUPPORT ENABLED
75 #elif (X509_ECDSA_SUPPORT != ENABLED && X509_ECDSA_SUPPORT != DISABLED)
76  #error X509_ECDSA_SUPPORT parameter is not valid
77 #endif
78 
79 //SM2 signature support
80 #ifndef X509_SM2_SUPPORT
81  #define X509_SM2_SUPPORT DISABLED
82 #elif (X509_SM2_SUPPORT != ENABLED && X509_SM2_SUPPORT != DISABLED)
83  #error X509_SM2_SUPPORT parameter is not valid
84 #endif
85 
86 //Ed25519 signature support
87 #ifndef X509_ED25519_SUPPORT
88  #define X509_ED25519_SUPPORT DISABLED
89 #elif (X509_ED25519_SUPPORT != ENABLED && X509_ED25519_SUPPORT != DISABLED)
90  #error X509_ED25519_SUPPORT parameter is not valid
91 #endif
92 
93 //Ed448 signature support
94 #ifndef X509_ED448_SUPPORT
95  #define X509_ED448_SUPPORT DISABLED
96 #elif (X509_ED448_SUPPORT != ENABLED && X509_ED448_SUPPORT != DISABLED)
97  #error X509_ED448_SUPPORT parameter is not valid
98 #endif
99 
100 //ML-DSA-44 signature support
101 #ifndef X509_MLDSA44_SUPPORT
102  #define X509_MLDSA44_SUPPORT DISABLED
103 #elif (X509_MLDSA44_SUPPORT != ENABLED && X509_MLDSA44_SUPPORT != DISABLED)
104  #error X509_MLDSA44_SUPPORT parameter is not valid
105 #endif
106 
107 //ML-DSA-65 signature support
108 #ifndef X509_MLDSA65_SUPPORT
109  #define X509_MLDSA65_SUPPORT DISABLED
110 #elif (X509_MLDSA65_SUPPORT != ENABLED && X509_MLDSA65_SUPPORT != DISABLED)
111  #error X509_MLDSA65_SUPPORT parameter is not valid
112 #endif
113 
114 //ML-DSA-87 signature support
115 #ifndef X509_MLDSA87_SUPPORT
116  #define X509_MLDSA87_SUPPORT DISABLED
117 #elif (X509_MLDSA87_SUPPORT != ENABLED && X509_MLDSA87_SUPPORT != DISABLED)
118  #error X509_MLDSA87_SUPPORT parameter is not valid
119 #endif
120 
121 //MD5 hash support (insecure)
122 #ifndef X509_MD5_SUPPORT
123  #define X509_MD5_SUPPORT DISABLED
124 #elif (X509_MD5_SUPPORT != ENABLED && X509_MD5_SUPPORT != DISABLED)
125  #error X509_MD5_SUPPORT parameter is not valid
126 #endif
127 
128 //SHA-1 hash support (weak)
129 #ifndef X509_SHA1_SUPPORT
130  #define X509_SHA1_SUPPORT DISABLED
131 #elif (X509_SHA1_SUPPORT != ENABLED && X509_SHA1_SUPPORT != DISABLED)
132  #error X509_SHA1_SUPPORT parameter is not valid
133 #endif
134 
135 //SHA-224 hash support (weak)
136 #ifndef X509_SHA224_SUPPORT
137  #define X509_SHA224_SUPPORT DISABLED
138 #elif (X509_SHA224_SUPPORT != ENABLED && X509_SHA224_SUPPORT != DISABLED)
139  #error X509_SHA224_SUPPORT parameter is not valid
140 #endif
141 
142 //SHA-256 hash support
143 #ifndef X509_SHA256_SUPPORT
144  #define X509_SHA256_SUPPORT ENABLED
145 #elif (X509_SHA256_SUPPORT != ENABLED && X509_SHA256_SUPPORT != DISABLED)
146  #error X509_SHA256_SUPPORT parameter is not valid
147 #endif
148 
149 //SHA-384 hash support
150 #ifndef X509_SHA384_SUPPORT
151  #define X509_SHA384_SUPPORT ENABLED
152 #elif (X509_SHA384_SUPPORT != ENABLED && X509_SHA384_SUPPORT != DISABLED)
153  #error X509_SHA384_SUPPORT parameter is not valid
154 #endif
155 
156 //SHA-512 hash support
157 #ifndef X509_SHA512_SUPPORT
158  #define X509_SHA512_SUPPORT ENABLED
159 #elif (X509_SHA512_SUPPORT != ENABLED && X509_SHA512_SUPPORT != DISABLED)
160  #error X509_SHA512_SUPPORT parameter is not valid
161 #endif
162 
163 //SHA3-224 hash support
164 #ifndef X509_SHA3_224_SUPPORT
165  #define X509_SHA3_224_SUPPORT DISABLED
166 #elif (X509_SHA3_224_SUPPORT != ENABLED && X509_SHA3_224_SUPPORT != DISABLED)
167  #error X509_SHA3_224_SUPPORT parameter is not valid
168 #endif
169 
170 //SHA3-256 hash support
171 #ifndef X509_SHA3_256_SUPPORT
172  #define X509_SHA3_256_SUPPORT DISABLED
173 #elif (X509_SHA3_256_SUPPORT != ENABLED && X509_SHA3_256_SUPPORT != DISABLED)
174  #error X509_SHA3_256_SUPPORT parameter is not valid
175 #endif
176 
177 //SHA3-384 hash support
178 #ifndef X509_SHA3_384_SUPPORT
179  #define X509_SHA3_384_SUPPORT DISABLED
180 #elif (X509_SHA3_384_SUPPORT != ENABLED && X509_SHA3_384_SUPPORT != DISABLED)
181  #error X509_SHA3_384_SUPPORT parameter is not valid
182 #endif
183 
184 //SHA3-512 hash support
185 #ifndef X509_SHA3_512_SUPPORT
186  #define X509_SHA3_512_SUPPORT DISABLED
187 #elif (X509_SHA3_512_SUPPORT != ENABLED && X509_SHA3_512_SUPPORT != DISABLED)
188  #error X509_SHA3_512_SUPPORT parameter is not valid
189 #endif
190 
191 //SM3 hash support
192 #ifndef X509_SM3_SUPPORT
193  #define X509_SM3_SUPPORT DISABLED
194 #elif (X509_SM3_SUPPORT != ENABLED && X509_SM3_SUPPORT != DISABLED)
195  #error X509_SM3_SUPPORT parameter is not valid
196 #endif
197 
198 //secp112r1 elliptic curve support (weak)
199 #ifndef X509_SECP112R1_SUPPORT
200  #define X509_SECP112R1_SUPPORT DISABLED
201 #elif (X509_SECP112R1_SUPPORT != ENABLED && X509_SECP112R1_SUPPORT != DISABLED)
202  #error X509_SECP112R1_SUPPORT parameter is not valid
203 #endif
204 
205 //secp112r2 elliptic curve support (weak)
206 #ifndef X509_SECP112R2_SUPPORT
207  #define X509_SECP112R2_SUPPORT DISABLED
208 #elif (X509_SECP112R2_SUPPORT != ENABLED && X509_SECP112R2_SUPPORT != DISABLED)
209  #error X509_SECP112R2_SUPPORT parameter is not valid
210 #endif
211 
212 //secp128r1 elliptic curve support (weak)
213 #ifndef X509_SECP128R1_SUPPORT
214  #define X509_SECP128R1_SUPPORT DISABLED
215 #elif (X509_SECP128R1_SUPPORT != ENABLED && X509_SECP128R1_SUPPORT != DISABLED)
216  #error X509_SECP128R1_SUPPORT parameter is not valid
217 #endif
218 
219 //secp128r2 elliptic curve support (weak)
220 #ifndef X509_SECP128R2_SUPPORT
221  #define X509_SECP128R2_SUPPORT DISABLED
222 #elif (X509_SECP128R2_SUPPORT != ENABLED && X509_SECP128R2_SUPPORT != DISABLED)
223  #error X509_SECP128R2_SUPPORT parameter is not valid
224 #endif
225 
226 //secp160k1 elliptic curve support (weak)
227 #ifndef X509_SECP160K1_SUPPORT
228  #define X509_SECP160K1_SUPPORT DISABLED
229 #elif (X509_SECP160K1_SUPPORT != ENABLED && X509_SECP160K1_SUPPORT != DISABLED)
230  #error X509_SECP160K1_SUPPORT parameter is not valid
231 #endif
232 
233 //secp160r1 elliptic curve support (weak)
234 #ifndef X509_SECP160R1_SUPPORT
235  #define X509_SECP160R1_SUPPORT DISABLED
236 #elif (X509_SECP160R1_SUPPORT != ENABLED && X509_SECP160R1_SUPPORT != DISABLED)
237  #error X509_SECP160R1_SUPPORT parameter is not valid
238 #endif
239 
240 //secp160r2 elliptic curve support (weak)
241 #ifndef X509_SECP160R2_SUPPORT
242  #define X509_SECP160R2_SUPPORT DISABLED
243 #elif (X509_SECP160R2_SUPPORT != ENABLED && X509_SECP160R2_SUPPORT != DISABLED)
244  #error X509_SECP160R2_SUPPORT parameter is not valid
245 #endif
246 
247 //secp192k1 elliptic curve support
248 #ifndef X509_SECP192K1_SUPPORT
249  #define X509_SECP192K1_SUPPORT DISABLED
250 #elif (X509_SECP192K1_SUPPORT != ENABLED && X509_SECP192K1_SUPPORT != DISABLED)
251  #error X509_SECP192K1_SUPPORT parameter is not valid
252 #endif
253 
254 //secp192r1 elliptic curve support (NIST P-192)
255 #ifndef X509_SECP192R1_SUPPORT
256  #define X509_SECP192R1_SUPPORT DISABLED
257 #elif (X509_SECP192R1_SUPPORT != ENABLED && X509_SECP192R1_SUPPORT != DISABLED)
258  #error X509_SECP192R1_SUPPORT parameter is not valid
259 #endif
260 
261 //secp224k1 elliptic curve support
262 #ifndef X509_SECP224K1_SUPPORT
263  #define X509_SECP224K1_SUPPORT DISABLED
264 #elif (X509_SECP224K1_SUPPORT != ENABLED && X509_SECP224K1_SUPPORT != DISABLED)
265  #error X509_SECP224K1_SUPPORT parameter is not valid
266 #endif
267 
268 //secp224r1 elliptic curve support (NIST P-224)
269 #ifndef X509_SECP224R1_SUPPORT
270  #define X509_SECP224R1_SUPPORT DISABLED
271 #elif (X509_SECP224R1_SUPPORT != ENABLED && X509_SECP224R1_SUPPORT != DISABLED)
272  #error X509_SECP224R1_SUPPORT parameter is not valid
273 #endif
274 
275 //secp256k1 elliptic curve support
276 #ifndef X509_SECP256K1_SUPPORT
277  #define X509_SECP256K1_SUPPORT DISABLED
278 #elif (X509_SECP256K1_SUPPORT != ENABLED && X509_SECP256K1_SUPPORT != DISABLED)
279  #error X509_SECP256K1_SUPPORT parameter is not valid
280 #endif
281 
282 //secp256r1 elliptic curve support (NIST P-256)
283 #ifndef X509_SECP256R1_SUPPORT
284  #define X509_SECP256R1_SUPPORT ENABLED
285 #elif (X509_SECP256R1_SUPPORT != ENABLED && X509_SECP256R1_SUPPORT != DISABLED)
286  #error X509_SECP256R1_SUPPORT parameter is not valid
287 #endif
288 
289 //secp384r1 elliptic curve support (NIST P-384)
290 #ifndef X509_SECP384R1_SUPPORT
291  #define X509_SECP384R1_SUPPORT ENABLED
292 #elif (X509_SECP384R1_SUPPORT != ENABLED && X509_SECP384R1_SUPPORT != DISABLED)
293  #error X509_SECP384R1_SUPPORT parameter is not valid
294 #endif
295 
296 //secp521r1 elliptic curve support (NIST P-521)
297 #ifndef X509_SECP521R1_SUPPORT
298  #define X509_SECP521R1_SUPPORT ENABLED
299 #elif (X509_SECP521R1_SUPPORT != ENABLED && X509_SECP521R1_SUPPORT != DISABLED)
300  #error X509_SECP521R1_SUPPORT parameter is not valid
301 #endif
302 
303 //brainpoolP160r1 elliptic curve support
304 #ifndef X509_BRAINPOOLP160R1_SUPPORT
305  #define X509_BRAINPOOLP160R1_SUPPORT DISABLED
306 #elif (X509_BRAINPOOLP160R1_SUPPORT != ENABLED && X509_BRAINPOOLP160R1_SUPPORT != DISABLED)
307  #error X509_BRAINPOOLP160R1_SUPPORT parameter is not valid
308 #endif
309 
310 //brainpoolP160t1 elliptic curve support
311 #ifndef X509_BRAINPOOLP160T1_SUPPORT
312  #define X509_BRAINPOOLP160T1_SUPPORT DISABLED
313 #elif (X509_BRAINPOOLP160T1_SUPPORT != ENABLED && X509_BRAINPOOLP160T1_SUPPORT != DISABLED)
314  #error X509_BRAINPOOLP160T1_SUPPORT parameter is not valid
315 #endif
316 
317 //brainpoolP192r1 elliptic curve support
318 #ifndef X509_BRAINPOOLP192R1_SUPPORT
319  #define X509_BRAINPOOLP192R1_SUPPORT DISABLED
320 #elif (X509_BRAINPOOLP192R1_SUPPORT != ENABLED && X509_BRAINPOOLP192R1_SUPPORT != DISABLED)
321  #error X509_BRAINPOOLP192R1_SUPPORT parameter is not valid
322 #endif
323 
324 //brainpoolP192t1 elliptic curve support
325 #ifndef X509_BRAINPOOLP192T1_SUPPORT
326  #define X509_BRAINPOOLP192T1_SUPPORT DISABLED
327 #elif (X509_BRAINPOOLP192T1_SUPPORT != ENABLED && X509_BRAINPOOLP192T1_SUPPORT != DISABLED)
328  #error X509_BRAINPOOLP192T1_SUPPORT parameter is not valid
329 #endif
330 
331 //brainpoolP224r1 elliptic curve support
332 #ifndef X509_BRAINPOOLP224R1_SUPPORT
333  #define X509_BRAINPOOLP224R1_SUPPORT DISABLED
334 #elif (X509_BRAINPOOLP224R1_SUPPORT != ENABLED && X509_BRAINPOOLP224R1_SUPPORT != DISABLED)
335  #error X509_BRAINPOOLP224R1_SUPPORT parameter is not valid
336 #endif
337 
338 //brainpoolP224t1 elliptic curve support
339 #ifndef X509_BRAINPOOLP224T1_SUPPORT
340  #define X509_BRAINPOOLP224T1_SUPPORT DISABLED
341 #elif (X509_BRAINPOOLP224T1_SUPPORT != ENABLED && X509_BRAINPOOLP224T1_SUPPORT != DISABLED)
342  #error X509_BRAINPOOLP224T1_SUPPORT parameter is not valid
343 #endif
344 
345 //brainpoolP256r1 elliptic curve support
346 #ifndef X509_BRAINPOOLP256R1_SUPPORT
347  #define X509_BRAINPOOLP256R1_SUPPORT DISABLED
348 #elif (X509_BRAINPOOLP256R1_SUPPORT != ENABLED && X509_BRAINPOOLP256R1_SUPPORT != DISABLED)
349  #error X509_BRAINPOOLP256R1_SUPPORT parameter is not valid
350 #endif
351 
352 //brainpoolP256t1 elliptic curve support
353 #ifndef X509_BRAINPOOLP256T1_SUPPORT
354  #define X509_BRAINPOOLP256T1_SUPPORT DISABLED
355 #elif (X509_BRAINPOOLP256T1_SUPPORT != ENABLED && X509_BRAINPOOLP256T1_SUPPORT != DISABLED)
356  #error X509_BRAINPOOLP256T1_SUPPORT parameter is not valid
357 #endif
358 
359 //brainpoolP320r1 elliptic curve support
360 #ifndef X509_BRAINPOOLP320R1_SUPPORT
361  #define X509_BRAINPOOLP320R1_SUPPORT DISABLED
362 #elif (X509_BRAINPOOLP320R1_SUPPORT != ENABLED && X509_BRAINPOOLP320R1_SUPPORT != DISABLED)
363  #error X509_BRAINPOOLP320R1_SUPPORT parameter is not valid
364 #endif
365 //brainpoolP320t1 elliptic curve support
366 #ifndef X509_BRAINPOOLP320T1_SUPPORT
367  #define X509_BRAINPOOLP320T1_SUPPORT DISABLED
368 #elif (X509_BRAINPOOLP320T1_SUPPORT != ENABLED && X509_BRAINPOOLP320T1_SUPPORT != DISABLED)
369  #error X509_BRAINPOOLP320T1_SUPPORT parameter is not valid
370 #endif
371 
372 //brainpoolP384r1 elliptic curve support
373 #ifndef X509_BRAINPOOLP384R1_SUPPORT
374  #define X509_BRAINPOOLP384R1_SUPPORT DISABLED
375 #elif (X509_BRAINPOOLP384R1_SUPPORT != ENABLED && X509_BRAINPOOLP384R1_SUPPORT != DISABLED)
376  #error X509_BRAINPOOLP384R1_SUPPORT parameter is not valid
377 #endif
378 
379 //brainpoolP384t1 elliptic curve support
380 #ifndef X509_BRAINPOOLP384T1_SUPPORT
381  #define X509_BRAINPOOLP384T1_SUPPORT DISABLED
382 #elif (X509_BRAINPOOLP384T1_SUPPORT != ENABLED && X509_BRAINPOOLP384T1_SUPPORT != DISABLED)
383  #error X509_BRAINPOOLP384T1_SUPPORT parameter is not valid
384 #endif
385 
386 //brainpoolP512r1 elliptic curve support
387 #ifndef X509_BRAINPOOLP512R1_SUPPORT
388  #define X509_BRAINPOOLP512R1_SUPPORT DISABLED
389 #elif (X509_BRAINPOOLP512R1_SUPPORT != ENABLED && X509_BRAINPOOLP512R1_SUPPORT != DISABLED)
390  #error X509_BRAINPOOLP512R1_SUPPORT parameter is not valid
391 #endif
392 
393 //brainpoolP512t1 elliptic curve support
394 #ifndef X509_BRAINPOOLP512T1_SUPPORT
395  #define X509_BRAINPOOLP512T1_SUPPORT DISABLED
396 #elif (X509_BRAINPOOLP512T1_SUPPORT != ENABLED && X509_BRAINPOOLP512T1_SUPPORT != DISABLED)
397  #error X509_BRAINPOOLP512T1_SUPPORT parameter is not valid
398 #endif
399 
400 //FRP256v1 elliptic curve support
401 #ifndef X509_FRP256V1_SUPPORT
402  #define X509_FRP256V1_SUPPORT DISABLED
403 #elif (X509_FRP256V1_SUPPORT != ENABLED && X509_FRP256V1_SUPPORT != DISABLED)
404  #error X509_FRP256V1_SUPPORT parameter is not valid
405 #endif
406 
407 //Minimum acceptable size for RSA modulus
408 #ifndef X509_MIN_RSA_MODULUS_SIZE
409  #define X509_MIN_RSA_MODULUS_SIZE 1024
410 #elif (X509_MIN_RSA_MODULUS_SIZE < 512)
411  #error X509_MIN_RSA_MODULUS_SIZE parameter is not valid
412 #endif
413 
414 //Maximum acceptable size for RSA modulus
415 #ifndef X509_MAX_RSA_MODULUS_SIZE
416  #define X509_MAX_RSA_MODULUS_SIZE 4096
417 #elif (X509_MAX_RSA_MODULUS_SIZE < X509_MIN_RSA_MODULUS_SIZE)
418  #error X509_MAX_RSA_MODULUS_SIZE parameter is not valid
419 #endif
420 
421 //Minimum acceptable size for DSA prime modulus
422 #ifndef X509_MIN_DSA_MODULUS_SIZE
423  #define X509_MIN_DSA_MODULUS_SIZE 1024
424 #elif (X509_MIN_DSA_MODULUS_SIZE < 512)
425  #error X509_MIN_DSA_MODULUS_SIZE parameter is not valid
426 #endif
427 
428 //Maximum acceptable size for DSA prime modulus
429 #ifndef X509_MAX_DSA_MODULUS_SIZE
430  #define X509_MAX_DSA_MODULUS_SIZE 4096
431 #elif (X509_MAX_DSA_MODULUS_SIZE < X509_MIN_DSA_MODULUS_SIZE)
432  #error X509_MAX_DSA_MODULUS_SIZE parameter is not valid
433 #endif
434 
435 //Default size of serial numbers
436 #ifndef X509_SERIAL_NUMBER_SIZE
437  #define X509_SERIAL_NUMBER_SIZE 20
438 #elif (X509_SERIAL_NUMBER_SIZE < 1)
439  #error X509_SERIAL_NUMBER_SIZE parameter is not valid
440 #endif
441 
442 //Maximum number of domain components
443 #ifndef X509_MAX_DOMAIN_COMPONENTS
444  #define X509_MAX_DOMAIN_COMPONENTS 4
445 #elif (X509_MAX_DOMAIN_COMPONENTS < 1)
446  #error X509_MAX_DOMAIN_COMPONENTS parameter is not valid
447 #endif
448 
449 //Maximum number of subject alternative names
450 #ifndef X509_MAX_SUBJECT_ALT_NAMES
451  #define X509_MAX_SUBJECT_ALT_NAMES 4
452 #elif (X509_MAX_SUBJECT_ALT_NAMES < 1)
453  #error X509_MAX_SUBJECT_ALT_NAMES parameter is not valid
454 #endif
455 
456 //Maximum number of certificate issuers
457 #ifndef X509_MAX_CERT_ISSUERS
458  #define X509_MAX_CERT_ISSUERS 4
459 #elif (X509_MAX_CERT_ISSUERS < 1)
460  #error X509_MAX_CERT_ISSUERS parameter is not valid
461 #endif
462 
463 //Maximum number of CRL issuers
464 #ifndef X509_MAX_CRL_ISSUERS
465  #define X509_MAX_CRL_ISSUERS 2
466 #elif (X509_MAX_CRL_ISSUERS < 1)
467  #error X509_MAX_CRL_ISSUERS parameter is not valid
468 #endif
469 
470 //Maximum number of distribution points
471 #ifndef X509_MAX_DISTR_POINTS
472  #define X509_MAX_DISTR_POINTS 2
473 #elif (X509_MAX_DISTR_POINTS < 1)
474  #error X509_MAX_DISTR_POINTS parameter is not valid
475 #endif
476 
477 //Maximum number of full names
478 #ifndef X509_MAX_FULL_NAMES
479  #define X509_MAX_FULL_NAMES 2
480 #elif (X509_MAX_FULL_NAMES < 1)
481  #error X509_MAX_FULL_NAMES parameter is not valid
482 #endif
483 
484 //Maximum number of access descriptions
485 #ifndef X509_MAX_ACCESS_DESCRIPTIONS
486  #define X509_MAX_ACCESS_DESCRIPTIONS 2
487 #elif (X509_MAX_ACCESS_DESCRIPTIONS < 1)
488  #error X509_MAX_ACCESS_DESCRIPTIONS parameter is not valid
489 #endif
490 
491 //Maximum number of custom extensions
492 #ifndef X509_MAX_CUSTOM_EXTENSIONS
493  #define X509_MAX_CUSTOM_EXTENSIONS 2
494 #elif (X509_MAX_CUSTOM_EXTENSIONS < 1)
495  #error X509_MAX_CUSTOM_EXTENSIONS parameter is not valid
496 #endif
497 
498 //Application specific extensions
499 #ifndef X509_PRIVATE_EXTENSIONS
500  #define X509_PRIVATE_EXTENSIONS
501 #endif
502 
503 //C++ guard
504 #ifdef __cplusplus
505 extern "C" {
506 #endif
507 
508 
509 /**
510  * @brief PKCS #1 versions
511  **/
512 
513 typedef enum
514 {
515  PKCS1_VERSION_1 = 0
517 
518 
519 /**
520  * @brief PKCS #8 versions
521  **/
522 
523 typedef enum
524 {
526  PKCS8_VERSION_2 = 1
528 
529 
530 /**
531  * @brief X.509 versions
532  **/
533 
534 typedef enum
535 {
538  X509_VERSION_3 = 2
540 
541 
542 /**
543  * @brief Key usage
544  **/
545 
546 typedef enum
547 {
558 
559 
560 /**
561  * @brief Extended key usage
562  **/
563 
564 typedef enum
565 {
581  X509_EXT_KEY_USAGE_ANY = 0x00007FFF
583 
584 
585 /**
586  * @brief General name types
587  **/
588 
589 typedef enum
590 {
601 
602 
603 /**
604  * @brief Netscape certificate types
605  **/
606 
607 typedef enum
608 {
613 
614 
615 /**
616  * @brief Reason flags
617  **/
618 
619 typedef enum
620 {
631 
632 
633 /**
634  * @brief CRL reasons
635  **/
636 
637 typedef enum
638 {
650 
651 
652 /**
653  * @brief Public Key types
654  **/
655 
656 typedef enum
657 {
672 
673 
674 /**
675  * @brief Signature algorithms
676  **/
677 
678 typedef enum
679 {
692 
693 
694 /**
695  * @brief Hash algorithms
696  **/
697 
698 typedef enum
699 {
711  X509_HASH_ALGO_SM3 = 11
713 
714 
715 /**
716  * @brief String
717  **/
718 
719 typedef struct
720 {
721  const char_t *value;
722  size_t length;
723 } X509String;
724 
725 
726 /**
727  * @brief Octet string
728  **/
729 
730 typedef struct
731 {
732  const uint8_t *value;
733  size_t length;
735 
736 
737 /**
738  * @brief Serial number
739  **/
740 
741 typedef struct
742 {
743  const uint8_t *value;
744  size_t length;
746 
747 
748 /**
749  * @brief Issuer or subject name
750  **/
751 
752 typedef struct
753 {
773 } X509Name;
774 
775 
776 /**
777  * @brief Name attribute
778  **/
779 
780 typedef struct
781 {
786 
787 
788 /**
789  * @brief Validity
790  **/
791 
792 typedef struct
793 {
796 } X509Validity;
797 
798 
799 /**
800  * @brief Algorithm identifier
801  **/
802 
803 typedef struct
804 {
807 } X509AlgoId;
808 
809 
810 /**
811  * @brief RSA public key
812  **/
813 
814 typedef struct
815 {
819 
820 
821 /**
822  * @brief DSA domain parameters
823  **/
824 
825 typedef struct
826 {
831 
832 
833 /**
834  * @brief DSA public key
835  **/
836 
837 typedef struct
838 {
841 
842 
843 /**
844  * @brief EC parameters
845  **/
846 
847 typedef struct
848 {
851 
852 
853 /**
854  * @brief EC public key
855  **/
856 
857 typedef struct
858 {
861 
862 
863 /**
864  * @brief ML-DSA public key
865  **/
866 
867 typedef struct
868 {
871 
872 
873 /**
874  * @brief Subject Public Key Information extension
875  **/
876 
877 typedef struct
878 {
882 #if (RSA_SUPPORT == ENABLED)
884 #endif
885 #if (DSA_SUPPORT == ENABLED)
888 #endif
889 #if (EC_SUPPORT == ENABLED || ED25519_SUPPORT == ENABLED || \
890  ED448_SUPPORT == ENABLED)
893 #endif
894 #if (MLDSA44_SUPPORT == ENABLED || MLDSA65_SUPPORT == ENABLED || \
895  MLDSA87_SUPPORT == ENABLED)
897 #endif
899 
900 
901 /**
902  * @brief Basic Constraints extension
903  **/
904 
905 typedef struct
906 {
911 
912 
913 /**
914  * @brief Name Constraints extension
915  **/
916 
917 typedef struct
918 {
923 
924 
925 /**
926  * @brief Key Usage extension
927  **/
928 
929 typedef struct
930 {
932  uint16_t bitmap;
933 } X509KeyUsage;
934 
935 
936 /**
937  * @brief Extended Key Usage extension
938  **/
939 
940 typedef struct
941 {
943  uint16_t bitmap;
945 
946 
947 /**
948  * @brief General name
949  **/
950 
951 typedef struct
952 {
954  const char_t *value;
955  size_t length;
957 
958 
959 /**
960  * @brief Subject Alternative Name extension
961  **/
962 
963 typedef struct
964 {
970 
971 
972 /**
973  * @brief Subject Key Identifier extension
974  **/
975 
976 typedef struct
977 {
979  const uint8_t *value;
980  size_t length;
982 
983 
984 /**
985  * @brief Authority Key Identifier extension
986  **/
987 
988 typedef struct
989 {
992 } X509AuthKeyId;
993 
994 
995 /**
996  * @brief Distribution Point Name structure
997  **/
998 
999 typedef struct
1000 {
1005 
1006 
1007 /**
1008  * @brief Distribution Point structure
1009  **/
1010 
1011 typedef struct
1012 {
1014  uint16_t reasonFlags;
1017 } X509DistrPoint;
1018 
1019 
1020 /**
1021  * @brief CRL Distribution Points extension
1022  **/
1023 
1024 typedef struct
1025 {
1031 
1032 
1033 /**
1034  * @brief Access Description extension
1035  **/
1036 
1037 typedef struct
1038 {
1042 
1043 
1044 /**
1045  * @brief Authority Information Access extension
1046  **/
1047 
1048 typedef struct
1049 {
1055 
1056 
1057 /**
1058  * @brief PKIX OCSP No Check extension
1059  **/
1060 
1061 typedef struct
1062 {
1066 
1067 
1068 /**
1069  * @brief Netscape certificate type
1070  **/
1071 
1072 typedef struct
1073 {
1075  uint8_t bitmap;
1076 } X509NsCertType;
1077 
1078 
1079 /**
1080  * @brief X.509 certificate extension
1081  **/
1082 
1083 typedef struct
1084 {
1088 } X509Extension;
1089 
1090 
1091 /**
1092  * @brief X.509 certificate extensions
1093  **/
1094 
1095 typedef struct
1096 {
1112 } X509Extensions;
1113 
1114 
1115 /**
1116  * @brief RSASSA-PSS parameters
1117  **/
1118 
1119 typedef struct
1120 {
1124  size_t saltLen;
1126 
1127 
1128 /**
1129  * @brief Signature algorithm identifier
1130  **/
1131 
1132 typedef struct
1133 {
1135 #if (X509_RSA_PSS_SUPPORT == ENABLED && RSA_SUPPORT == ENABLED)
1137 #endif
1138 } X509SignAlgoId;
1139 
1140 
1141 /**
1142  * @brief TBSCertificate structure
1143  **/
1144 
1145 typedef struct
1146 {
1157 
1158 
1159 /**
1160  * @brief X.509 certificate
1161  **/
1162 
1163 typedef struct
1164 {
1169 } X509CertInfo;
1170 
1171 
1172 /**
1173  * @brief CRL Reason extension
1174  **/
1175 
1176 typedef struct
1177 {
1179  uint8_t value;
1180 } X509CrlReason;
1181 
1182 
1183 /**
1184  * @brief Invalidity Date extension
1185  **/
1186 
1187 typedef struct
1188 {
1192 
1193 
1194 /**
1195  * @brief Certificate Issuer extension
1196  **/
1197 
1198 typedef struct
1199 {
1205 
1206 
1207 /**
1208  * @brief CRL entry extensions
1209  **/
1210 
1211 typedef struct
1212 {
1218 
1219 
1220 /**
1221  * @brief Revoked certificate
1222  **/
1223 
1224 typedef struct
1225 {
1230 
1231 
1232 /**
1233  * @brief CRL number
1234  **/
1235 
1236 typedef struct
1237 {
1239  const uint8_t *value;
1240  size_t length;
1241 } X509CrlNumber;
1242 
1243 
1244 /**
1245  * @brief Delta CRL Indicator extension
1246  **/
1247 
1248 typedef struct
1249 {
1253 
1254 
1255 /**
1256  * @brief Issuing Distribution Point extension
1257  **/
1258 
1259 typedef struct
1260 {
1269 
1270 
1271 /**
1272  * @brief CRL extensions
1273  **/
1274 
1275 typedef struct
1276 {
1283 
1284 
1285 /**
1286  * @brief TBSCertList structure
1287  **/
1288 
1289 typedef struct
1290 {
1299 } X509TbsCertList;
1300 
1301 
1302 /**
1303  * @brief CRL (Certificate Revocation List)
1304  **/
1305 
1306 typedef struct
1307 {
1311 } X509CrlInfo;
1312 
1313 
1314 /**
1315  * @brief PKCS #9 ChallengePassword attribute
1316  **/
1317 
1318 typedef struct
1319 {
1320  const char_t *value;
1321  size_t length;
1323 
1324 
1325 /**
1326  * @brief CSR attribute
1327  **/
1328 
1329 typedef struct
1330 {
1333 } X509Attribute;
1334 
1335 
1336 /**
1337  * @brief CSR attributes
1338  **/
1339 
1340 typedef struct
1341 {
1345 } X509Attributes;
1346 
1347 
1348 /**
1349  * @brief CertificationRequestInfo structure
1350  **/
1351 
1352 typedef struct
1353 {
1360 
1361 
1362 /**
1363  * @brief CSR (Certificate Signing Request)
1364  **/
1365 
1366 typedef struct
1367 {
1371 } X509CsrInfo;
1372 
1373 
1374 /**
1375  * @brief Certificate parsing options
1376  **/
1377 
1378 typedef struct
1379 {
1380  bool_t ignoreUnknownExtensions; ///<Ignore unknown extensions
1381 } X509Options;
1382 
1383 
1384 //X.509 related constants
1385 extern const uint8_t X509_COMMON_NAME_OID[3];
1386 extern const uint8_t X509_SURNAME_OID[3];
1387 extern const uint8_t X509_SERIAL_NUMBER_OID[3];
1388 extern const uint8_t X509_COUNTRY_NAME_OID[3];
1389 extern const uint8_t X509_LOCALITY_NAME_OID[3];
1390 extern const uint8_t X509_STATE_OR_PROVINCE_NAME_OID[3];
1391 extern const uint8_t X509_ORGANIZATION_NAME_OID[3];
1392 extern const uint8_t X509_ORGANIZATIONAL_UNIT_NAME_OID[3];
1393 extern const uint8_t X509_TITLE_OID[3];
1394 extern const uint8_t X509_NAME_OID[3];
1395 extern const uint8_t X509_GIVEN_NAME_OID[3];
1396 extern const uint8_t X509_INITIALS_OID[3];
1397 extern const uint8_t X509_GENERATION_QUALIFIER_OID[3];
1398 extern const uint8_t X509_DN_QUALIFIER_OID[3];
1399 extern const uint8_t X509_PSEUDONYM_OID[3];
1400 extern const uint8_t X509_DOMAIN_COMPONENT_OID[10];
1401 
1402 extern const uint8_t X509_SUBJECT_DIR_ATTR_OID[3];
1403 extern const uint8_t X509_SUBJECT_KEY_ID_OID[3];
1404 extern const uint8_t X509_KEY_USAGE_OID[3];
1405 extern const uint8_t X509_SUBJECT_ALT_NAME_OID[3];
1406 extern const uint8_t X509_ISSUER_ALT_NAME_OID[3];
1407 extern const uint8_t X509_BASIC_CONSTRAINTS_OID[3];
1408 extern const uint8_t X509_CRL_NUMBER_OID[3];
1409 extern const uint8_t X509_REASON_CODE_OID[3];
1410 extern const uint8_t X509_INVALIDITY_DATE_OID[3];
1411 extern const uint8_t X509_DELTA_CRL_INDICATOR_OID[3];
1412 extern const uint8_t X509_ISSUING_DISTR_POINT_OID[3];
1413 extern const uint8_t X509_CERTIFICATE_ISSUER_OID[3];
1414 extern const uint8_t X509_NAME_CONSTRAINTS_OID[3];
1415 extern const uint8_t X509_CRL_DISTR_POINTS_OID[3];
1416 extern const uint8_t X509_CERTIFICATE_POLICIES_OID[3];
1417 extern const uint8_t X509_POLICY_MAPPINGS_OID[3];
1418 extern const uint8_t X509_AUTHORITY_KEY_ID_OID[3];
1419 extern const uint8_t X509_POLICY_CONSTRAINTS_OID[3];
1420 extern const uint8_t X509_EXTENDED_KEY_USAGE_OID[3];
1421 extern const uint8_t X509_FRESHEST_CRL_OID[3];
1422 extern const uint8_t X509_INHIBIT_ANY_POLICY_OID[3];
1423 extern const uint8_t X509_AUTH_INFO_ACCESS_OID[8];
1424 extern const uint8_t X509_PKIX_OCSP_NO_CHECK_OID[9];
1425 extern const uint8_t X509_NS_CERT_TYPE_OID[9];
1426 
1427 extern const uint8_t X509_ANY_EXT_KEY_USAGE_OID[4];
1428 extern const uint8_t X509_KP_SERVER_AUTH_OID[8];
1429 extern const uint8_t X509_KP_CLIENT_AUTH_OID[8];
1430 extern const uint8_t X509_KP_CODE_SIGNING_OID[8];
1431 extern const uint8_t X509_KP_EMAIL_PROTECTION_OID[8];
1432 extern const uint8_t X509_KP_IPSEC_END_SYSTEM_OID[8];
1433 extern const uint8_t X509_KP_IPSEC_TUNNEL_OID[8];
1434 extern const uint8_t X509_KP_IPSEC_USER_OID[8];
1435 extern const uint8_t X509_KP_TIME_STAMPING_OID[8];
1436 extern const uint8_t X509_KP_OCSP_SIGNING_OID[8];
1437 extern const uint8_t X509_KP_IPSEC_IKE_OID[8];
1438 extern const uint8_t X509_KP_SSH_CLIENT_OID[8];
1439 extern const uint8_t X509_KP_SSH_SERVER_OID[8];
1440 extern const uint8_t X509_KP_CMC_CA_OID[8];
1441 extern const uint8_t X509_KP_CMC_RA_OID[8];
1442 extern const uint8_t X509_KP_DOC_SIGNING_OID[8];
1443 
1444 extern const uint8_t X509_AD_CA_ISSUERS[8];
1445 extern const uint8_t X509_AD_OCSP[8];
1446 
1447 extern const uint8_t PKCS9_EMAIL_ADDR_OID[9];
1448 extern const uint8_t PKCS9_CHALLENGE_PASSWORD_OID[9];
1449 extern const uint8_t PKCS9_EXTENSION_REQUEST_OID[9];
1450 
1451 extern const X509Options X509_DEFAULT_OPTIONS;
1452 
1453 //X.509 related functions
1454 bool_t x509CompareName(const uint8_t *name1, size_t nameLen1,
1455  const uint8_t *name2, size_t nameLen2);
1456 
1459 bool_t x509IsCurveSupported(const uint8_t *oid, size_t length);
1460 
1461 error_t x509GetSignHashAlgo(const X509SignAlgoId *signAlgoId,
1462  X509SignatureAlgo *signAlgo, const HashAlgo **hashAlgo);
1463 
1464 X509KeyType x509GetPublicKeyType(const uint8_t *oid, size_t length);
1465 const EcCurve *x509GetCurve(const uint8_t *oid, size_t length);
1466 
1467 //C++ guard
1468 #ifdef __cplusplus
1469 }
1470 #endif
1471 
1472 #endif
@ X509_GENERAL_NAME_TYPE_REGISTERED_ID
Definition: x509_common.h:599
const uint8_t PKCS9_EMAIL_ADDR_OID[9]
Definition: x509_common.c:166
X509Validity validity
Definition: x509_common.h:1152
const uint8_t X509_KP_SERVER_AUTH_OID[8]
Definition: x509_common.c:130
@ X509_GENERAL_NAME_TYPE_X400_ADDRESS
Definition: x509_common.h:594
X509CrlDistrPoints crlDistrPoints
Definition: x509_common.h:1105
#define X509_MAX_FULL_NAMES
Definition: x509_common.h:479
@ X509_KEY_TYPE_RSA
Definition: x509_common.h:659
@ X509_EXT_KEY_USAGE_ANY
Definition: x509_common.h:581
Date and time management.
CRL entry extensions.
Definition: x509_common.h:1212
@ PKCS8_VERSION_2
Definition: x509_common.h:526
const uint8_t X509_ORGANIZATIONAL_UNIT_NAME_OID[3]
Definition: x509_common.c:60
@ X509_EXT_KEY_USAGE_SSH_CLIENT
Definition: x509_common.h:576
X509AuthInfoAccess authInfoAccess
Definition: x509_common.h:1106
X509GeneralNameType type
Definition: x509_common.h:953
@ X509_NS_CERT_TYPE_SSL_SERVER
Definition: x509_common.h:610
@ X509_EXT_KEY_USAGE_IPSEC_IKE
Definition: x509_common.h:575
int bool_t
Definition: compiler_port.h:63
X509SignAlgoId signatureAlgo
Definition: x509_common.h:1167
X509GeneralName accessLocation
Definition: x509_common.h:1040
const uint8_t X509_INHIBIT_ANY_POLICY_OID[3]
Definition: x509_common.c:119
X509DistrPointName distrPointName
Definition: x509_common.h:1013
@ X509_EXT_KEY_USAGE_CMC_CA
Definition: x509_common.h:578
const uint8_t * value
Definition: x509_common.h:743
const uint8_t X509_KEY_USAGE_OID[3]
Definition: x509_common.c:83
X509OctetString params
Definition: x509_common.h:806
X509ReasonFlags
Reason flags.
Definition: x509_common.h:620
X509TbsCertificate tbsCert
Definition: x509_common.h:1166
@ X509_EXT_KEY_USAGE_CMC_RA
Definition: x509_common.h:579
@ X509_CRL_REASON_CA_COMPROMISE
Definition: x509_common.h:641
@ X509_SIGN_ALGO_MLDSA65
Definition: x509_common.h:689
X509OctetString accessMethod
Definition: x509_common.h:1039
X509OctetString g
Definition: x509_common.h:829
Pkcs1Version
PKCS #1 versions.
Definition: x509_common.h:514
TBSCertificate structure.
Definition: x509_common.h:1146
signed int int_t
Definition: compiler_port.h:56
@ X509_KEY_TYPE_X448
Definition: x509_common.h:666
X509String givenName
Definition: x509_common.h:765
X509OctetString p
Definition: x509_common.h:827
#define X509_MAX_CRL_ISSUERS
Definition: x509_common.h:465
X509Extensions extensions
Definition: x509_common.h:1155
X509OctetString baseCrlNumber
Definition: x509_common.h:1251
X509DsaPublicKey dsaPublicKey
Definition: x509_common.h:887
@ X509_REASON_FLAGS_PRIVILEGE_WITHDRAWN
Definition: x509_common.h:628
const uint8_t X509_EXTENDED_KEY_USAGE_OID[3]
Definition: x509_common.c:115
X509OctetString raw
Definition: x509_common.h:966
X509OctetString hashAlgo
Definition: x509_common.h:1121
@ X509_KEY_TYPE_MLDSA87
Definition: x509_common.h:670
ECDSA (Elliptic Curve Digital Signature Algorithm)
const uint8_t X509_KP_SSH_CLIENT_OID[8]
Definition: x509_common.c:150
Validity.
Definition: x509_common.h:793
X509KeyUsage keyUsage
Definition: x509_common.h:1100
X509OctetString oid
Definition: x509_common.h:880
X509OctetString raw
Definition: x509_common.h:1147
X509KeyType x509GetPublicKeyType(const uint8_t *oid, size_t length)
Get the public key type that matches the specified OID.
Definition: x509_common.c:887
const X509Options X509_DEFAULT_OPTIONS
Definition: x509_common.c:173
const uint8_t X509_POLICY_CONSTRAINTS_OID[3]
Definition: x509_common.c:113
X509OctetString raw
Definition: x509_common.h:1027
X509SignAlgoId signatureAlgo
Definition: x509_common.h:1150
@ X509_REASON_FLAGS_AFFILIATION_CHANGED
Definition: x509_common.h:624
X509String stateOrProvinceName
Definition: x509_common.h:760
const uint8_t X509_ORGANIZATION_NAME_OID[3]
Definition: x509_common.c:58
const uint8_t X509_DOMAIN_COMPONENT_OID[10]
Definition: x509_common.c:76
const uint8_t X509_KP_CODE_SIGNING_OID[8]
Definition: x509_common.c:134
X509String pseudonym
Definition: x509_common.h:769
X509OctetString raw
Definition: x509_common.h:1097
X509EcParameters ecParams
Definition: x509_common.h:891
const char_t * value
Definition: x509_common.h:1320
@ X509_GENERAL_NAME_TYPE_RFC822
Definition: x509_common.h:592
X509ExtendedKeyUsage extKeyUsage
Definition: x509_common.h:1101
const uint8_t X509_KP_OCSP_SIGNING_OID[8]
Definition: x509_common.c:146
X509NsCertType nsCertType
Definition: x509_common.h:1108
X509SignAlgoId signatureAlgo
Definition: x509_common.h:1369
X509OctetString maskGenHashAlgo
Definition: x509_common.h:1123
Pkcs8Version
PKCS #8 versions.
Definition: x509_common.h:524
const uint8_t X509_DN_QUALIFIER_OID[3]
Definition: x509_common.c:72
@ X509_KEY_USAGE_DATA_ENCIPHERMENT
Definition: x509_common.h:551
@ X509_GENERAL_NAME_TYPE_URI
Definition: x509_common.h:597
#define X509_PRIVATE_EXTENSIONS
Definition: x509_common.h:500
@ X509_EXT_KEY_USAGE_IPSEC_USER
Definition: x509_common.h:572
X509Extensions extensionReq
Definition: x509_common.h:1344
const uint8_t X509_SUBJECT_DIR_ATTR_OID[3]
Definition: x509_common.c:79
X509String name
Definition: x509_common.h:764
X509String title
Definition: x509_common.h:763
X509String organizationName
Definition: x509_common.h:761
const uint8_t X509_SUBJECT_ALT_NAME_OID[3]
Definition: x509_common.c:85
@ X509_VERSION_1
Definition: x509_common.h:536
@ X509_EXT_KEY_USAGE_CLIENT_AUTH
Definition: x509_common.h:567
CRL (Certificate Revocation List)
Definition: x509_common.h:1307
@ X509_EXT_KEY_USAGE_SSH_SERVER
Definition: x509_common.h:577
@ X509_EXT_KEY_USAGE_IPSEC_END_SYSTEM
Definition: x509_common.h:570
bool_t critical
Definition: x509_common.h:990
Invalidity Date extension.
Definition: x509_common.h:1188
const uint8_t X509_GIVEN_NAME_OID[3]
Definition: x509_common.c:66
const uint8_t X509_SERIAL_NUMBER_OID[3]
Definition: x509_common.c:50
const uint8_t X509_AUTHORITY_KEY_ID_OID[3]
Definition: x509_common.c:111
#define X509_MAX_SUBJECT_ALT_NAMES
Definition: x509_common.h:451
@ X509_CRL_REASON_AA_COMPROMISE
Definition: x509_common.h:648
size_t length
Definition: x509_common.h:722
@ X509_KEY_USAGE_ENCIPHER_ONLY
Definition: x509_common.h:555
Subject Key Identifier extension.
Definition: x509_common.h:977
X509String commonName
Definition: x509_common.h:755
@ X509_GENERAL_NAME_TYPE_DIRECTORY
Definition: x509_common.h:595
uint8_t oid[]
Definition: lldp_tlv.h:300
X509DeltaCrlIndicator deltaCrlIndicator
Definition: x509_common.h:1279
X509AuthKeyId authKeyId
Definition: x509_common.h:1104
const uint8_t X509_NAME_OID[3]
Definition: x509_common.c:64
@ X509_CRL_REASON_SUPERSEDED
Definition: x509_common.h:643
const uint8_t X509_AD_CA_ISSUERS[8]
Definition: x509_common.c:161
X509OctetString q
Definition: x509_common.h:828
EC public key.
Definition: x509_common.h:858
const uint8_t X509_ANY_EXT_KEY_USAGE_OID[4]
Definition: x509_common.c:128
Certificate parsing options.
Definition: x509_common.h:1379
String.
Definition: x509_common.h:720
@ X509_CRL_REASON_AFFILIATION_CHANGED
Definition: x509_common.h:642
Distribution Point Name structure.
Definition: x509_common.h:1000
@ X509_GENERAL_NAME_TYPE_EDI_PARTY
Definition: x509_common.h:596
@ X509_SIGN_ALGO_MLDSA44
Definition: x509_common.h:688
uint_t numAccessDescriptions
Definition: x509_common.h:1052
X509String initials
Definition: x509_common.h:766
X509SignAlgoId signatureAlgo
Definition: x509_common.h:1293
@ PKCS1_VERSION_1
Definition: x509_common.h:515
X509CrlReasons
CRL reasons.
Definition: x509_common.h:638
@ X509_KEY_TYPE_EC
Definition: x509_common.h:662
X509SubjectPublicKeyInfo subjectPublicKeyInfo
Definition: x509_common.h:1357
X509OctetString y
Definition: x509_common.h:839
DateTime notAfter
Definition: x509_common.h:795
Certificate Issuer extension.
Definition: x509_common.h:1199
X509SignatureAlgo
Signature algorithms.
Definition: x509_common.h:679
Authority Information Access extension.
Definition: x509_common.h:1049
@ X509_KEY_USAGE_NON_REPUDIATION
Definition: x509_common.h:549
const uint8_t X509_DELTA_CRL_INDICATOR_OID[3]
Definition: x509_common.c:97
const uint8_t PKCS9_CHALLENGE_PASSWORD_OID[9]
Definition: x509_common.c:168
General name.
Definition: x509_common.h:952
error_t x509GetSignHashAlgo(const X509SignAlgoId *signAlgoId, X509SignatureAlgo *signAlgo, const HashAlgo **hashAlgo)
Get the signature and hash algorithms that match the specified identifier.
Definition: x509_common.c:433
bool_t critical
Definition: x509_common.h:931
X509OctetString raw
Definition: x509_common.h:1277
X509OctetString raw
Definition: x509_common.h:1291
X509OctetString raw
Definition: x509_common.h:1165
@ X509_KEY_TYPE_SM2
Definition: x509_common.h:663
const uint8_t * value
Definition: x509_common.h:1239
X509CrlNumber crlNumber
Definition: x509_common.h:1278
@ X509_GENERAL_NAME_TYPE_DNS
Definition: x509_common.h:593
X.509 certificate.
Definition: x509_common.h:1164
error_t
Error codes.
Definition: error.h:43
const uint8_t X509_PKIX_OCSP_NO_CHECK_OID[9]
Definition: x509_common.c:123
EC parameters.
Definition: x509_common.h:848
const uint8_t X509_POLICY_MAPPINGS_OID[3]
Definition: x509_common.c:109
const uint8_t X509_AUTH_INFO_ACCESS_OID[8]
Definition: x509_common.c:121
const uint8_t X509_REASON_CODE_OID[3]
Definition: x509_common.c:93
const uint8_t X509_CRL_NUMBER_OID[3]
Definition: x509_common.c:91
bool_t x509IsCurveSupported(const uint8_t *oid, size_t length)
Check whether a given elliptic curve is supported.
Definition: x509_common.c:410
Name attribute.
Definition: x509_common.h:781
Extended Key Usage extension.
Definition: x509_common.h:941
Distribution Point structure.
Definition: x509_common.h:1012
const EcCurve * x509GetCurve(const uint8_t *oid, size_t length)
Get the elliptic curve that matches the specified OID.
Definition: x509_common.c:989
X509BasicConstraints basicConstraints
Definition: x509_common.h:1098
RSA public key.
Definition: x509_common.h:815
X509Version
X.509 versions.
Definition: x509_common.h:535
@ X509_KEY_USAGE_DECIPHER_ONLY
Definition: x509_common.h:556
X509InvalidityDate invalidityDate
Definition: x509_common.h:1215
X509OctetString signatureValue
Definition: x509_common.h:1310
X509Version version
Definition: x509_common.h:1148
X509CrlEntryExtensions crlEntryExtensions
Definition: x509_common.h:1228
X509NameAttribute relativeName
Definition: x509_common.h:1003
X509OctetString permittedSubtrees
Definition: x509_common.h:920
@ X509_SIGN_ALGO_ECDSA
Definition: x509_common.h:684
@ X509_CRL_REASON_CESSATION_OF_OPERATION
Definition: x509_common.h:644
@ X509_HASH_ALGO_NONE
Definition: x509_common.h:700
CSR attribute.
Definition: x509_common.h:1330
uint16_t reasonFlags
Definition: x509_common.h:1014
TBSCertList structure.
Definition: x509_common.h:1290
const uint8_t X509_TITLE_OID[3]
Definition: x509_common.c:62
const uint8_t X509_NAME_CONSTRAINTS_OID[3]
Definition: x509_common.c:103
@ X509_REASON_FLAGS_CERTIFICATE_HOLD
Definition: x509_common.h:627
X509AuthKeyId authKeyId
Definition: x509_common.h:1281
X509String emailAddress
Definition: x509_common.h:770
X509RsaPublicKey rsaPublicKey
Definition: x509_common.h:883
@ X509_KEY_USAGE_KEY_AGREEMENT
Definition: x509_common.h:552
Collection of signature algorithms.
X509MldsaPublicKey mldsaPublicKey
Definition: x509_common.h:896
@ X509_REASON_FLAGS_CA_COMPROMISE
Definition: x509_common.h:623
X509OctetString oid
Definition: x509_common.h:1331
X509OctetString oid
Definition: x509_common.h:805
EdDSA (Edwards-Curve Digital Signature Algorithm)
#define X509_MAX_ACCESS_DESCRIPTIONS
Definition: x509_common.h:486
@ X509_VERSION_3
Definition: x509_common.h:538
X.509 certificate extension.
Definition: x509_common.h:1084
@ X509_HASH_ALGO_SHA1
Definition: x509_common.h:702
const uint8_t X509_AD_OCSP[8]
Definition: x509_common.c:163
Authority Key Identifier extension.
Definition: x509_common.h:989
General definitions for cryptographic algorithms.
X509Version version
Definition: x509_common.h:1355
X509CertRequestInfo certReqInfo
Definition: x509_common.h:1368
ML-DSA (Edwards-Curve Digital Signature Algorithm)
X509PkixOcspNoCheck pkixOcspNoCheck
Definition: x509_common.h:1107
RSA public-key cryptography standard.
X509OctetString raw
Definition: x509_common.h:879
X509OctetString raw
Definition: x509_common.h:1342
X509SerialNumber serialNumber
Definition: x509_common.h:1149
@ X509_HASH_ALGO_SHA3_224
Definition: x509_common.h:707
X509OctetString excludedSubtrees
Definition: x509_common.h:921
PKIX OCSP No Check extension.
Definition: x509_common.h:1062
DSA (Digital Signature Algorithm)
@ X509_REASON_FLAGS_AA_COMPROMISE
Definition: x509_common.h:629
X509OctetString signatureValue
Definition: x509_common.h:1168
const uint8_t X509_KP_EMAIL_PROTECTION_OID[8]
Definition: x509_common.c:136
X509OctetString raw
Definition: x509_common.h:1201
@ X509_KEY_TYPE_RSA_PSS
Definition: x509_common.h:660
X509String serialNumber
Definition: x509_common.h:757
X509OctetString raw
Definition: x509_common.h:1354
@ X509_EXT_KEY_USAGE_SERVER_AUTH
Definition: x509_common.h:566
X509DsaParameters dsaParams
Definition: x509_common.h:886
Date and time representation.
Definition: date_time.h:54
@ X509_KEY_USAGE_DIGITAL_SIGNATURE
Definition: x509_common.h:548
#define X509_MAX_CUSTOM_EXTENSIONS
Definition: x509_common.h:493
const uint8_t PKCS9_EXTENSION_REQUEST_OID[9]
Definition: x509_common.c:170
@ X509_HASH_ALGO_SHA224
Definition: x509_common.h:703
@ X509_SIGN_ALGO_MLDSA87
Definition: x509_common.h:690
uint8_t length
Definition: tcp.h:375
Revoked certificate.
Definition: x509_common.h:1225
const uint8_t X509_CRL_DISTR_POINTS_OID[3]
Definition: x509_common.c:105
@ PKCS8_VERSION_1
Definition: x509_common.h:525
@ X509_CRL_REASON_CERTIFICATE_HOLD
Definition: x509_common.h:645
X509OctetString oid
Definition: x509_common.h:1134
X509OctetString maskGenAlgo
Definition: x509_common.h:1122
uint16_t bitmap
Definition: x509_common.h:932
X509TbsCertList tbsCertList
Definition: x509_common.h:1308
X509HashAlgo
Hash algorithms.
Definition: x509_common.h:699
CertificationRequestInfo structure.
Definition: x509_common.h:1353
X509CrlExtensions crlExtensions
Definition: x509_common.h:1298
X509SubjectAltName subjectAltName
Definition: x509_common.h:1102
Subject Alternative Name extension.
Definition: x509_common.h:964
@ X509_EXT_KEY_USAGE_DOC_SIGNING
Definition: x509_common.h:580
const uint8_t X509_KP_IPSEC_TUNNEL_OID[8]
Definition: x509_common.c:140
const uint8_t X509_KP_CMC_RA_OID[8]
Definition: x509_common.c:156
@ X509_SIGN_ALGO_RSA
Definition: x509_common.h:681
Access Description extension.
Definition: x509_common.h:1038
const uint8_t X509_INVALIDITY_DATE_OID[3]
Definition: x509_common.c:95
const uint8_t X509_KP_IPSEC_IKE_OID[8]
Definition: x509_common.c:148
@ X509_EXT_KEY_USAGE_TIME_STAMPING
Definition: x509_common.h:573
X509OctetString namedCurve
Definition: x509_common.h:849
X509String surname
Definition: x509_common.h:756
X509KeyUsageBitmap
Key usage.
Definition: x509_common.h:547
const uint8_t X509_KP_TIME_STAMPING_OID[8]
Definition: x509_common.c:144
Netscape certificate type.
Definition: x509_common.h:1073
@ X509_EXT_KEY_USAGE_IPSEC_TUNNEL
Definition: x509_common.h:571
@ X509_NS_CERT_TYPE_SSL_CLIENT
Definition: x509_common.h:609
const char_t * value
Definition: x509_common.h:954
bool_t onlyContainsAttributeCerts
Definition: x509_common.h:1267
@ X509_HASH_ALGO_SHA3_512
Definition: x509_common.h:710
char char_t
Definition: compiler_port.h:55
X509SignAlgoId signatureAlgo
Definition: x509_common.h:1309
@ X509_HASH_ALGO_MD5
Definition: x509_common.h:701
@ X509_VERSION_2
Definition: x509_common.h:537
X509IssuingDistrPoint issuingDistrPoint
Definition: x509_common.h:1280
bool_t x509IsHashAlgoSupported(X509HashAlgo hashAlgo)
Check whether a given hash algorithm is supported.
Definition: x509_common.c:306
X509String generationQualifier
Definition: x509_common.h:767
@ X509_REASON_FLAGS_SUPERSEDED
Definition: x509_common.h:625
const uint8_t X509_ISSUER_ALT_NAME_OID[3]
Definition: x509_common.c:87
uint_t numCustomExtensions
Definition: x509_common.h:1109
X509ExtKeyUsageBitmap
Extended key usage.
Definition: x509_common.h:565
DateTime notBefore
Definition: x509_common.h:794
X509OctetString data
Definition: x509_common.h:1332
X509OctetString q
Definition: x509_common.h:859
@ X509_SIGN_ALGO_RSA_PSS
Definition: x509_common.h:682
const char_t * value
Definition: x509_common.h:721
const uint8_t X509_LOCALITY_NAME_OID[3]
Definition: x509_common.c:54
#define X509_MAX_DOMAIN_COMPONENTS
Definition: x509_common.h:444
const uint8_t X509_SURNAME_OID[3]
Definition: x509_common.c:48
@ X509_KEY_TYPE_ED448
Definition: x509_common.h:667
X509OctetString signatureValue
Definition: x509_common.h:1370
@ X509_HASH_ALGO_SHA3_256
Definition: x509_common.h:708
@ X509_HASH_ALGO_SHA3_384
Definition: x509_common.h:709
const uint8_t X509_PSEUDONYM_OID[3]
Definition: x509_common.c:74
const uint8_t X509_KP_CLIENT_AUTH_OID[8]
Definition: x509_common.c:132
Issuer or subject name.
Definition: x509_common.h:753
X509CertificateIssuer certIssuer
Definition: x509_common.h:1216
X509OctetString n
Definition: x509_common.h:816
X509OctetString e
Definition: x509_common.h:817
Subject Public Key Information extension.
Definition: x509_common.h:878
@ X509_CRL_REASON_KEY_COMPROMISE
Definition: x509_common.h:640
@ X509_HASH_ALGO_SHA512
Definition: x509_common.h:706
const uint8_t X509_COMMON_NAME_OID[3]
Definition: x509_common.c:46
CRL extensions.
Definition: x509_common.h:1276
DSA domain parameters.
Definition: x509_common.h:826
const uint8_t X509_KP_IPSEC_END_SYSTEM_OID[8]
Definition: x509_common.c:138
@ X509_KEY_TYPE_MLDSA44
Definition: x509_common.h:668
X509CrlReason reasonCode
Definition: x509_common.h:1214
@ X509_KEY_TYPE_DSA
Definition: x509_common.h:661
@ X509_REASON_FLAGS_KEY_COMPROMISE
Definition: x509_common.h:622
X509DistrPointName distributionPoint
Definition: x509_common.h:1262
X509OctetString raw
Definition: x509_common.h:1051
const uint8_t X509_STATE_OR_PROVINCE_NAME_OID[3]
Definition: x509_common.c:56
CRL Reason extension.
Definition: x509_common.h:1177
@ X509_REASON_FLAGS_CESSATION_OF_OPERATION
Definition: x509_common.h:626
Basic Constraints extension.
Definition: x509_common.h:906
CSR attributes.
Definition: x509_common.h:1341
#define X509_MAX_DISTR_POINTS
Definition: x509_common.h:472
@ X509_NS_CERT_TYPE_SSL_CA
Definition: x509_common.h:611
Delta CRL Indicator extension.
Definition: x509_common.h:1249
@ X509_HASH_ALGO_SHA384
Definition: x509_common.h:705
X509OctetString revokedCerts
Definition: x509_common.h:1297
const uint8_t X509_NS_CERT_TYPE_OID[9]
Definition: x509_common.c:125
DateTime thisUpdate
Definition: x509_common.h:1295
const uint8_t X509_CERTIFICATE_ISSUER_OID[3]
Definition: x509_common.c:101
@ X509_HASH_ALGO_SHA256
Definition: x509_common.h:704
const uint8_t X509_SUBJECT_KEY_ID_OID[3]
Definition: x509_common.c:81
RSASSA-PSS parameters.
Definition: x509_common.h:1120
X509String organizationalUnitName
Definition: x509_common.h:762
@ X509_EXT_KEY_USAGE_OCSP_SIGNING
Definition: x509_common.h:574
const uint8_t X509_KP_CMC_CA_OID[8]
Definition: x509_common.c:154
Name Constraints extension.
Definition: x509_common.h:918
X.509 certificate extensions.
Definition: x509_common.h:1096
X509OctetString rawSubjectPublicKey
Definition: x509_common.h:881
CRL Distribution Points extension.
Definition: x509_common.h:1025
const uint8_t X509_ISSUING_DISTR_POINT_OID[3]
Definition: x509_common.c:99
X509NameConstraints nameConstraints
Definition: x509_common.h:1099
const uint8_t X509_INITIALS_OID[3]
Definition: x509_common.c:68
X509OctetString oid
Definition: x509_common.h:782
X509String dnQualifier
Definition: x509_common.h:768
const uint8_t X509_KP_DOC_SIGNING_OID[8]
Definition: x509_common.c:158
X509OctetString oid
Definition: x509_common.h:1085
const uint8_t X509_COUNTRY_NAME_OID[3]
Definition: x509_common.c:52
@ X509_EXT_KEY_USAGE_CODE_SIGNING
Definition: x509_common.h:568
const uint8_t * value
Definition: x509_common.h:732
bool_t x509IsSignAlgoSupported(X509SignatureAlgo signAlgo)
Check whether a given signature algorithm is supported.
Definition: x509_common.c:210
Common interface for hash algorithms.
Definition: crypto.h:1165
CRL number.
Definition: x509_common.h:1237
const uint8_t * value
Definition: x509_common.h:979
@ X509_KEY_TYPE_UNKNOWN
Definition: x509_common.h:658
#define EcCurve
Definition: ec.h:346
@ X509_CRL_REASON_PRIVILEGE_WITHDRAWN
Definition: x509_common.h:647
uint_t numCrlIssuers
Definition: x509_common.h:1015
@ X509_CRL_REMOVE_FROM_CRL
Definition: x509_common.h:646
X509SerialNumber userCert
Definition: x509_common.h:1226
@ X509_GENERAL_NAME_TYPE_OTHER
Definition: x509_common.h:591
X509ChallengePassword challengePwd
Definition: x509_common.h:1343
@ X509_CRL_REASON_UNSPECIFIED
Definition: x509_common.h:639
X509String localityName
Definition: x509_common.h:759
const uint8_t X509_KP_SSH_SERVER_OID[8]
Definition: x509_common.c:152
@ X509_SIGN_ALGO_SM2
Definition: x509_common.h:685
Serial number.
Definition: x509_common.h:742
Octet string.
Definition: x509_common.h:731
@ X509_REASON_FLAGS_UNUSED
Definition: x509_common.h:621
X509OctetString keyId
Definition: x509_common.h:991
@ X509_SIGN_ALGO_ED25519
Definition: x509_common.h:686
unsigned int uint_t
Definition: compiler_port.h:57
Issuing Distribution Point extension.
Definition: x509_common.h:1260
DateTime nextUpdate
Definition: x509_common.h:1296
const uint8_t X509_FRESHEST_CRL_OID[3]
Definition: x509_common.c:117
@ X509_KEY_TYPE_ED25519
Definition: x509_common.h:665
@ X509_GENERAL_NAME_TYPE_IP_ADDRESS
Definition: x509_common.h:598
X509OctetString data
Definition: x509_common.h:1087
@ X509_KEY_USAGE_KEY_ENCIPHERMENT
Definition: x509_common.h:550
const uint8_t X509_BASIC_CONSTRAINTS_OID[3]
Definition: x509_common.c:89
X509KeyType
Public Key types.
Definition: x509_common.h:657
X509EcPublicKey ecPublicKey
Definition: x509_common.h:892
X509SubjectPublicKeyInfo subjectPublicKeyInfo
Definition: x509_common.h:1154
DSA public key.
Definition: x509_common.h:838
const uint8_t X509_KP_IPSEC_USER_OID[8]
Definition: x509_common.c:142
X509GeneralNameType
General name types.
Definition: x509_common.h:590
X509SubjectKeyId subjectKeyId
Definition: x509_common.h:1103
X509String data
Definition: x509_common.h:784
X509Version version
Definition: x509_common.h:1292
CSR (Certificate Signing Request)
Definition: x509_common.h:1367
bool_t x509CompareName(const uint8_t *name1, size_t nameLen1, const uint8_t *name2, size_t nameLen2)
Compare distinguished names.
Definition: x509_common.c:188
@ X509_SIGN_ALGO_NONE
Definition: x509_common.h:680
X509Attributes attributes
Definition: x509_common.h:1358
#define X509_MAX_CERT_ISSUERS
Definition: x509_common.h:458
@ X509_EXT_KEY_USAGE_EMAIL_PROTECTION
Definition: x509_common.h:569
ML-DSA public key.
Definition: x509_common.h:868
@ X509_HASH_ALGO_SM3
Definition: x509_common.h:711
@ X509_KEY_TYPE_MLDSA65
Definition: x509_common.h:669
X509RsaPssParameters rsaPssParams
Definition: x509_common.h:1136
bool_t ignoreUnknownExtensions
Ignore unknown extensions.
Definition: x509_common.h:1380
uint_t numDomainComponents
Definition: x509_common.h:771
X509OctetString raw
Definition: x509_common.h:1213
@ X509_KEY_USAGE_CRL_SIGN
Definition: x509_common.h:554
X509OctetString raw
Definition: x509_common.h:754
PKCS #9 ChallengePassword attribute.
Definition: x509_common.h:1319
Signature algorithm identifier.
Definition: x509_common.h:1133
X509NsCertTypeBitmap
Netscape certificate types.
Definition: x509_common.h:608
Algorithm identifier.
Definition: x509_common.h:804
@ X509_KEY_TYPE_X25519
Definition: x509_common.h:664
@ X509_SIGN_ALGO_DSA
Definition: x509_common.h:683
X509String countryName
Definition: x509_common.h:758
X509OctetString pk
Definition: x509_common.h:869
@ X509_KEY_USAGE_KEY_CERT_SIGN
Definition: x509_common.h:553
@ X509_SIGN_ALGO_ED448
Definition: x509_common.h:687
Key Usage extension.
Definition: x509_common.h:930
const uint8_t X509_CERTIFICATE_POLICIES_OID[3]
Definition: x509_common.c:107
const uint8_t X509_GENERATION_QUALIFIER_OID[3]
Definition: x509_common.c:70