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-2024 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.4.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 "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 //brainpoolP192r1 elliptic curve support
268 #ifndef X509_BRAINPOOLP192R1_SUPPORT
269  #define X509_BRAINPOOLP192R1_SUPPORT DISABLED
270 #elif (X509_BRAINPOOLP192R1_SUPPORT != ENABLED && X509_BRAINPOOLP192R1_SUPPORT != DISABLED)
271  #error X509_BRAINPOOLP192R1_SUPPORT parameter is not valid
272 #endif
273 
274 //brainpoolP224r1 elliptic curve support
275 #ifndef X509_BRAINPOOLP224R1_SUPPORT
276  #define X509_BRAINPOOLP224R1_SUPPORT DISABLED
277 #elif (X509_BRAINPOOLP224R1_SUPPORT != ENABLED && X509_BRAINPOOLP224R1_SUPPORT != DISABLED)
278  #error X509_BRAINPOOLP224R1_SUPPORT parameter is not valid
279 #endif
280 
281 //brainpoolP256r1 elliptic curve support
282 #ifndef X509_BRAINPOOLP256R1_SUPPORT
283  #define X509_BRAINPOOLP256R1_SUPPORT DISABLED
284 #elif (X509_BRAINPOOLP256R1_SUPPORT != ENABLED && X509_BRAINPOOLP256R1_SUPPORT != DISABLED)
285  #error X509_BRAINPOOLP256R1_SUPPORT parameter is not valid
286 #endif
287 
288 //brainpoolP320r1 elliptic curve support
289 #ifndef X509_BRAINPOOLP320R1_SUPPORT
290  #define X509_BRAINPOOLP320R1_SUPPORT DISABLED
291 #elif (X509_BRAINPOOLP320R1_SUPPORT != ENABLED && X509_BRAINPOOLP320R1_SUPPORT != DISABLED)
292  #error X509_BRAINPOOLP320R1_SUPPORT parameter is not valid
293 #endif
294 
295 //brainpoolP384r1 elliptic curve support
296 #ifndef X509_BRAINPOOLP384R1_SUPPORT
297  #define X509_BRAINPOOLP384R1_SUPPORT DISABLED
298 #elif (X509_BRAINPOOLP384R1_SUPPORT != ENABLED && X509_BRAINPOOLP384R1_SUPPORT != DISABLED)
299  #error X509_BRAINPOOLP384R1_SUPPORT parameter is not valid
300 #endif
301 
302 //brainpoolP512r1 elliptic curve support
303 #ifndef X509_BRAINPOOLP512R1_SUPPORT
304  #define X509_BRAINPOOLP512R1_SUPPORT DISABLED
305 #elif (X509_BRAINPOOLP512R1_SUPPORT != ENABLED && X509_BRAINPOOLP512R1_SUPPORT != DISABLED)
306  #error X509_BRAINPOOLP512R1_SUPPORT parameter is not valid
307 #endif
308 
309 //FRP256v1 elliptic curve support
310 #ifndef X509_FRP256V1_SUPPORT
311  #define X509_FRP256V1_SUPPORT DISABLED
312 #elif (X509_FRP256V1_SUPPORT != ENABLED && X509_FRP256V1_SUPPORT != DISABLED)
313  #error X509_FRP256V1_SUPPORT parameter is not valid
314 #endif
315 
316 //SM2 elliptic curve support
317 #ifndef X509_SM2_SUPPORT
318  #define X509_SM2_SUPPORT DISABLED
319 #elif (X509_SM2_SUPPORT != ENABLED && X509_SM2_SUPPORT != DISABLED)
320  #error X509_SM2_SUPPORT parameter is not valid
321 #endif
322 
323 //Ed25519 elliptic curve support
324 #ifndef X509_ED25519_SUPPORT
325  #define X509_ED25519_SUPPORT DISABLED
326 #elif (X509_ED25519_SUPPORT != ENABLED && X509_ED25519_SUPPORT != DISABLED)
327  #error X509_ED25519_SUPPORT parameter is not valid
328 #endif
329 
330 //Ed448 elliptic curve support
331 #ifndef X509_ED448_SUPPORT
332  #define X509_ED448_SUPPORT DISABLED
333 #elif (X509_ED448_SUPPORT != ENABLED && X509_ED448_SUPPORT != DISABLED)
334  #error X509_ED448_SUPPORT parameter is not valid
335 #endif
336 
337 //Minimum acceptable size for RSA modulus
338 #ifndef X509_MIN_RSA_MODULUS_SIZE
339  #define X509_MIN_RSA_MODULUS_SIZE 1024
340 #elif (X509_MIN_RSA_MODULUS_SIZE < 512)
341  #error X509_MIN_RSA_MODULUS_SIZE parameter is not valid
342 #endif
343 
344 //Maximum acceptable size for RSA modulus
345 #ifndef X509_MAX_RSA_MODULUS_SIZE
346  #define X509_MAX_RSA_MODULUS_SIZE 4096
347 #elif (X509_MAX_RSA_MODULUS_SIZE < X509_MIN_RSA_MODULUS_SIZE)
348  #error X509_MAX_RSA_MODULUS_SIZE parameter is not valid
349 #endif
350 
351 //Minimum acceptable size for DSA prime modulus
352 #ifndef X509_MIN_DSA_MODULUS_SIZE
353  #define X509_MIN_DSA_MODULUS_SIZE 1024
354 #elif (X509_MIN_DSA_MODULUS_SIZE < 512)
355  #error X509_MIN_DSA_MODULUS_SIZE parameter is not valid
356 #endif
357 
358 //Maximum acceptable size for DSA prime modulus
359 #ifndef X509_MAX_DSA_MODULUS_SIZE
360  #define X509_MAX_DSA_MODULUS_SIZE 4096
361 #elif (X509_MAX_DSA_MODULUS_SIZE < X509_MIN_DSA_MODULUS_SIZE)
362  #error X509_MAX_DSA_MODULUS_SIZE parameter is not valid
363 #endif
364 
365 //Default size of serial numbers
366 #ifndef X509_SERIAL_NUMBER_SIZE
367  #define X509_SERIAL_NUMBER_SIZE 20
368 #elif (X509_SERIAL_NUMBER_SIZE < 1)
369  #error X509_SERIAL_NUMBER_SIZE parameter is not valid
370 #endif
371 
372 //Maximum number of domain components
373 #ifndef X509_MAX_DOMAIN_COMPONENTS
374  #define X509_MAX_DOMAIN_COMPONENTS 4
375 #elif (X509_MAX_DOMAIN_COMPONENTS < 1)
376  #error X509_MAX_DOMAIN_COMPONENTS parameter is not valid
377 #endif
378 
379 //Maximum number of subject alternative names
380 #ifndef X509_MAX_SUBJECT_ALT_NAMES
381  #define X509_MAX_SUBJECT_ALT_NAMES 4
382 #elif (X509_MAX_SUBJECT_ALT_NAMES < 1)
383  #error X509_MAX_SUBJECT_ALT_NAMES parameter is not valid
384 #endif
385 
386 //Maximum number of certificate issuers
387 #ifndef X509_MAX_CERT_ISSUERS
388  #define X509_MAX_CERT_ISSUERS 4
389 #elif (X509_MAX_CERT_ISSUERS < 1)
390  #error X509_MAX_CERT_ISSUERS parameter is not valid
391 #endif
392 
393 //Maximum number of CRL issuers
394 #ifndef X509_MAX_CRL_ISSUERS
395  #define X509_MAX_CRL_ISSUERS 2
396 #elif (X509_MAX_CRL_ISSUERS < 1)
397  #error X509_MAX_CRL_ISSUERS parameter is not valid
398 #endif
399 
400 //Maximum number of distribution points
401 #ifndef X509_MAX_DISTR_POINTS
402  #define X509_MAX_DISTR_POINTS 2
403 #elif (X509_MAX_DISTR_POINTS < 1)
404  #error X509_MAX_DISTR_POINTS parameter is not valid
405 #endif
406 
407 //Maximum number of full names
408 #ifndef X509_MAX_FULL_NAMES
409  #define X509_MAX_FULL_NAMES 2
410 #elif (X509_MAX_FULL_NAMES < 1)
411  #error X509_MAX_FULL_NAMES parameter is not valid
412 #endif
413 
414 //Maximum number of access descriptions
415 #ifndef X509_MAX_ACCESS_DESCRIPTIONS
416  #define X509_MAX_ACCESS_DESCRIPTIONS 2
417 #elif (X509_MAX_ACCESS_DESCRIPTIONS < 1)
418  #error X509_MAX_ACCESS_DESCRIPTIONS parameter is not valid
419 #endif
420 
421 //Maximum number of custom extensions
422 #ifndef X509_MAX_CUSTOM_EXTENSIONS
423  #define X509_MAX_CUSTOM_EXTENSIONS 2
424 #elif (X509_MAX_CUSTOM_EXTENSIONS < 1)
425  #error X509_MAX_CUSTOM_EXTENSIONS parameter is not valid
426 #endif
427 
428 //Application specific extensions
429 #ifndef X509_PRIVATE_EXTENSIONS
430  #define X509_PRIVATE_EXTENSIONS
431 #endif
432 
433 //C++ guard
434 #ifdef __cplusplus
435 extern "C" {
436 #endif
437 
438 
439 /**
440  * @brief PKCS #1 versions
441  **/
442 
443 typedef enum
444 {
445  PKCS1_VERSION_1 = 0
447 
448 
449 /**
450  * @brief PKCS #8 versions
451  **/
452 
453 typedef enum
454 {
456  PKCS8_VERSION_2 = 1
458 
459 
460 /**
461  * @brief X.509 versions
462  **/
463 
464 typedef enum
465 {
468  X509_VERSION_3 = 2
470 
471 
472 /**
473  * @brief Key usage
474  **/
475 
476 typedef enum
477 {
488 
489 
490 /**
491  * @brief Extended key usage
492  **/
493 
494 typedef enum
495 {
509  X509_EXT_KEY_USAGE_ANY = 0x00001FFF
511 
512 
513 /**
514  * @brief General name types
515  **/
516 
517 typedef enum
518 {
529 
530 
531 /**
532  * @brief Netscape certificate types
533  **/
534 
535 typedef enum
536 {
541 
542 
543 /**
544  * @brief Reason flags
545  **/
546 
547 typedef enum
548 {
559 
560 
561 /**
562  * @brief CRL reasons
563  **/
564 
565 typedef enum
566 {
578 
579 
580 /**
581  * @brief Public Key types
582  **/
583 
584 typedef enum
585 {
597 
598 
599 /**
600  * @brief Signature algorithms
601  **/
602 
603 typedef enum
604 {
614 
615 
616 /**
617  * @brief Hash algorithms
618  **/
619 
620 typedef enum
621 {
633  X509_HASH_ALGO_SM3 = 11
635 
636 
637 /**
638  * @brief String
639  **/
640 
641 typedef struct
642 {
643  const char_t *value;
644  size_t length;
645 } X509String;
646 
647 
648 /**
649  * @brief Octet string
650  **/
651 
652 typedef struct
653 {
654  const uint8_t *value;
655  size_t length;
657 
658 
659 /**
660  * @brief Serial number
661  **/
662 
663 typedef struct
664 {
665  const uint8_t *value;
666  size_t length;
668 
669 
670 /**
671  * @brief Issuer or subject name
672  **/
673 
674 typedef struct
675 {
695 } X509Name;
696 
697 
698 /**
699  * @brief Name attribute
700  **/
701 
702 typedef struct
703 {
708 
709 
710 /**
711  * @brief Validity
712  **/
713 
714 typedef struct
715 {
718 } X509Validity;
719 
720 
721 /**
722  * @brief Algorithm identifier
723  **/
724 
725 typedef struct
726 {
729 } X509AlgoId;
730 
731 
732 /**
733  * @brief RSA public key
734  **/
735 
736 typedef struct
737 {
741 
742 
743 /**
744  * @brief DSA domain parameters
745  **/
746 
747 typedef struct
748 {
753 
754 
755 /**
756  * @brief DSA public key
757  **/
758 
759 typedef struct
760 {
763 
764 
765 /**
766  * @brief EC parameters
767  **/
768 
769 typedef struct
770 {
773 
774 
775 /**
776  * @brief EC public key
777  **/
778 
779 typedef struct
780 {
783 
784 
785 /**
786  * @brief Subject Public Key Information extension
787  **/
788 
789 typedef struct
790 {
794 #if (RSA_SUPPORT == ENABLED)
796 #endif
797 #if (DSA_SUPPORT == ENABLED)
800 #endif
801 #if (EC_SUPPORT == ENABLED || ED25519_SUPPORT == ENABLED || ED448_SUPPORT == ENABLED)
804 #endif
806 
807 
808 /**
809  * @brief Basic Constraints extension
810  **/
811 
812 typedef struct
813 {
818 
819 
820 /**
821  * @brief Name Constraints extension
822  **/
823 
824 typedef struct
825 {
830 
831 
832 /**
833  * @brief Key Usage extension
834  **/
835 
836 typedef struct
837 {
839  uint16_t bitmap;
840 } X509KeyUsage;
841 
842 
843 /**
844  * @brief Extended Key Usage extension
845  **/
846 
847 typedef struct
848 {
850  uint16_t bitmap;
852 
853 
854 /**
855  * @brief General name
856  **/
857 
858 typedef struct
859 {
861  const char_t *value;
862  size_t length;
864 
865 
866 /**
867  * @brief Subject Alternative Name extension
868  **/
869 
870 typedef struct
871 {
877 
878 
879 /**
880  * @brief Subject Key Identifier extension
881  **/
882 
883 typedef struct
884 {
886  const uint8_t *value;
887  size_t length;
889 
890 
891 /**
892  * @brief Authority Key Identifier extension
893  **/
894 
895 typedef struct
896 {
899 } X509AuthKeyId;
900 
901 
902 /**
903  * @brief Distribution Point Name structure
904  **/
905 
906 typedef struct
907 {
912 
913 
914 /**
915  * @brief Distribution Point structure
916  **/
917 
918 typedef struct
919 {
921  uint16_t reasonFlags;
925 
926 
927 /**
928  * @brief CRL Distribution Points extension
929  **/
930 
931 typedef struct
932 {
938 
939 
940 /**
941  * @brief Access Description extension
942  **/
943 
944 typedef struct
945 {
949 
950 
951 /**
952  * @brief Authority Information Access extension
953  **/
954 
955 typedef struct
956 {
962 
963 
964 /**
965  * @brief PKIX OCSP No Check extension
966  **/
967 
968 typedef struct
969 {
973 
974 
975 /**
976  * @brief Netscape certificate type
977  **/
978 
979 typedef struct
980 {
982  uint8_t bitmap;
984 
985 
986 /**
987  * @brief X.509 certificate extension
988  **/
989 
990 typedef struct
991 {
995 } X509Extension;
996 
997 
998 /**
999  * @brief X.509 certificate extensions
1000  **/
1001 
1002 typedef struct
1003 {
1019 } X509Extensions;
1020 
1021 
1022 /**
1023  * @brief RSASSA-PSS parameters
1024  **/
1025 
1026 typedef struct
1027 {
1031  size_t saltLen;
1033 
1034 
1035 /**
1036  * @brief Signature algorithm identifier
1037  **/
1038 
1039 typedef struct
1040 {
1042 #if (X509_RSA_PSS_SUPPORT == ENABLED && RSA_SUPPORT == ENABLED)
1044 #endif
1045 } X509SignAlgoId;
1046 
1047 
1048 /**
1049  * @brief TBSCertificate structure
1050  **/
1051 
1052 typedef struct
1053 {
1064 
1065 
1066 /**
1067  * @brief X.509 certificate
1068  **/
1069 
1070 typedef struct
1071 {
1075 } X509CertInfo;
1076 
1077 
1078 /**
1079  * @brief CRL Reason extension
1080  **/
1081 
1082 typedef struct
1083 {
1085  uint8_t value;
1086 } X509CrlReason;
1087 
1088 
1089 /**
1090  * @brief Invalidity Date extension
1091  **/
1092 
1093 typedef struct
1094 {
1098 
1099 
1100 /**
1101  * @brief Certificate Issuer extension
1102  **/
1103 
1104 typedef struct
1105 {
1111 
1112 
1113 /**
1114  * @brief CRL entry extensions
1115  **/
1116 
1117 typedef struct
1118 {
1124 
1125 
1126 /**
1127  * @brief Revoked certificate
1128  **/
1129 
1130 typedef struct
1131 {
1136 
1137 
1138 /**
1139  * @brief CRL number
1140  **/
1141 
1142 typedef struct
1143 {
1145  const uint8_t *value;
1146  size_t length;
1147 } X509CrlNumber;
1148 
1149 
1150 /**
1151  * @brief Delta CRL Indicator extension
1152  **/
1153 
1154 typedef struct
1155 {
1159 
1160 
1161 /**
1162  * @brief Issuing Distribution Point extension
1163  **/
1164 
1165 typedef struct
1166 {
1175 
1176 
1177 /**
1178  * @brief CRL extensions
1179  **/
1180 
1181 typedef struct
1182 {
1189 
1190 
1191 /**
1192  * @brief TBSCertList structure
1193  **/
1194 
1195 typedef struct
1196 {
1205 } X509TbsCertList;
1206 
1207 
1208 /**
1209  * @brief CRL (Certificate Revocation List)
1210  **/
1211 
1212 typedef struct
1213 {
1217 } X509CrlInfo;
1218 
1219 
1220 /**
1221  * @brief PKCS #9 ChallengePassword attribute
1222  **/
1223 
1224 typedef struct
1225 {
1226  const char_t *value;
1227  size_t length;
1229 
1230 
1231 /**
1232  * @brief CSR attribute
1233  **/
1234 
1235 typedef struct
1236 {
1239 } X509Attribute;
1240 
1241 
1242 /**
1243  * @brief CSR attributes
1244  **/
1245 
1246 typedef struct
1247 {
1251 } X509Attributes;
1252 
1253 
1254 /**
1255  * @brief CertificationRequestInfo structure
1256  **/
1257 
1258 typedef struct
1259 {
1266 
1267 
1268 /**
1269  * @brief CSR (Certificate Signing Request)
1270  **/
1271 
1272 typedef struct
1273 {
1277 } X509CsrInfo;
1278 
1279 
1280 //X.509 related constants
1281 extern const uint8_t X509_COMMON_NAME_OID[3];
1282 extern const uint8_t X509_SURNAME_OID[3];
1283 extern const uint8_t X509_SERIAL_NUMBER_OID[3];
1284 extern const uint8_t X509_COUNTRY_NAME_OID[3];
1285 extern const uint8_t X509_LOCALITY_NAME_OID[3];
1286 extern const uint8_t X509_STATE_OR_PROVINCE_NAME_OID[3];
1287 extern const uint8_t X509_ORGANIZATION_NAME_OID[3];
1288 extern const uint8_t X509_ORGANIZATIONAL_UNIT_NAME_OID[3];
1289 extern const uint8_t X509_TITLE_OID[3];
1290 extern const uint8_t X509_NAME_OID[3];
1291 extern const uint8_t X509_GIVEN_NAME_OID[3];
1292 extern const uint8_t X509_INITIALS_OID[3];
1293 extern const uint8_t X509_GENERATION_QUALIFIER_OID[3];
1294 extern const uint8_t X509_DN_QUALIFIER_OID[3];
1295 extern const uint8_t X509_PSEUDONYM_OID[3];
1296 extern const uint8_t X509_DOMAIN_COMPONENT_OID[10];
1297 
1298 extern const uint8_t X509_SUBJECT_DIR_ATTR_OID[3];
1299 extern const uint8_t X509_SUBJECT_KEY_ID_OID[3];
1300 extern const uint8_t X509_KEY_USAGE_OID[3];
1301 extern const uint8_t X509_SUBJECT_ALT_NAME_OID[3];
1302 extern const uint8_t X509_ISSUER_ALT_NAME_OID[3];
1303 extern const uint8_t X509_BASIC_CONSTRAINTS_OID[3];
1304 extern const uint8_t X509_CRL_NUMBER_OID[3];
1305 extern const uint8_t X509_REASON_CODE_OID[3];
1306 extern const uint8_t X509_INVALIDITY_DATE_OID[3];
1307 extern const uint8_t X509_DELTA_CRL_INDICATOR_OID[3];
1308 extern const uint8_t X509_ISSUING_DISTR_POINT_OID[3];
1309 extern const uint8_t X509_CERTIFICATE_ISSUER_OID[3];
1310 extern const uint8_t X509_NAME_CONSTRAINTS_OID[3];
1311 extern const uint8_t X509_CRL_DISTR_POINTS_OID[3];
1312 extern const uint8_t X509_CERTIFICATE_POLICIES_OID[3];
1313 extern const uint8_t X509_POLICY_MAPPINGS_OID[3];
1314 extern const uint8_t X509_AUTHORITY_KEY_ID_OID[3];
1315 extern const uint8_t X509_POLICY_CONSTRAINTS_OID[3];
1316 extern const uint8_t X509_EXTENDED_KEY_USAGE_OID[3];
1317 extern const uint8_t X509_FRESHEST_CRL_OID[3];
1318 extern const uint8_t X509_INHIBIT_ANY_POLICY_OID[3];
1319 extern const uint8_t X509_AUTH_INFO_ACCESS_OID[8];
1320 extern const uint8_t X509_PKIX_OCSP_NO_CHECK_OID[9];
1321 extern const uint8_t X509_NS_CERT_TYPE_OID[9];
1322 
1323 extern const uint8_t X509_ANY_EXT_KEY_USAGE_OID[4];
1324 extern const uint8_t X509_KP_SERVER_AUTH_OID[8];
1325 extern const uint8_t X509_KP_CLIENT_AUTH_OID[8];
1326 extern const uint8_t X509_KP_CODE_SIGNING_OID[8];
1327 extern const uint8_t X509_KP_EMAIL_PROTECTION_OID[8];
1328 extern const uint8_t X509_KP_IPSEC_END_SYSTEM_OID[8];
1329 extern const uint8_t X509_KP_IPSEC_TUNNEL_OID[8];
1330 extern const uint8_t X509_KP_IPSEC_USER_OID[8];
1331 extern const uint8_t X509_KP_TIME_STAMPING_OID[8];
1332 extern const uint8_t X509_KP_OCSP_SIGNING_OID[8];
1333 extern const uint8_t X509_KP_IPSEC_IKE_OID[8];
1334 extern const uint8_t X509_KP_SSH_CLIENT_OID[8];
1335 extern const uint8_t X509_KP_SSH_SERVER_OID[8];
1336 extern const uint8_t X509_KP_DOC_SIGNING_OID[8];
1337 
1338 extern const uint8_t X509_AD_CA_ISSUERS[8];
1339 extern const uint8_t X509_AD_OCSP[8];
1340 
1341 extern const uint8_t X509_EMAIL_ADDRESS_OID[9];
1342 extern const uint8_t X509_CHALLENGE_PASSWORD_OID[9];
1343 extern const uint8_t X509_EXTENSION_REQUEST_OID[9];
1344 
1345 //X.509 related functions
1348 bool_t x509IsCurveSupported(const uint8_t *oid, size_t length);
1349 
1350 error_t x509GetSignHashAlgo(const X509SignAlgoId *signAlgoId,
1351  X509SignatureAlgo *signAlgo, const HashAlgo **hashAlgo);
1352 
1353 X509KeyType x509GetPublicKeyType(const uint8_t *oid, size_t length);
1354 const EcCurveInfo *x509GetCurveInfo(const uint8_t *oid, size_t length);
1355 
1356 //C++ guard
1357 #ifdef __cplusplus
1358 }
1359 #endif
1360 
1361 #endif
@ X509_GENERAL_NAME_TYPE_REGISTERED_ID
Definition: x509_common.h:527
X509Validity validity
Definition: x509_common.h:1059
const uint8_t X509_KP_SERVER_AUTH_OID[8]
Definition: x509_common.c:130
@ X509_GENERAL_NAME_TYPE_X400_ADDRESS
Definition: x509_common.h:522
X509CrlDistrPoints crlDistrPoints
Definition: x509_common.h:1012
#define X509_MAX_FULL_NAMES
Definition: x509_common.h:409
@ X509_KEY_TYPE_RSA
Definition: x509_common.h:587
@ X509_EXT_KEY_USAGE_ANY
Definition: x509_common.h:509
Date and time management.
CRL entry extensions.
Definition: x509_common.h:1118
@ PKCS8_VERSION_2
Definition: x509_common.h:456
const uint8_t X509_ORGANIZATIONAL_UNIT_NAME_OID[3]
Definition: x509_common.c:60
@ X509_EXT_KEY_USAGE_SSH_CLIENT
Definition: x509_common.h:506
X509AuthInfoAccess authInfoAccess
Definition: x509_common.h:1013
X509GeneralNameType type
Definition: x509_common.h:860
@ X509_NS_CERT_TYPE_SSL_SERVER
Definition: x509_common.h:538
@ X509_EXT_KEY_USAGE_IPSEC_IKE
Definition: x509_common.h:505
int bool_t
Definition: compiler_port.h:53
X509SignAlgoId signatureAlgo
Definition: x509_common.h:1073
X509GeneralName accessLocation
Definition: x509_common.h:947
const uint8_t X509_INHIBIT_ANY_POLICY_OID[3]
Definition: x509_common.c:119
X509DistrPointName distrPointName
Definition: x509_common.h:920
const uint8_t * value
Definition: x509_common.h:665
const uint8_t X509_KEY_USAGE_OID[3]
Definition: x509_common.c:83
X509OctetString params
Definition: x509_common.h:728
X509ReasonFlags
Reason flags.
Definition: x509_common.h:548
X509TbsCertificate tbsCert
Definition: x509_common.h:1072
@ X509_CRL_REASON_CA_COMPROMISE
Definition: x509_common.h:569
X509OctetString accessMethod
Definition: x509_common.h:946
X509OctetString g
Definition: x509_common.h:751
Pkcs1Version
PKCS #1 versions.
Definition: x509_common.h:444
TBSCertificate structure.
Definition: x509_common.h:1053
signed int int_t
Definition: compiler_port.h:49
@ X509_KEY_TYPE_X448
Definition: x509_common.h:594
X509String givenName
Definition: x509_common.h:687
X509OctetString p
Definition: x509_common.h:749
#define X509_MAX_CRL_ISSUERS
Definition: x509_common.h:395
X509Extensions extensions
Definition: x509_common.h:1062
X509OctetString baseCrlNumber
Definition: x509_common.h:1157
X509DsaPublicKey dsaPublicKey
Definition: x509_common.h:799
@ X509_REASON_FLAGS_PRIVILEGE_WITHDRAWN
Definition: x509_common.h:556
const uint8_t X509_EXTENDED_KEY_USAGE_OID[3]
Definition: x509_common.c:115
X509OctetString raw
Definition: x509_common.h:873
X509OctetString hashAlgo
Definition: x509_common.h:1028
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:715
X509KeyUsage keyUsage
Definition: x509_common.h:1007
X509OctetString oid
Definition: x509_common.h:792
X509OctetString raw
Definition: x509_common.h:1054
X509KeyType x509GetPublicKeyType(const uint8_t *oid, size_t length)
Get the public key type that matches the specified OID.
Definition: x509_common.c:829
const uint8_t X509_POLICY_CONSTRAINTS_OID[3]
Definition: x509_common.c:113
X509OctetString raw
Definition: x509_common.h:934
X509SignAlgoId signatureAlgo
Definition: x509_common.h:1057
@ X509_REASON_FLAGS_AFFILIATION_CHANGED
Definition: x509_common.h:552
bool_t critical
Definition: x509_common.h:993
X509String stateOrProvinceName
Definition: x509_common.h:682
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:691
X509OctetString raw
Definition: x509_common.h:1004
X509EcParameters ecParams
Definition: x509_common.h:802
const char_t * value
Definition: x509_common.h:1226
@ X509_GENERAL_NAME_TYPE_RFC822
Definition: x509_common.h:520
X509ExtendedKeyUsage extKeyUsage
Definition: x509_common.h:1008
const uint8_t X509_KP_OCSP_SIGNING_OID[8]
Definition: x509_common.c:146
X509NsCertType nsCertType
Definition: x509_common.h:1015
X509SignAlgoId signatureAlgo
Definition: x509_common.h:1275
X509OctetString maskGenHashAlgo
Definition: x509_common.h:1030
Pkcs8Version
PKCS #8 versions.
Definition: x509_common.h:454
const uint8_t X509_DN_QUALIFIER_OID[3]
Definition: x509_common.c:72
@ X509_KEY_USAGE_DATA_ENCIPHERMENT
Definition: x509_common.h:481
@ X509_GENERAL_NAME_TYPE_URI
Definition: x509_common.h:525
#define X509_PRIVATE_EXTENSIONS
Definition: x509_common.h:430
@ X509_EXT_KEY_USAGE_IPSEC_USER
Definition: x509_common.h:502
X509Extensions extensionReq
Definition: x509_common.h:1250
const uint8_t X509_SUBJECT_DIR_ATTR_OID[3]
Definition: x509_common.c:79
X509String name
Definition: x509_common.h:686
X509String title
Definition: x509_common.h:685
X509String organizationName
Definition: x509_common.h:683
const uint8_t X509_SUBJECT_ALT_NAME_OID[3]
Definition: x509_common.c:85
@ X509_VERSION_1
Definition: x509_common.h:466
@ X509_EXT_KEY_USAGE_CLIENT_AUTH
Definition: x509_common.h:497
CRL (Certificate Revocation List)
Definition: x509_common.h:1213
@ X509_EXT_KEY_USAGE_SSH_SERVER
Definition: x509_common.h:507
@ X509_EXT_KEY_USAGE_IPSEC_END_SYSTEM
Definition: x509_common.h:500
bool_t critical
Definition: x509_common.h:897
Invalidity Date extension.
Definition: x509_common.h:1094
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:381
@ X509_CRL_REASON_AA_COMPROMISE
Definition: x509_common.h:576
size_t length
Definition: x509_common.h:644
@ X509_KEY_USAGE_ENCIPHER_ONLY
Definition: x509_common.h:485
Subject Key Identifier extension.
Definition: x509_common.h:884
X509String commonName
Definition: x509_common.h:677
@ X509_GENERAL_NAME_TYPE_DIRECTORY
Definition: x509_common.h:523
uint8_t oid[]
Definition: lldp_tlv.h:300
X509DeltaCrlIndicator deltaCrlIndicator
Definition: x509_common.h:1185
X509AuthKeyId authKeyId
Definition: x509_common.h:1011
const uint8_t X509_NAME_OID[3]
Definition: x509_common.c:64
@ X509_CRL_REASON_SUPERSEDED
Definition: x509_common.h:571
const uint8_t X509_AD_CA_ISSUERS[8]
Definition: x509_common.c:157
X509OctetString q
Definition: x509_common.h:750
EC public key.
Definition: x509_common.h:780
const uint8_t X509_ANY_EXT_KEY_USAGE_OID[4]
Definition: x509_common.c:128
String.
Definition: x509_common.h:642
@ X509_CRL_REASON_AFFILIATION_CHANGED
Definition: x509_common.h:570
Distribution Point Name structure.
Definition: x509_common.h:907
@ X509_GENERAL_NAME_TYPE_EDI_PARTY
Definition: x509_common.h:524
uint_t numAccessDescriptions
Definition: x509_common.h:959
const EcCurveInfo * x509GetCurveInfo(const uint8_t *oid, size_t length)
Get the elliptic curve that matches the specified OID.
Definition: x509_common.c:910
X509String initials
Definition: x509_common.h:688
X509SignAlgoId signatureAlgo
Definition: x509_common.h:1199
@ PKCS1_VERSION_1
Definition: x509_common.h:445
X509CrlReasons
CRL reasons.
Definition: x509_common.h:566
@ X509_KEY_TYPE_EC
Definition: x509_common.h:590
X509SubjectPublicKeyInfo subjectPublicKeyInfo
Definition: x509_common.h:1263
X509OctetString y
Definition: x509_common.h:761
DateTime notAfter
Definition: x509_common.h:717
Certificate Issuer extension.
Definition: x509_common.h:1105
X509SignatureAlgo
Signature algorithms.
Definition: x509_common.h:604
Authority Information Access extension.
Definition: x509_common.h:956
@ X509_KEY_USAGE_NON_REPUDIATION
Definition: x509_common.h:479
Elliptic curve parameters.
Definition: ec_curves.h:302
const uint8_t X509_DELTA_CRL_INDICATOR_OID[3]
Definition: x509_common.c:97
General name.
Definition: x509_common.h:859
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:838
X509OctetString raw
Definition: x509_common.h:1183
X509OctetString raw
Definition: x509_common.h:1197
@ X509_KEY_TYPE_SM2
Definition: x509_common.h:591
const uint8_t * value
Definition: x509_common.h:1145
X509CrlNumber crlNumber
Definition: x509_common.h:1184
@ X509_GENERAL_NAME_TYPE_DNS
Definition: x509_common.h:521
X.509 certificate.
Definition: x509_common.h:1071
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:770
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:703
Extended Key Usage extension.
Definition: x509_common.h:848
Distribution Point structure.
Definition: x509_common.h:919
X509BasicConstraints basicConstraints
Definition: x509_common.h:1005
RSA public key.
Definition: x509_common.h:737
X509Version
X.509 versions.
Definition: x509_common.h:465
@ X509_KEY_USAGE_DECIPHER_ONLY
Definition: x509_common.h:486
X509InvalidityDate invalidityDate
Definition: x509_common.h:1121
X509OctetString signatureValue
Definition: x509_common.h:1216
X509Version version
Definition: x509_common.h:1055
X509CrlEntryExtensions crlEntryExtensions
Definition: x509_common.h:1134
X509NameAttribute relativeName
Definition: x509_common.h:910
X509OctetString permittedSubtrees
Definition: x509_common.h:827
@ X509_SIGN_ALGO_ECDSA
Definition: x509_common.h:609
@ X509_CRL_REASON_CESSATION_OF_OPERATION
Definition: x509_common.h:572
@ X509_HASH_ALGO_NONE
Definition: x509_common.h:622
CSR attribute.
Definition: x509_common.h:1236
uint16_t reasonFlags
Definition: x509_common.h:921
TBSCertList structure.
Definition: x509_common.h:1196
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:555
X509AuthKeyId authKeyId
Definition: x509_common.h:1187
X509String emailAddress
Definition: x509_common.h:692
X509RsaPublicKey rsaPublicKey
Definition: x509_common.h:795
@ X509_KEY_USAGE_KEY_AGREEMENT
Definition: x509_common.h:482
Collection of signature algorithms.
@ X509_REASON_FLAGS_CA_COMPROMISE
Definition: x509_common.h:551
X509OctetString oid
Definition: x509_common.h:1237
X509OctetString oid
Definition: x509_common.h:727
EdDSA (Edwards-Curve Digital Signature Algorithm)
#define X509_MAX_ACCESS_DESCRIPTIONS
Definition: x509_common.h:416
@ X509_VERSION_3
Definition: x509_common.h:468
X.509 certificate extension.
Definition: x509_common.h:991
@ X509_HASH_ALGO_SHA1
Definition: x509_common.h:624
const uint8_t X509_AD_OCSP[8]
Definition: x509_common.c:159
Authority Key Identifier extension.
Definition: x509_common.h:896
General definitions for cryptographic algorithms.
X509Version version
Definition: x509_common.h:1261
X509CertRequestInfo certReqInfo
Definition: x509_common.h:1274
X509PkixOcspNoCheck pkixOcspNoCheck
Definition: x509_common.h:1014
RSA public-key cryptography standard.
X509OctetString raw
Definition: x509_common.h:791
X509OctetString raw
Definition: x509_common.h:1248
X509SerialNumber serialNumber
Definition: x509_common.h:1056
@ X509_HASH_ALGO_SHA3_224
Definition: x509_common.h:629
X509OctetString excludedSubtrees
Definition: x509_common.h:828
PKIX OCSP No Check extension.
Definition: x509_common.h:969
DSA (Digital Signature Algorithm)
@ X509_REASON_FLAGS_AA_COMPROMISE
Definition: x509_common.h:557
X509OctetString signatureValue
Definition: x509_common.h:1074
const uint8_t X509_KP_EMAIL_PROTECTION_OID[8]
Definition: x509_common.c:136
X509OctetString raw
Definition: x509_common.h:1107
@ X509_KEY_TYPE_RSA_PSS
Definition: x509_common.h:588
X509String serialNumber
Definition: x509_common.h:679
X509OctetString raw
Definition: x509_common.h:1260
@ X509_EXT_KEY_USAGE_SERVER_AUTH
Definition: x509_common.h:496
X509DsaParameters dsaParams
Definition: x509_common.h:798
Date and time representation.
Definition: date_time.h:47
@ X509_KEY_USAGE_DIGITAL_SIGNATURE
Definition: x509_common.h:478
#define X509_MAX_CUSTOM_EXTENSIONS
Definition: x509_common.h:423
@ X509_HASH_ALGO_SHA224
Definition: x509_common.h:625
uint8_t length
Definition: tcp.h:368
Revoked certificate.
Definition: x509_common.h:1131
const uint8_t X509_CRL_DISTR_POINTS_OID[3]
Definition: x509_common.c:105
@ PKCS8_VERSION_1
Definition: x509_common.h:455
@ X509_CRL_REASON_CERTIFICATE_HOLD
Definition: x509_common.h:573
X509OctetString oid
Definition: x509_common.h:1041
X509OctetString maskGenAlgo
Definition: x509_common.h:1029
uint16_t bitmap
Definition: x509_common.h:839
X509TbsCertList tbsCertList
Definition: x509_common.h:1214
X509HashAlgo
Hash algorithms.
Definition: x509_common.h:621
CertificationRequestInfo structure.
Definition: x509_common.h:1259
X509CrlExtensions crlExtensions
Definition: x509_common.h:1204
X509SubjectAltName subjectAltName
Definition: x509_common.h:1009
Subject Alternative Name extension.
Definition: x509_common.h:871
@ X509_EXT_KEY_USAGE_DOC_SIGNING
Definition: x509_common.h:508
const uint8_t X509_KP_IPSEC_TUNNEL_OID[8]
Definition: x509_common.c:140
@ X509_SIGN_ALGO_RSA
Definition: x509_common.h:606
Access Description extension.
Definition: x509_common.h:945
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:503
X509OctetString namedCurve
Definition: x509_common.h:771
X509String surname
Definition: x509_common.h:678
X509KeyUsageBitmap
Key usage.
Definition: x509_common.h:477
const uint8_t X509_KP_TIME_STAMPING_OID[8]
Definition: x509_common.c:144
Netscape certificate type.
Definition: x509_common.h:980
@ X509_EXT_KEY_USAGE_IPSEC_TUNNEL
Definition: x509_common.h:501
@ X509_NS_CERT_TYPE_SSL_CLIENT
Definition: x509_common.h:537
const char_t * value
Definition: x509_common.h:861
bool_t onlyContainsAttributeCerts
Definition: x509_common.h:1173
@ X509_HASH_ALGO_SHA3_512
Definition: x509_common.h:632
char char_t
Definition: compiler_port.h:48
X509SignAlgoId signatureAlgo
Definition: x509_common.h:1215
@ X509_HASH_ALGO_MD5
Definition: x509_common.h:623
@ X509_VERSION_2
Definition: x509_common.h:467
X509IssuingDistrPoint issuingDistrPoint
Definition: x509_common.h:1186
bool_t x509IsHashAlgoSupported(X509HashAlgo hashAlgo)
Check whether a given hash algorithm is supported.
Definition: x509_common.c:250
X509String generationQualifier
Definition: x509_common.h:689
@ X509_REASON_FLAGS_SUPERSEDED
Definition: x509_common.h:553
const uint8_t X509_ISSUER_ALT_NAME_OID[3]
Definition: x509_common.c:87
uint_t numCustomExtensions
Definition: x509_common.h:1016
X509ExtKeyUsageBitmap
Extended key usage.
Definition: x509_common.h:495
DateTime notBefore
Definition: x509_common.h:716
X509OctetString data
Definition: x509_common.h:1238
X509OctetString q
Definition: x509_common.h:781
@ X509_SIGN_ALGO_RSA_PSS
Definition: x509_common.h:607
const char_t * value
Definition: x509_common.h:643
const uint8_t X509_LOCALITY_NAME_OID[3]
Definition: x509_common.c:54
#define X509_MAX_DOMAIN_COMPONENTS
Definition: x509_common.h:374
const uint8_t X509_SURNAME_OID[3]
Definition: x509_common.c:48
@ X509_KEY_TYPE_ED448
Definition: x509_common.h:595
X509OctetString signatureValue
Definition: x509_common.h:1276
@ X509_HASH_ALGO_SHA3_256
Definition: x509_common.h:630
@ X509_HASH_ALGO_SHA3_384
Definition: x509_common.h:631
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:675
X509CertificateIssuer certIssuer
Definition: x509_common.h:1122
X509OctetString n
Definition: x509_common.h:738
X509OctetString e
Definition: x509_common.h:739
Subject Public Key Information extension.
Definition: x509_common.h:790
@ X509_CRL_REASON_KEY_COMPROMISE
Definition: x509_common.h:568
@ X509_HASH_ALGO_SHA512
Definition: x509_common.h:628
const uint8_t X509_COMMON_NAME_OID[3]
Definition: x509_common.c:46
CRL extensions.
Definition: x509_common.h:1182
DSA domain parameters.
Definition: x509_common.h:748
const uint8_t X509_KP_IPSEC_END_SYSTEM_OID[8]
Definition: x509_common.c:138
X509CrlReason reasonCode
Definition: x509_common.h:1120
@ X509_KEY_TYPE_DSA
Definition: x509_common.h:589
@ X509_REASON_FLAGS_KEY_COMPROMISE
Definition: x509_common.h:550
X509DistrPointName distributionPoint
Definition: x509_common.h:1168
X509OctetString raw
Definition: x509_common.h:958
const uint8_t X509_STATE_OR_PROVINCE_NAME_OID[3]
Definition: x509_common.c:56
CRL Reason extension.
Definition: x509_common.h:1083
@ X509_REASON_FLAGS_CESSATION_OF_OPERATION
Definition: x509_common.h:554
Basic Constraints extension.
Definition: x509_common.h:813
CSR attributes.
Definition: x509_common.h:1247
#define X509_MAX_DISTR_POINTS
Definition: x509_common.h:402
@ X509_NS_CERT_TYPE_SSL_CA
Definition: x509_common.h:539
Delta CRL Indicator extension.
Definition: x509_common.h:1155
@ X509_HASH_ALGO_SHA384
Definition: x509_common.h:627
X509OctetString revokedCerts
Definition: x509_common.h:1203
const uint8_t X509_NS_CERT_TYPE_OID[9]
Definition: x509_common.c:125
DateTime thisUpdate
Definition: x509_common.h:1201
const uint8_t X509_CERTIFICATE_ISSUER_OID[3]
Definition: x509_common.c:101
@ X509_HASH_ALGO_SHA256
Definition: x509_common.h:626
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:1027
X509String organizationalUnitName
Definition: x509_common.h:684
@ X509_EXT_KEY_USAGE_OCSP_SIGNING
Definition: x509_common.h:504
Name Constraints extension.
Definition: x509_common.h:825
X.509 certificate extensions.
Definition: x509_common.h:1003
X509OctetString rawSubjectPublicKey
Definition: x509_common.h:793
CRL Distribution Points extension.
Definition: x509_common.h:932
const uint8_t X509_ISSUING_DISTR_POINT_OID[3]
Definition: x509_common.c:99
X509NameConstraints nameConstraints
Definition: x509_common.h:1006
const uint8_t X509_INITIALS_OID[3]
Definition: x509_common.c:68
X509OctetString oid
Definition: x509_common.h:704
X509String dnQualifier
Definition: x509_common.h:690
const uint8_t X509_KP_DOC_SIGNING_OID[8]
Definition: x509_common.c:154
X509OctetString oid
Definition: x509_common.h:992
const uint8_t X509_COUNTRY_NAME_OID[3]
Definition: x509_common.c:52
@ X509_EXT_KEY_USAGE_CODE_SIGNING
Definition: x509_common.h:498
const uint8_t * value
Definition: x509_common.h:654
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:1046
CRL number.
Definition: x509_common.h:1143
const uint8_t * value
Definition: x509_common.h:886
@ X509_KEY_TYPE_UNKNOWN
Definition: x509_common.h:586
@ X509_CRL_REASON_PRIVILEGE_WITHDRAWN
Definition: x509_common.h:575
uint_t numCrlIssuers
Definition: x509_common.h:922
@ X509_CRL_REMOVE_FROM_CRL
Definition: x509_common.h:574
X509SerialNumber userCert
Definition: x509_common.h:1132
const uint8_t X509_EMAIL_ADDRESS_OID[9]
Definition: x509_common.c:162
@ X509_GENERAL_NAME_TYPE_OTHER
Definition: x509_common.h:519
X509ChallengePassword challengePwd
Definition: x509_common.h:1249
@ X509_CRL_REASON_UNSPECIFIED
Definition: x509_common.h:567
X509String localityName
Definition: x509_common.h:681
const uint8_t X509_KP_SSH_SERVER_OID[8]
Definition: x509_common.c:152
@ X509_SIGN_ALGO_SM2
Definition: x509_common.h:610
Serial number.
Definition: x509_common.h:664
Octet string.
Definition: x509_common.h:653
@ X509_REASON_FLAGS_UNUSED
Definition: x509_common.h:549
X509OctetString keyId
Definition: x509_common.h:898
@ X509_SIGN_ALGO_ED25519
Definition: x509_common.h:611
unsigned int uint_t
Definition: compiler_port.h:50
Issuing Distribution Point extension.
Definition: x509_common.h:1166
DateTime nextUpdate
Definition: x509_common.h:1202
const uint8_t X509_FRESHEST_CRL_OID[3]
Definition: x509_common.c:117
uint8_t bitmap
Definition: x509_common.h:982
@ X509_KEY_TYPE_ED25519
Definition: x509_common.h:593
@ X509_GENERAL_NAME_TYPE_IP_ADDRESS
Definition: x509_common.h:526
X509OctetString data
Definition: x509_common.h:994
@ X509_KEY_USAGE_KEY_ENCIPHERMENT
Definition: x509_common.h:480
const uint8_t X509_BASIC_CONSTRAINTS_OID[3]
Definition: x509_common.c:89
X509KeyType
Public Key types.
Definition: x509_common.h:585
X509EcPublicKey ecPublicKey
Definition: x509_common.h:803
X509SubjectPublicKeyInfo subjectPublicKeyInfo
Definition: x509_common.h:1061
DSA public key.
Definition: x509_common.h:760
const uint8_t X509_KP_IPSEC_USER_OID[8]
Definition: x509_common.c:142
X509GeneralNameType
General name types.
Definition: x509_common.h:518
X509SubjectKeyId subjectKeyId
Definition: x509_common.h:1010
X509String data
Definition: x509_common.h:706
X509Version version
Definition: x509_common.h:1198
CSR (Certificate Signing Request)
Definition: x509_common.h:1273
@ X509_SIGN_ALGO_NONE
Definition: x509_common.h:605
X509Attributes attributes
Definition: x509_common.h:1264
#define X509_MAX_CERT_ISSUERS
Definition: x509_common.h:388
@ X509_EXT_KEY_USAGE_EMAIL_PROTECTION
Definition: x509_common.h:499
@ X509_HASH_ALGO_SM3
Definition: x509_common.h:633
X509RsaPssParameters rsaPssParams
Definition: x509_common.h:1043
uint_t numDomainComponents
Definition: x509_common.h:693
X509OctetString raw
Definition: x509_common.h:1119
@ X509_KEY_USAGE_CRL_SIGN
Definition: x509_common.h:484
X509OctetString raw
Definition: x509_common.h:676
PKCS #9 ChallengePassword attribute.
Definition: x509_common.h:1225
Signature algorithm identifier.
Definition: x509_common.h:1040
X509NsCertTypeBitmap
Netscape certificate types.
Definition: x509_common.h:536
Algorithm identifier.
Definition: x509_common.h:726
@ X509_KEY_TYPE_X25519
Definition: x509_common.h:592
@ X509_SIGN_ALGO_DSA
Definition: x509_common.h:608
X509String countryName
Definition: x509_common.h:680
@ X509_KEY_USAGE_KEY_CERT_SIGN
Definition: x509_common.h:483
@ X509_SIGN_ALGO_ED448
Definition: x509_common.h:612
Key Usage extension.
Definition: x509_common.h:837
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