X.509 extension parsing. More...
#include "core/crypto.h"#include "pkix/x509_cert_parse.h"#include "pkix/x509_cert_ext_parse.h"#include "encoding/asn1.h"#include "encoding/oid.h"#include "debug.h"Go to the source code of this file.
| Macros | |
| #define | TRACE_LEVEL CRYPTO_TRACE_LEVEL | 
| Functions | |
| error_t | x509ParseCertExtensions (const uint8_t *data, size_t length, size_t *totalLength, X509Extensions *extensions, const X509Options *options) | 
| Parse X.509 certificate extensions.  More... | |
| error_t | x509ParseExtension (const uint8_t *data, size_t length, size_t *totalLength, X509Extension *extension) | 
| Parse X.509 certificate extension.  More... | |
| error_t | x509ParseBasicConstraints (bool_t critical, const uint8_t *data, size_t length, X509BasicConstraints *basicConstraints) | 
| Parse BasicConstraints extension.  More... | |
| error_t | x509ParseNameConstraints (bool_t critical, const uint8_t *data, size_t length, X509NameConstraints *nameConstraints) | 
| Parse NameConstraints extension.  More... | |
| error_t | x509ParsePolicyConstraints (bool_t critical, const uint8_t *data, size_t length) | 
| Parse PolicyConstraints extension.  More... | |
| error_t | x509ParsePolicyMappings (bool_t critical, const uint8_t *data, size_t length) | 
| Parse PolicyMappings extension.  More... | |
| error_t | x509ParseInhibitAnyPolicy (bool_t critical, const uint8_t *data, size_t length) | 
| Parse InhibitAnyPolicy extension.  More... | |
| error_t | x509ParseKeyUsage (bool_t critical, const uint8_t *data, size_t length, X509KeyUsage *keyUsage) | 
| Parse KeyUsage extension.  More... | |
| error_t | x509ParseExtendedKeyUsage (bool_t critical, const uint8_t *data, size_t length, X509ExtendedKeyUsage *extKeyUsage) | 
| Parse ExtendedKeyUsage extension.  More... | |
| error_t | x509ParseSubjectAltName (bool_t critical, const uint8_t *data, size_t length, X509SubjectAltName *subjectAltName) | 
| Parse SubjectAltName extension.  More... | |
| error_t | x509ParseSubjectKeyId (bool_t critical, const uint8_t *data, size_t length, X509SubjectKeyId *subjectKeyId) | 
| Parse SubjectKeyIdentifier extension.  More... | |
| error_t | x509ParseAuthKeyId (bool_t critical, const uint8_t *data, size_t length, X509AuthKeyId *authKeyId) | 
| Parse AuthorityKeyIdentifier extension.  More... | |
| error_t | x509ParseCrlDistrPoints (bool_t critical, const uint8_t *data, size_t length, X509CrlDistrPoints *crlDistrPoints) | 
| Parse CRLDistributionPoints extension.  More... | |
| error_t | x509ParseDistrPoint (const uint8_t *data, size_t length, size_t *totalLength, X509DistrPoint *distrPoint) | 
| Parse DistributionPoint field.  More... | |
| error_t | x509ParseDistrPointName (const uint8_t *data, size_t length, X509DistrPointName *distrPointName) | 
| Parse DistributionPointName field.  More... | |
| error_t | x509ParseRelativeName (const uint8_t *data, size_t length, X509NameAttribute *relativeName) | 
| Parse nameRelativeToCRLIssuer field.  More... | |
| error_t | x509ParseReasonFlags (const uint8_t *data, size_t length, uint16_t *reasonFlags) | 
| Parse ReasonFlags field.  More... | |
| error_t | x509ParseAuthInfoAccess (bool_t critical, const uint8_t *data, size_t length, X509AuthInfoAccess *authInfoAccess) | 
| Parse AuthorityInformationAccess extension.  More... | |
| error_t | x509ParseAccessDescription (const uint8_t *data, size_t length, size_t *totalLength, X509AccessDescription *accessDescription) | 
| Parse AccessDescription field.  More... | |
| error_t | x509ParsePkixOcspNoCheck (bool_t critical, const uint8_t *data, size_t length, X509PkixOcspNoCheck *pkixOcspNoCheck) | 
| Parse PkixOcspNoCheck extension.  More... | |
| error_t | x509ParseNsCertType (bool_t critical, const uint8_t *data, size_t length, X509NsCertType *nsCertType) | 
| Parse NetscapeCertType extension.  More... | |
| __weak_func error_t | x509ParseUnknownCertExtension (const uint8_t *oid, size_t oidLen, bool_t critical, const uint8_t *data, size_t dataLen, X509Extensions *extensions) | 
| Parse unknown X.509 certificate extension.  More... | |
| 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.  More... | |
Detailed Description
X.509 extension parsing.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2025 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneCRYPTO Open.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- Version
- 2.5.4
Definition in file x509_cert_ext_parse.c.
Macro Definition Documentation
◆ TRACE_LEVEL
| #define TRACE_LEVEL CRYPTO_TRACE_LEVEL | 
Definition at line 32 of file x509_cert_ext_parse.c.
Function Documentation
◆ x509CheckDuplicateExtension()
| 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.
- Parameters
- 
  [in] oid Extension identifier [in] oidLen Length of the extension identifier [in] data Pointer to the extension list [in] length Length of the extension list 
