x509_cert_ext_format.c File Reference

X.509 extension formatting. More...

#include "core/crypto.h"
#include "pkix/x509_cert_format.h"
#include "pkix/x509_cert_ext_format.h"
#include "encoding/asn1.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   CRYPTO_TRACE_LEVEL
 

Functions

error_t x509FormatExtensions (const X509Extensions *extensions, const X509SubjectKeyId *subjectKeyId, const X509AuthKeyId *authKeyId, uint8_t *output, size_t *written)
 Format Extensions structure. More...
 
error_t x509FormatExtension (const X509Extension *extension, uint8_t *output, size_t *written)
 Format X.509 certificate extension. More...
 
error_t x509FormatBasicConstraints (const X509BasicConstraints *basicConstraints, uint8_t *output, size_t *written)
 Format BasicConstraints extension. More...
 
error_t x509FormatKeyUsage (const X509KeyUsage *keyUsage, uint8_t *output, size_t *written)
 Format KeyUsage extension. More...
 
error_t x509FormatSubjectAltName (const X509SubjectAltName *subjectAltName, uint8_t *output, size_t *written)
 Format SubjectAltName extension. More...
 
error_t x509FormatSubjectKeyId (const X509SubjectKeyId *subjectKeyId, uint8_t *output, size_t *written)
 Format SubjectKeyIdentifier extension. More...
 
error_t x509FormatAuthorityKeyId (const X509AuthKeyId *authKeyId, uint8_t *output, size_t *written)
 Format AuthorityKeyIdentifier extension. More...
 
error_t x509FormatNsCertType (const X509NsCertType *nsCertType, uint8_t *output, size_t *written)
 Format NetscapeCertType extension. More...
 

Detailed Description

X.509 extension formatting.

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2024 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.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.4.0

Definition in file x509_cert_ext_format.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   CRYPTO_TRACE_LEVEL

Definition at line 32 of file x509_cert_ext_format.c.

Function Documentation

◆ x509FormatAuthorityKeyId()

error_t x509FormatAuthorityKeyId ( const X509AuthKeyId authKeyId,
uint8_t *  output,
size_t *  written 
)

Format AuthorityKeyIdentifier extension.

Parameters
[in]authKeyIdValue of the extension
[out]outputBuffer where to format the ASN.1 structure
[out]writtenLength of the resulting ASN.1 structure
Returns
Error code

Definition at line 825 of file x509_cert_ext_format.c.

◆ x509FormatBasicConstraints()

error_t x509FormatBasicConstraints ( const X509BasicConstraints basicConstraints,
uint8_t *  output,
size_t *  written 
)

Format BasicConstraints extension.

Parameters
[in]basicConstraintsValue of the extension
[out]outputBuffer where to format the ASN.1 structure
[out]writtenLength of the resulting ASN.1 structure
Returns
Error code

Definition at line 292 of file x509_cert_ext_format.c.

◆ x509FormatExtension()

error_t x509FormatExtension ( const X509Extension extension,
uint8_t *  output,
size_t *  written 
)

Format X.509 certificate extension.

Parameters
[in]extensionPointer to the extension
[out]outputBuffer where to format the ASN.1 structure
[out]writtenLength of the resulting ASN.1 structure
Returns
Error code

Definition at line 191 of file x509_cert_ext_format.c.

◆ x509FormatExtensions()

error_t x509FormatExtensions ( const X509Extensions extensions,
const X509SubjectKeyId subjectKeyId,
const X509AuthKeyId authKeyId,
uint8_t *  output,
size_t *  written 
)

Format Extensions structure.

Parameters
[in]extensionsPointer to the X.509 extensions
[in]subjectKeyIdSubjectKeyIdentifier extension
[in]authKeyIdAuthorityKeyIdentifier extension
[out]outputBuffer where to format the ASN.1 structure
[out]writtenLength of the resulting ASN.1 structure
Returns
Error code

Definition at line 55 of file x509_cert_ext_format.c.

◆ x509FormatKeyUsage()

error_t x509FormatKeyUsage ( const X509KeyUsage keyUsage,
uint8_t *  output,
size_t *  written 
)

Format KeyUsage extension.

Parameters
[in]keyUsageValue of the extension
[out]outputBuffer where to format the ASN.1 structure
[out]writtenLength of the resulting ASN.1 structure
Returns
Error code

Definition at line 458 of file x509_cert_ext_format.c.

◆ x509FormatNsCertType()

error_t x509FormatNsCertType ( const X509NsCertType nsCertType,
uint8_t *  output,
size_t *  written 
)

Format NetscapeCertType extension.

Parameters
[in]nsCertTypeValue of the extension
[out]outputBuffer where to format the ASN.1 structure
[out]writtenLength of the resulting ASN.1 structure
Returns
Error code

Definition at line 935 of file x509_cert_ext_format.c.

◆ x509FormatSubjectAltName()

error_t x509FormatSubjectAltName ( const X509SubjectAltName subjectAltName,
uint8_t *  output,
size_t *  written 
)

Format SubjectAltName extension.

Parameters
[in]subjectAltNameValue of the extension
[out]outputBuffer where to format the ASN.1 structure
[out]writtenLength of the resulting ASN.1 structure
Returns
Error code

Definition at line 604 of file x509_cert_ext_format.c.

◆ x509FormatSubjectKeyId()

error_t x509FormatSubjectKeyId ( const X509SubjectKeyId subjectKeyId,
uint8_t *  output,
size_t *  written 
)

Format SubjectKeyIdentifier extension.

Parameters
[in]subjectKeyIdValue of the extension
[out]outputBuffer where to format the ASN.1 structure
[out]writtenLength of the resulting ASN.1 structure
Returns
Error code

Definition at line 728 of file x509_cert_ext_format.c.