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