- Returns
- Error code
Definition at line 1545 of file x509_cert_ext_parse.c.
◆ x509ParseAccessDescription()
| error_t x509ParseAccessDescription | ( | const uint8_t * | data, | 
| size_t | length, | ||
| size_t * | totalLength, | ||
| X509AccessDescription * | accessDescription | ||
| ) | 
Parse AccessDescription field.
- Parameters
- 
  [in] data Pointer to the ASN.1 structure to parse [in] length Length of the ASN.1 structure [out] totalLength Number of bytes that have been parsed [out] accessDescription Information resulting from the parsing process 
- Returns
- Error code
Definition at line 1363 of file x509_cert_ext_parse.c.
◆ x509ParseAuthInfoAccess()
| error_t x509ParseAuthInfoAccess | ( | bool_t | critical, | 
| const uint8_t * | data, | ||
| size_t | length, | ||
| X509AuthInfoAccess * | authInfoAccess | ||
| ) | 
Parse AuthorityInformationAccess extension.
- Parameters
- 
  [in] critical Critical extension flag [in] data Pointer to the ASN.1 structure to parse [in] length Length of the ASN.1 structure [out] authInfoAccess Information resulting from the parsing process 
- Returns
- Error code
Definition at line 1292 of file x509_cert_ext_parse.c.
◆ x509ParseAuthKeyId()
| error_t x509ParseAuthKeyId | ( | bool_t | critical, | 
| const uint8_t * | data, | ||
| size_t | length, | ||
| X509AuthKeyId * | authKeyId | ||
| ) | 
Parse AuthorityKeyIdentifier extension.
- Parameters
- 
  [in] critical Critical extension flag [in] data Pointer to the ASN.1 structure to parse [in] length Length of the ASN.1 structure [out] authKeyId Information resulting from the parsing process 
- Returns
- Error code
Definition at line 929 of file x509_cert_ext_parse.c.
◆ x509ParseBasicConstraints()
| error_t x509ParseBasicConstraints | ( | bool_t | critical, | 
| const uint8_t * | data, | ||
| size_t | length, | ||
| X509BasicConstraints * | basicConstraints | ||
| ) | 
Parse BasicConstraints extension.
- Parameters
- 
  [in] critical Critical extension flag [in] data Pointer to the ASN.1 structure to parse [in] length Length of the ASN.1 structure [out] basicConstraints Information resulting from the parsing process 
- Returns
- Error code
Definition at line 344 of file x509_cert_ext_parse.c.
◆ x509ParseCertExtensions()
| error_t x509ParseCertExtensions | ( | const uint8_t * | data, | 
| size_t | length, | ||
| size_t * | totalLength, | ||
| X509Extensions * | extensions, | ||
| const X509Options * | options | ||
| ) | 
Parse X.509 certificate extensions.
- Parameters
- 
  [in] data Pointer to the ASN.1 structure to parse [in] length Length of the ASN.1 structure [out] totalLength Number of bytes that have been parsed [out] extensions Information resulting from the parsing process [in] options Certificate parsing options 
- Returns
- Error code
Definition at line 56 of file x509_cert_ext_parse.c.
◆ x509ParseCrlDistrPoints()
| error_t x509ParseCrlDistrPoints | ( | bool_t | critical, | 
| const uint8_t * | data, | ||
| size_t | length, | ||
| X509CrlDistrPoints * | crlDistrPoints | ||
| ) | 
Parse CRLDistributionPoints extension.
- Parameters
- 
  [in] critical Critical extension flag [in] data Pointer to the ASN.1 structure to parse [in] length Length of the ASN.1 structure [out] crlDistrPoints Information resulting from the parsing process 
