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