x509_crl_ext_parse.c
Go to the documentation of this file.
1 /**
2  * @file x509_crl_ext_parse.c
3  * @brief CRL extension parsing
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 //Switch to the appropriate trace level
32 #define TRACE_LEVEL CRYPTO_TRACE_LEVEL
33 
34 //Dependencies
35 #include "core/crypto.h"
36 #include "pkix/x509_cert_parse.h"
38 #include "pkix/x509_crl_parse.h"
40 #include "encoding/asn1.h"
41 #include "encoding/oid.h"
42 #include "debug.h"
43 
44 //Check crypto library configuration
45 #if (X509_SUPPORT == ENABLED)
46 
47 
48 /**
49  * @brief Parse CRL extensions
50  * @param[in] data Pointer to the ASN.1 structure to parse
51  * @param[in] length Length of the ASN.1 structure
52  * @param[out] totalLength Number of bytes that have been parsed
53  * @param[out] crlExtensions Information resulting from the parsing process
54  * @return Error code
55  **/
56 
57 error_t x509ParseCrlExtensions(const uint8_t *data, size_t length,
58  size_t *totalLength, X509CrlExtensions *crlExtensions)
59 {
60  error_t error;
61  size_t n;
62  Asn1Tag tag;
63  X509Extension extension;
64 
65  //No more data to process?
66  if(length == 0)
67  {
68  //The CrlExtensions field is optional
69  *totalLength = 0;
70  //Exit immediately
71  return NO_ERROR;
72  }
73 
74  //Explicit tagging is used to encode the CrlExtensions field
75  error = asn1ReadTag(data, length, &tag);
76  //Failed to decode ASN.1 tag?
77  if(error)
78  return error;
79 
80  //Enforce encoding, class and type
82  //Invalid tag?
83  if(error)
84  {
85  //The CrlExtensions field is optional
86  *totalLength = 0;
87  //Exit immediately
88  return NO_ERROR;
89  }
90 
91  //Save the total length of the field
92  *totalLength = tag.totalLength;
93 
94  //Debug message
95  TRACE_DEBUG(" Parsing CrlExtensions...\r\n");
96 
97  //This field is a sequence of one or more CRL extensions
98  error = asn1ReadSequence(tag.value, tag.length, &tag);
99  //Failed to decode ASN.1 tag?
100  if(error)
101  return error;
102 
103  //Raw contents of the ASN.1 sequence
104  crlExtensions->raw.value = tag.value;
105  crlExtensions->raw.length = tag.length;
106 
107  //Point to the first item of the sequence
108  data = tag.value;
109  length = tag.length;
110 
111  //Loop through the extensions
112  while(length > 0)
113  {
114  //Each extension includes an OID and a value
115  error = x509ParseExtension(data, length, &n, &extension);
116  //Any error to report?
117  if(error)
118  return error;
119 
120  //Jump to the next extension
121  data += n;
122  length -= n;
123 
124  //Test if the current extension is a duplicate
125  error = x509CheckDuplicateExtension(extension.oid.value,
126  extension.oid.length, data, length);
127  //Duplicate extension found?
128  if(error)
129  return error;
130 
131  //Check extension identifier
132  if(!oidComp(extension.oid.value, extension.oid.length,
134  {
135  //Parse CRLNumber extension
136  error = x509ParseCrlNumber(extension.critical, extension.data.value,
137  extension.data.length, &crlExtensions->crlNumber);
138  }
139  else if(!oidComp(extension.oid.value, extension.oid.length,
141  {
142  //Parse DeltaCRLIndicator extension
143  error = x509ParseDeltaCrlIndicator(extension.critical, extension.data.value,
144  extension.data.length, &crlExtensions->deltaCrlIndicator);
145  }
146  else if(!oidComp(extension.oid.value, extension.oid.length,
148  {
149  //Parse IssuingDistributionPoint extension
150  error = x509ParseIssuingDistrPoint(extension.critical, extension.data.value,
151  extension.data.length, &crlExtensions->issuingDistrPoint);
152  }
153  else if(!oidComp(extension.oid.value, extension.oid.length,
155  {
156  //Parse AuthorityKeyIdentifier extension
157  error = x509ParseAuthKeyId(extension.critical, extension.data.value,
158  extension.data.length, &crlExtensions->authKeyId);
159  }
160  else
161  {
162  //Parse unknown extension
163  error = x509ParseUnknownCrlExtension(extension.oid.value,
164  extension.oid.length, extension.critical, extension.data.value,
165  extension.data.length, crlExtensions);
166 
167  //Check status code
168  if(error == ERROR_UNSUPPORTED_EXTENSION)
169  {
170  //If a CRL contains a critical extension that the application cannot
171  //process, then the application must not use that CRL to determine
172  //the status of certificates (refer to RFC 5280, section 5.2)
173  if(!extension.critical)
174  {
175  error = NO_ERROR;
176  }
177  }
178  }
179 
180  //Any parsing error?
181  if(error)
182  return error;
183  }
184 
185  //Successful processing
186  return NO_ERROR;
187 }
188 
189 
190 /**
191  * @brief Parse CRLNumber extension
192  * @param[in] critical Critical extension flag
193  * @param[in] data Pointer to the ASN.1 structure to parse
194  * @param[in] length Length of the ASN.1 structure
195  * @param[out] crlNumber Information resulting from the parsing process
196  * @return Error code
197  **/
198 
200  size_t length, X509CrlNumber *crlNumber)
201 {
202  error_t error;
203  Asn1Tag tag;
204 
205  //Debug message
206  TRACE_DEBUG(" Parsing CRLNumber...\r\n");
207 
208  //An CRL extension can be marked as critical
209  crlNumber->critical = critical;
210 
211  //Read CRLNumber structure
212  error = asn1ReadTag(data, length, &tag);
213  //Failed to decode ASN.1 tag?
214  if(error)
215  return error;
216 
217  //Enforce encoding, class and type
219  //Invalid tag?
220  if(error)
221  return error;
222 
223  //Save the CRL number
224  crlNumber->value = tag.value;
225  crlNumber->length = tag.length;
226 
227  //Successful processing
228  return NO_ERROR;
229 }
230 
231 
232 /**
233  * @brief Parse DeltaCRLIndicator extension
234  * @param[in] critical Critical extension flag
235  * @param[in] data Pointer to the ASN.1 structure to parse
236  * @param[in] length Length of the ASN.1 structure
237  * @param[out] deltaCrlIndicator Information resulting from the parsing process
238  * @return Error code
239  **/
240 
242  size_t length, X509DeltaCrlIndicator *deltaCrlIndicator)
243 {
244  error_t error;
245  Asn1Tag tag;
246 
247  //Debug message
248  TRACE_DEBUG(" Parsing DeltaCRLIndicator...\r\n");
249 
250  //An CRL extension can be marked as critical
251  deltaCrlIndicator->critical = critical;
252 
253  //Read BaseCRLNumber structure
254  error = asn1ReadTag(data, length, &tag);
255  //Failed to decode ASN.1 tag?
256  if(error)
257  return error;
258 
259  //Enforce encoding, class and type
261  //Invalid tag?
262  if(error)
263  return error;
264 
265  //Save the CRL number
266  deltaCrlIndicator->baseCrlNumber.value = tag.value;
267  deltaCrlIndicator->baseCrlNumber.length = tag.length;
268 
269  //Successful processing
270  return NO_ERROR;
271 }
272 
273 
274 /**
275  * @brief Parse IssuingDistributionPoint extension
276  * @param[in] critical Critical extension flag
277  * @param[in] data Pointer to the ASN.1 structure to parse
278  * @param[in] length Length of the ASN.1 structure
279  * @param[out] issuingDistrPoint Information resulting from the parsing process
280  * @return Error code
281  **/
282 
284  size_t length, X509IssuingDistrPoint *issuingDistrPoint)
285 {
286  error_t error;
287  Asn1Tag tag;
288 
289  //Debug message
290  TRACE_DEBUG(" Parsing IssuingDistributionPoint...\r\n");
291 
292  //An CRL extension can be marked as critical
293  issuingDistrPoint->critical = critical;
294 
295  //The IssuingDistributionPoint extension is encapsulated within a sequence
296  error = asn1ReadSequence(data, length, &tag);
297  //Failed to decode ASN.1 tag?
298  if(error)
299  return error;
300 
301  //Point to the first subfield of the sequence
302  data = tag.value;
303  length = tag.length;
304 
305  //The issuing distribution point is a critical CRL extension that identifies
306  //the CRL distribution point and scope for a particular CRL, and it indicates
307  //whether the CRL covers revocation for end entity certificates only, CA
308  //certificates only, attribute certificates only, or a limited set of reason
309  //codes
310  while(length > 0)
311  {
312  //Read current subfield
313  error = asn1ReadTag(data, length, &tag);
314  //Failed to decode ASN.1 tag?
315  if(error)
316  return error;
317 
318  //Implicit tagging shall be used to encode each subfield
320  return ERROR_INVALID_CLASS;
321 
322  //Check subfield type
323  if(tag.objType == 0)
324  {
325  //Parse distributionPoint subfield
326  }
327  else if(tag.objType == 1)
328  {
329  //Make sure the length of the boolean is valid
330  if(tag.length != 1)
331  return ERROR_INVALID_SYNTAX;
332 
333  //Save the value of the onlyContainsUserCerts subfield
334  issuingDistrPoint->onlyContainsUserCerts = tag.value[0] ? TRUE : FALSE;
335  }
336  else if(tag.objType == 2)
337  {
338  //Make sure the length of the boolean is valid
339  if(tag.length != 1)
340  return ERROR_INVALID_SYNTAX;
341 
342  //Save the value of the onlyContainsCACerts subfield
343  issuingDistrPoint->onlyContainsCaCerts = tag.value[0] ? TRUE : FALSE;
344  }
345  else if(tag.objType == 3)
346  {
347  //Parse onlySomeReasons subfield
348  }
349  else if(tag.objType == 4)
350  {
351  //Make sure the length of the boolean is valid
352  if(tag.length != 1)
353  return ERROR_INVALID_SYNTAX;
354 
355  //Save the value of the indirectCRL subfield
356  issuingDistrPoint->indirectCrl = tag.value[0] ? TRUE : FALSE;
357  }
358  else if(tag.objType == 5)
359  {
360  //Make sure the length of the boolean is valid
361  if(tag.length != 1)
362  return ERROR_INVALID_SYNTAX;
363 
364  //Save the value of the onlyContainsAttributeCerts subfield
365  issuingDistrPoint->onlyContainsAttributeCerts = tag.value[0] ? TRUE : FALSE;
366  }
367  else
368  {
369  //Discard unknown subfields
370  }
371 
372  //Next subfield
373  data += tag.totalLength;
374  length -= tag.totalLength;
375  }
376 
377  //Successful processing
378  return NO_ERROR;
379 }
380 
381 
382 /**
383  * @brief Parse CRL entry extensions
384  * @param[in] data Pointer to the ASN.1 structure to parse
385  * @param[in] length Length of the ASN.1 structure
386  * @param[out] totalLength Number of bytes that have been parsed
387  * @param[out] crlEntryExtensions Information resulting from the parsing process
388  * @return Error code
389  **/
390 
392  size_t *totalLength, X509CrlEntryExtensions *crlEntryExtensions)
393 {
394  error_t error;
395  size_t n;
396  Asn1Tag tag;
397  X509Extension extension;
398 
399  //No more data to process?
400  if(length == 0)
401  {
402  //The CrlEntryExtensions field is optional
403  *totalLength = 0;
404  //Exit immediately
405  return NO_ERROR;
406  }
407 
408  //Debug message
409  TRACE_DEBUG(" Parsing CrlEntryExtensions...\r\n");
410 
411  //This field is a sequence of one or more CRL entry extensions
412  error = asn1ReadSequence(data, length, &tag);
413  //Failed to decode ASN.1 tag?
414  if(error)
415  return error;
416 
417  //Save the total length of the CrlEntryExtensions field
418  *totalLength = tag.totalLength;
419 
420  //Raw contents of the ASN.1 sequence
421  crlEntryExtensions->raw.value = tag.value;
422  crlEntryExtensions->raw.length = tag.length;
423 
424  //Point to the first item of the sequence
425  data = tag.value;
426  length = tag.length;
427 
428  //Loop through the extensions
429  while(length > 0)
430  {
431  //Each extension includes an OID and a value
432  error = x509ParseExtension(data, length, &n, &extension);
433  //Any error to report?
434  if(error)
435  return error;
436 
437  //Jump to the next extension
438  data += n;
439  length -= n;
440 
441  //Test if the current extension is a duplicate
442  error = x509CheckDuplicateExtension(extension.oid.value,
443  extension.oid.length, data, length);
444  //Duplicate extension found?
445  if(error)
446  return error;
447 
448  //Check extension identifier
449  if(!oidComp(extension.oid.value, extension.oid.length,
451  {
452  //Parse ReasonCode extension
453  error = x509ParseReasonCode(extension.critical, extension.data.value,
454  extension.data.length, &crlEntryExtensions->reasonCode);
455  }
456  else if(!oidComp(extension.oid.value, extension.oid.length,
458  {
459  //Parse InvalidityDate extension
460  error = x509ParseInvalidityDate(extension.critical, extension.data.value,
461  extension.data.length, &crlEntryExtensions->invalidityDate);
462  }
463  else if(!oidComp(extension.oid.value, extension.oid.length,
465  {
466  //Parse CertificateIssuer extension
467  error = x509ParseCertificateIssuer(extension.critical, extension.data.value,
468  extension.data.length, &crlEntryExtensions->certIssuer);
469  }
470  else
471  {
472  //Check if the extension is marked as critical
473  if(extension.critical)
474  {
475  //If a CRL contains a critical CRL entry extension that the
476  //application cannot process, then the application must not use
477  //that CRL to determine the status of any certificates
479  }
480  }
481 
482  //Any parsing error?
483  if(error)
484  return error;
485  }
486 
487  //Successful processing
488  return NO_ERROR;
489 }
490 
491 
492 /**
493  * @brief Parse ReasonCode entry extension
494  * @param[in] critical Critical extension flag
495  * @param[in] data Pointer to the ASN.1 structure to parse
496  * @param[in] length Length of the ASN.1 structure
497  * @param[out] reasonCode Information resulting from the parsing process
498  * @return Error code
499  **/
500 
502  size_t length, X509CrlReason *reasonCode)
503 {
504  error_t error;
505  Asn1Tag tag;
506 
507  //Debug message
508  TRACE_DEBUG(" Parsing ReasonCode...\r\n");
509 
510  //An CRL entry extension can be marked as critical
511  reasonCode->critical = critical;
512 
513  //Read ReasonCode field
514  error = asn1ReadTag(data, length, &tag);
515  //Failed to decode ASN.1 tag?
516  if(error)
517  return error;
518 
519  //Enforce encoding, class and type
520  error = asn1CheckTag(&tag, FALSE, ASN1_CLASS_UNIVERSAL,
522  //Invalid tag?
523  if(error)
524  return error;
525 
526  //Check the length of the field
527  if(tag.length != 1)
528  return ERROR_INVALID_SYNTAX;
529 
530  //The ReasonCode is a non-critical CRL entry extension that identifies
531  //the reason for the certificate revocation
532  reasonCode->value = tag.value[0];
533 
534  //Successful processing
535  return NO_ERROR;
536 }
537 
538 
539 /**
540  * @brief Parse InvalidityDate entry extension
541  * @param[in] critical Critical extension flag
542  * @param[in] data Pointer to the ASN.1 structure to parse
543  * @param[in] length Length of the ASN.1 structure
544  * @param[out] invalidityDate Information resulting from the parsing process
545  * @return Error code
546  **/
547 
549  size_t length, X509InvalidityDate *invalidityDate)
550 {
551  error_t error;
552  size_t n;
553 
554  //Debug message
555  TRACE_DEBUG(" Parsing InvalidityDate...\r\n");
556 
557  //An CRL entry extension can be marked as critical
558  invalidityDate->critical = critical;
559 
560  //Read InvalidityDate field
561  error = x509ParseTime(data, length, &n, &invalidityDate->value);
562 
563  //Return status code
564  return error;
565 }
566 
567 
568 /**
569  * @brief Parse CertificateIssuer entry extension
570  * @param[in] critical Critical extension flag
571  * @param[in] data Pointer to the ASN.1 structure to parse
572  * @param[in] length Length of the ASN.1 structure
573  * @param[out] certificateIssuer Information resulting from the parsing process
574  * @return Error code
575  **/
576 
578  size_t length, X509CertificateIssuer *certificateIssuer)
579 {
580  error_t error;
581  uint_t i;
582  size_t n;
583  Asn1Tag tag;
584  X509GeneralName generalName;
585 
586  //Debug message
587  TRACE_DEBUG(" Parsing CertificateIssuer...\r\n");
588 
589  //An CRL entry extension can be marked as critical
590  certificateIssuer->critical = critical;
591 
592  //The CertificateIssuer structure shall contain a valid sequence
593  error = asn1ReadSequence(data, length, &tag);
594  //Failed to decode ASN.1 tag?
595  if(error)
596  return error;
597 
598  //Raw contents of the ASN.1 sequence
599  certificateIssuer->raw.value = tag.value;
600  certificateIssuer->raw.length = tag.length;
601 
602  //Point to the first item of the sequence
603  data = tag.value;
604  length = tag.length;
605 
606  //This CRL entry extension identifies the certificate issuer associated
607  //with an entry in an indirect CRL, that is, a CRL that has the indirectCRL
608  //indicator set in its issuing distribution point extension
609  for(i = 0; length > 0; i++)
610  {
611  //Parse GeneralName field
612  error = x509ParseGeneralName(data, length, &n, &generalName);
613  //Any error to report?
614  if(error)
615  return error;
616 
617  //Save issuer alternative name
618  if(i < X509_MAX_CRL_ISSUERS)
619  {
620  certificateIssuer->generalNames[i] = generalName;
621  }
622 
623  //Next item
624  data += n;
625  length -= n;
626  }
627 
628  //When present, the certificate issuer CRL entry extension includes one or
629  //more names (refer to RFC 5280, section 5.3.3)
630  if(i == 0)
631  return ERROR_INVALID_SYNTAX;
632 
633  //Save the number of issuer alternative names
634  certificateIssuer->numGeneralNames = MIN(i, X509_MAX_CRL_ISSUERS);
635 
636  //Successful processing
637  return NO_ERROR;
638 }
639 
640 
641 /**
642  * @brief Parse unknown CRL extension
643  * @param[in] oid Extension identifier
644  * @param[in] oidLen Length of the extension identifier
645  * @param[in] critical Critical extension flag
646  * @param[in] data Extension value
647  * @param[in] dataLen Length of the extension value
648  * @param[out] crlExtensions Information resulting from the parsing process
649  * @return Error code
650  **/
651 
652 __weak_func error_t x509ParseUnknownCrlExtension(const uint8_t *oid,
653  size_t oidLen, bool_t critical, const uint8_t *data, size_t dataLen,
654  X509CrlExtensions *crlExtensions)
655 {
656  //The extension is not supported
658 }
659 
660 #endif
error_t asn1ReadTag(const uint8_t *data, size_t length, Asn1Tag *tag)
Read an ASN.1 tag from the input stream.
Definition: asn1.c:52
error_t asn1ReadSequence(const uint8_t *data, size_t length, Asn1Tag *tag)
Read an ASN.1 sequence from the input stream.
Definition: asn1.c:163
error_t asn1CheckTag(const Asn1Tag *tag, bool_t constructed, uint_t objClass, uint_t objType)
Enforce the type of a specified tag.
Definition: asn1.c:653
ASN.1 (Abstract Syntax Notation One)
@ ASN1_TYPE_ENUMERATED
Definition: asn1.h:78
@ ASN1_TYPE_INTEGER
Definition: asn1.h:70
#define ASN1_CLASS_UNIVERSAL
Definition: asn1.h:52
#define ASN1_CLASS_CONTEXT_SPECIFIC
Definition: asn1.h:54
unsigned int uint_t
Definition: compiler_port.h:50
int bool_t
Definition: compiler_port.h:53
General definitions for cryptographic algorithms.
Debugging facilities.
#define TRACE_DEBUG(...)
Definition: debug.h:107
uint8_t n
error_t
Error codes.
Definition: error.h:43
@ ERROR_UNSUPPORTED_EXTENSION
Definition: error.h:244
@ ERROR_INVALID_CLASS
Definition: error.h:117
@ ERROR_INVALID_SYNTAX
Definition: error.h:68
@ NO_ERROR
Success.
Definition: error.h:44
uint8_t data[]
Definition: ethernet.h:222
uint8_t critical
Definition: ike.h:1281
uint16_t totalLength
Definition: ipv4.h:292
uint8_t oid[]
Definition: lldp_tlv.h:300
uint8_t oidLen
Definition: lldp_tlv.h:299
int_t oidComp(const uint8_t *oid1, size_t oidLen1, const uint8_t *oid2, size_t oidLen2)
Compare object identifiers.
Definition: oid.c:103
OID (Object Identifier)
#define MIN(a, b)
Definition: os_port.h:63
#define TRUE
Definition: os_port.h:50
#define FALSE
Definition: os_port.h:46
uint32_t dataLen
Definition: sftp_common.h:229
ASN.1 tag.
Definition: asn1.h:102
size_t totalLength
Definition: asn1.h:108
const uint8_t * value
Definition: asn1.h:107
uint_t objClass
Definition: asn1.h:104
uint_t objType
Definition: asn1.h:105
size_t length
Definition: asn1.h:106
Certificate Issuer extension.
Definition: x509_common.h:1098
X509OctetString raw
Definition: x509_common.h:1100
X509GeneralName generalNames[X509_MAX_CERT_ISSUERS]
Definition: x509_common.h:1102
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 number.
Definition: x509_common.h:1136
const uint8_t * value
Definition: x509_common.h:1138
CRL Reason extension.
Definition: x509_common.h:1076
Delta CRL Indicator extension.
Definition: x509_common.h:1148
X509OctetString baseCrlNumber
Definition: x509_common.h:1150
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
General name.
Definition: x509_common.h:852
Invalidity Date extension.
Definition: x509_common.h:1087
Issuing Distribution Point extension.
Definition: x509_common.h:1159
bool_t onlyContainsAttributeCerts
Definition: x509_common.h:1166
const uint8_t * value
Definition: x509_common.h:647
uint8_t length
Definition: tcp.h:368
error_t x509ParseAuthKeyId(bool_t critical, const uint8_t *data, size_t length, X509AuthKeyId *authKeyId)
Parse AuthorityKeyIdentifier extension.
error_t x509ParseExtension(const uint8_t *data, size_t length, size_t *totalLength, X509Extension *extension)
Parse X.509 certificate extension.
error_t x509CheckDuplicateExtension(const uint8_t *oid, size_t oidLen, const uint8_t *data, size_t length)
Check whether the specified extension is a duplicate.
X.509 extension parsing.
error_t x509ParseGeneralName(const uint8_t *data, size_t length, size_t *totalLength, X509GeneralName *generalName)
Parse GeneralName field.
error_t x509ParseTime(const uint8_t *data, size_t length, size_t *totalLength, DateTime *dateTime)
Parse UTCTime or GeneralizedTime field.
X.509 certificate parsing.
const uint8_t X509_CERTIFICATE_ISSUER_OID[3]
Definition: x509_common.c:101
const uint8_t X509_DELTA_CRL_INDICATOR_OID[3]
Definition: x509_common.c:97
const uint8_t X509_INVALIDITY_DATE_OID[3]
Definition: x509_common.c:95
const uint8_t X509_ISSUING_DISTR_POINT_OID[3]
Definition: x509_common.c:99
const uint8_t X509_CRL_NUMBER_OID[3]
Definition: x509_common.c:91
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_CRL_ISSUERS
Definition: x509_common.h:388
error_t x509ParseDeltaCrlIndicator(bool_t critical, const uint8_t *data, size_t length, X509DeltaCrlIndicator *deltaCrlIndicator)
Parse DeltaCRLIndicator extension.
error_t x509ParseCrlExtensions(const uint8_t *data, size_t length, size_t *totalLength, X509CrlExtensions *crlExtensions)
Parse CRL extensions.
error_t x509ParseCrlNumber(bool_t critical, const uint8_t *data, size_t length, X509CrlNumber *crlNumber)
Parse CRLNumber extension.
error_t x509ParseCrlEntryExtensions(const uint8_t *data, size_t length, size_t *totalLength, X509CrlEntryExtensions *crlEntryExtensions)
Parse CRL entry extensions.
error_t x509ParseIssuingDistrPoint(bool_t critical, const uint8_t *data, size_t length, X509IssuingDistrPoint *issuingDistrPoint)
Parse IssuingDistributionPoint extension.
__weak_func error_t x509ParseUnknownCrlExtension(const uint8_t *oid, size_t oidLen, bool_t critical, const uint8_t *data, size_t dataLen, X509CrlExtensions *crlExtensions)
Parse unknown CRL extension.
error_t x509ParseCertificateIssuer(bool_t critical, const uint8_t *data, size_t length, X509CertificateIssuer *certificateIssuer)
Parse CertificateIssuer entry extension.
error_t x509ParseReasonCode(bool_t critical, const uint8_t *data, size_t length, X509CrlReason *reasonCode)
Parse ReasonCode entry extension.
error_t x509ParseInvalidityDate(bool_t critical, const uint8_t *data, size_t length, X509InvalidityDate *invalidityDate)
Parse InvalidityDate entry extension.
CRL extension parsing.
CRL (Certificate Revocation List) parsing.