X.509 certificate formatting. More...
#include "core/crypto.h"
#include "pkix/x509_cert_format.h"
#include "pkix/x509_cert_ext_format.h"
#include "pkix/x509_key_format.h"
#include "pkix/x509_sign_format.h"
#include "encoding/asn1.h"
#include "hash/sha1.h"
#include "debug.h"
Go to the source code of this file.
Macros | |
#define | TRACE_LEVEL CRYPTO_TRACE_LEVEL |
Functions | |
error_t | x509FormatTbsCertificate (const PrngAlgo *prngAlgo, void *prngContext, const X509SerialNumber *serialNumber, const X509SignAlgoId *signatureAlgo, const X509Name *issuer, const X509Validity *validity, const X509Name *subject, const X509SubjectPublicKeyInfo *subjectPublicKeyInfo, const void *publicKey, const X509Extensions *extensions, const X509AuthKeyId *authKeyId, uint8_t *output, size_t *written) |
Format TBSCertificate structure. More... | |
error_t | x509FormatVersion (X509Version version, uint8_t *output, size_t *written) |
Format Version field. More... | |
error_t | x509FormatSerialNumber (const PrngAlgo *prngAlgo, void *prngContext, const X509SerialNumber *serialNumber, uint8_t *output, size_t *written) |
Format SerialNumber field. More... | |
error_t | x509FormatName (const X509Name *name, uint8_t *output, size_t *written) |
Format Name structure. More... | |
error_t | x509FormatNameAttribute (const X509NameAttribute *nameAttribute, uint8_t *output, size_t *written) |
Format name attribute. More... | |
error_t | x509FormatValidity (const X509Validity *validity, uint8_t *output, size_t *written) |
Format Validity structure. More... | |
error_t | x509FormatTime (const DateTime *dateTime, uint8_t *output, size_t *written) |
Format UTCTime or GeneralizedTime field. More... | |
Detailed Description
X.509 certificate 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.
- Version
- 2.4.4
Definition in file x509_cert_format.c.
Macro Definition Documentation
◆ TRACE_LEVEL
#define TRACE_LEVEL CRYPTO_TRACE_LEVEL |
Definition at line 32 of file x509_cert_format.c.
Function Documentation
◆ x509FormatName()
Format Name structure.
- Parameters
-
[in] name Information about the name to be encoded [out] output Buffer where to format the ASN.1 structure [out] written Length of the resulting ASN.1 structure
- Returns
- Error code
Definition at line 306 of file x509_cert_format.c.
◆ x509FormatNameAttribute()
error_t x509FormatNameAttribute | ( | const X509NameAttribute * | nameAttribute, |
uint8_t * | output, | ||
size_t * | written | ||
) |
Format name attribute.
- Parameters
-
[in] nameAttribute Name attribute [out] output Buffer where to format the ASN.1 structure [out] written Length of the resulting ASN.1 structure
- Returns
- Error code
Definition at line 531 of file x509_cert_format.c.
◆ x509FormatSerialNumber()
error_t x509FormatSerialNumber | ( | const PrngAlgo * | prngAlgo, |
void * | prngContext, | ||
const X509SerialNumber * | serialNumber, | ||
uint8_t * | output, | ||
size_t * | written | ||
) |
Format SerialNumber field.
- Parameters
-
[in] prngAlgo PRNG algorithm [in] prngContext Pointer to the PRNG context [in] serialNumber Pointer to the serial number (optional parameter) [out] output Buffer where to format the ASN.1 structure [out] written Length of the resulting ASN.1 structure
- Returns
- Error code
Definition at line 246 of file x509_cert_format.c.
◆ x509FormatTbsCertificate()
error_t x509FormatTbsCertificate | ( | const PrngAlgo * | prngAlgo, |
void * | prngContext, | ||
const X509SerialNumber * | serialNumber, | ||
const X509SignAlgoId * | signatureAlgo, | ||
const X509Name * | issuer, | ||
const X509Validity * | validity, | ||
const X509Name * | subject, | ||
const X509SubjectPublicKeyInfo * | subjectPublicKeyInfo, | ||
const void * | publicKey, | ||
const X509Extensions * | extensions, | ||
const X509AuthKeyId * | authKeyId, | ||
uint8_t * | output, | ||
size_t * | written | ||
) |
Format TBSCertificate structure.
- Parameters
-
[in] prngAlgo PRNG algorithm [in] prngContext Pointer to the PRNG context [in] serialNumber Serial number [in] signatureAlgo Signature algorithm [in] issuer Issuer's name [in] validity Validity period [in] subject Subject's name [in] subjectPublicKeyInfo Subject's public key information [in] publicKey Subject's public key [in] extensions X.509 certificates extensions [in] authKeyId AuthorityKeyIdentifier extension [out] output Buffer where to format the ASN.1 structure [out] written Length of the resulting ASN.1 structure
- Returns
- Error code
Definition at line 66 of file x509_cert_format.c.
◆ x509FormatTime()
Format UTCTime or GeneralizedTime field.
- Parameters
-
[in] dateTime Date to be encoded [out] output Buffer where to format the ASN.1 structure [out] written Length of the resulting ASN.1 structure
- Returns
- Error code
Definition at line 684 of file x509_cert_format.c.
◆ x509FormatValidity()
error_t x509FormatValidity | ( | const X509Validity * | validity, |
uint8_t * | output, | ||
size_t * | written | ||
) |
Format Validity structure.
- Parameters
-
[in] validity Validity period [out] output Buffer where to format the ASN.1 structure [out] written Length of the resulting ASN.1 structure
- Returns
- Error code
Definition at line 621 of file x509_cert_format.c.
◆ x509FormatVersion()
error_t x509FormatVersion | ( | X509Version | version, |
uint8_t * | output, | ||
size_t * | written | ||
) |
Format Version field.
- Parameters
-
[in] version Version number [out] output Buffer where to format the ASN.1 structure [out] written Length of the resulting ASN.1 structure
- Returns
- Error code
Definition at line 202 of file x509_cert_format.c.