- Returns
- Error code
Definition at line 991 of file x509_cert_ext_parse.c.
◆ x509ParseDistrPoint()
| error_t x509ParseDistrPoint | ( | const uint8_t * | data, | 
| size_t | length, | ||
| size_t * | totalLength, | ||
| X509DistrPoint * | distrPoint | ||
| ) | 
Parse DistributionPoint field.
- Parameters
- 
  [in] data Pointer to the ASN.1 structure to parse [in] length Length of the ASN.1 structure [out] totalLength Number of bytes that have been parsed [out] distrPoint Information resulting from the parsing process 
- Returns
- Error code
Definition at line 1062 of file x509_cert_ext_parse.c.
◆ x509ParseDistrPointName()
| error_t x509ParseDistrPointName | ( | const uint8_t * | data, | 
| size_t | length, | ||
| X509DistrPointName * | distrPointName | ||
| ) | 
Parse DistributionPointName field.
- Parameters
- 
  [in] data Pointer to the ASN.1 structure to parse [in] length Length of the ASN.1 structure [out] distrPointName Information resulting from the parsing process 
- Returns
- Error code
Definition at line 1145 of file x509_cert_ext_parse.c.
◆ x509ParseExtendedKeyUsage()
| error_t x509ParseExtendedKeyUsage | ( | bool_t | critical, | 
| const uint8_t * | data, | ||
| size_t | length, | ||
| X509ExtendedKeyUsage * | extKeyUsage | ||
| ) | 
Parse ExtendedKeyUsage extension.
- Parameters
- 
  [in] critical Critical extension flag [in] data Pointer to the ASN.1 structure to parse [in] length Length of the ASN.1 structure [out] extKeyUsage Information resulting from the parsing process 
- Returns
- Error code
Definition at line 689 of file x509_cert_ext_parse.c.
◆ x509ParseExtension()
| error_t x509ParseExtension | ( | const uint8_t * | data, | 
| size_t | length, | ||
| size_t * | totalLength, | ||
| X509Extension * | extension | ||
| ) | 
Parse X.509 certificate extension.
- Parameters
- 
  [in] data Pointer to the ASN.1 structure to parse [in] length Length of the ASN.1 structure [out] totalLength Number of bytes that have been parsed [out] extension Information resulting from the parsing process 
- Returns
- Error code
Definition at line 257 of file x509_cert_ext_parse.c.
◆ x509ParseInhibitAnyPolicy()
Parse InhibitAnyPolicy extension.
- Parameters
- 
  [in] critical Critical extension flag [in] data Pointer to the ASN.1 structure to parse [in] length Length of the ASN.1 structure 
- Returns
- Error code
Definition at line 600 of file x509_cert_ext_parse.c.
◆ x509ParseKeyUsage()
| error_t x509ParseKeyUsage | ( | bool_t | critical, | 
| const uint8_t * | data, | ||
| size_t | length, | ||
| X509KeyUsage * | keyUsage | ||
| ) | 
Parse KeyUsage extension.
- Parameters
- 
  [in] critical Critical extension flag [in] data Pointer to the ASN.1 structure to parse [in] length Length of the ASN.1 structure [out] keyUsage Information resulting from the parsing process 
- Returns
- Error code
Definition at line 620 of file x509_cert_ext_parse.c.
◆ x509ParseNameConstraints()
| error_t x509ParseNameConstraints | ( | bool_t | critical, | 
| const uint8_t * | data, | ||
| size_t | length, | ||
| X509NameConstraints * | nameConstraints | ||
| ) | 
Parse NameConstraints extension.
- Parameters
- 
  [in] critical Critical extension flag [in] data Pointer to the ASN.1 structure to parse [in] length Length of the ASN.1 structure [out] nameConstraints Information resulting from the parsing process 
- Returns
- Error code
Definition at line 435 of file x509_cert_ext_parse.c.
◆ x509ParseNsCertType()
| error_t x509ParseNsCertType | ( | bool_t | critical, | 
| const uint8_t * | data, | ||
| size_t | length, | ||
| X509NsCertType * | nsCertType | ||
| ) | 
Parse NetscapeCertType extension.
- Parameters
- 
  [in] critical Critical extension flag [in] data Pointer to the ASN.1 structure to parse [in] length Length of the ASN.1 structure [out] nsCertType Information resulting from the parsing process 
- Returns
- Error code
Definition at line 1468 of file x509_cert_ext_parse.c.
◆ x509ParsePkixOcspNoCheck()
| error_t x509ParsePkixOcspNoCheck | ( | bool_t | critical, | 
| const uint8_t * | data, | ||
| size_t | length, | ||
| X509PkixOcspNoCheck * | pkixOcspNoCheck | ||
| ) | 
Parse PkixOcspNoCheck extension.
- Parameters
- 
  [in] critical Critical extension flag [in] data Pointer to the ASN.1 structure to parse [in] length Length of the ASN.1 structure [out] pkixOcspNoCheck Information resulting from the parsing process 
- Returns
- Error code
Definition at line 1426 of file x509_cert_ext_parse.c.
◆ x509ParsePolicyConstraints()
Parse PolicyConstraints extension.
- Parameters
- 
  [in] critical Critical extension flag [in] data Pointer to the ASN.1 structure to parse [in] length Length of the ASN.1 structure 
- Returns
- Error code
Definition at line 535 of file x509_cert_ext_parse.c.
◆ x509ParsePolicyMappings()
Parse PolicyMappings extension.
- Parameters
- 
  [in] critical Critical extension flag [in] data Pointer to the ASN.1 structure to parse [in] length Length of the ASN.1 structure 
- Returns
- Error code
Definition at line 568 of file x509_cert_ext_parse.c.
◆ x509ParseReasonFlags()
| error_t x509ParseReasonFlags | ( | const uint8_t * | data, | 
| size_t | length, | ||
| uint16_t * | reasonFlags | ||
| ) | 
Parse ReasonFlags field.
- Parameters
- 
  [in] data Pointer to the ASN.1 structure to parse [in] length Length of the ASN.1 structure [out] reasonFlags Information resulting from the parsing process 
- Returns
- Error code
Definition at line 1251 of file x509_cert_ext_parse.c.
◆ x509ParseRelativeName()
| error_t x509ParseRelativeName | ( | const uint8_t * | data, | 
| size_t | length, | ||
| X509NameAttribute * | relativeName | ||
| ) | 
Parse nameRelativeToCRLIssuer field.
- Parameters
- 
  [in] data Pointer to the ASN.1 structure to parse [in] length Length of the ASN.1 structure [out] relativeName Information resulting from the parsing process 
- Returns
- Error code
Definition at line 1195 of file x509_cert_ext_parse.c.
◆ x509ParseSubjectAltName()
| error_t x509ParseSubjectAltName | ( | bool_t | critical, | 
| const uint8_t * | data, | ||
| size_t | length, | ||
| X509SubjectAltName * | subjectAltName | ||
| ) | 
Parse SubjectAltName extension.
- Parameters
- 
  [in] critical Critical extension flag [in] data Pointer to the ASN.1 structure to parse [in] length Length of the ASN.1 structure [out] subjectAltName Information resulting from the parsing process 
- Returns
- Error code
Definition at line 852 of file x509_cert_ext_parse.c.
◆ x509ParseSubjectKeyId()
| error_t x509ParseSubjectKeyId | ( | bool_t | critical, | 
| const uint8_t * | data, | ||
| size_t | length, | ||
| X509SubjectKeyId * | subjectKeyId | ||
| ) | 
Parse SubjectKeyIdentifier extension.
- Parameters
- 
  [in] critical Critical extension flag [in] data Pointer to the ASN.1 structure to parse [in] length Length of the ASN.1 structure [out] subjectKeyId Information resulting from the parsing process 
- Returns
- Error code
Definition at line 892 of file x509_cert_ext_parse.c.
◆ x509ParseUnknownCertExtension()
| __weak_func error_t x509ParseUnknownCertExtension | ( | const uint8_t * | oid, | 
| size_t | oidLen, | ||
| bool_t | critical, | ||
| const uint8_t * | data, | ||
| size_t | dataLen, | ||
| X509Extensions * | extensions | ||
| ) | 
Parse unknown X.509 certificate extension.
- Parameters
- 
  [in] oid Extension identifier [in] oidLen Length of the extension identifier [in] critical Critical extension flag [in] data Extension value [in] dataLen Length of the extension value [out] extensions Information resulting from the parsing process 
- Returns
- Error code
Definition at line 1527 of file x509_cert_ext_parse.c.
