Sergey Pastor / 1

Dependents:   Nucleo

Embed: (wiki syntax)

« Back to documentation index

x509.h File Reference

x509.h File Reference

X.509 certificate parsing and verification. More...

Go to the source code of this file.

Data Structures

struct  X509Name
 Issuer or subject name. More...
struct  X509Validity
 Validity. More...
struct  X509RsaPublicKey
 RSA public key. More...
struct  X509DsaParameters
 DSA domain parameters. More...
struct  X509DsaPublicKey
 DSA public key. More...
struct  X509EcParameters
 EC parameters. More...
struct  X509EcPublicKey
 EC public key. More...
struct  X509SubjectPublicKeyInfo
 Subject public key info. More...
struct  X509BasicContraints
 Basic constraints. More...
struct  X509CertificateInfo
 X.509 certificate. More...

Enumerations

enum  X509Version
 

X.509 versions.

More...

Functions

error_t x509ParseCertificate (const uint8_t *data, size_t length, X509CertificateInfo *certInfo)
 Parse a X.509 certificate.
error_t x509ParseTbsCertificate (const uint8_t *data, size_t length, size_t *totalLength, X509CertificateInfo *certInfo)
 Parse TBSCertificate structure.
error_t x509ParseVersion (const uint8_t *data, size_t length, size_t *totalLength, X509CertificateInfo *certInfo)
 Parse Version field.
error_t x509ParseSerialNumber (const uint8_t *data, size_t length, size_t *totalLength, X509CertificateInfo *certInfo)
 Parse SerialNumber field.
error_t x509ParseSignature (const uint8_t *data, size_t length, size_t *totalLength, X509CertificateInfo *certInfo)
 Parse Signature field.
error_t x509ParseName (const uint8_t *data, size_t length, size_t *totalLength, X509Name *name)
 Parse Name structure.
error_t x509ParseValidity (const uint8_t *data, size_t length, size_t *totalLength, X509CertificateInfo *certInfo)
 Parse Validity field.
error_t x509ParseTime (const uint8_t *data, size_t length, size_t *totalLength, DateTime *dateTime)
 Parse UTCTime or GeneralizedTime structure.
error_t x509ParseSubjectPublicKeyInfo (const uint8_t *data, size_t length, size_t *totalLength, X509CertificateInfo *certInfo)
 Parse SubjectPublicKeyInfo structure.
error_t x509ParseAlgorithmIdentifier (const uint8_t *data, size_t length, size_t *totalLength, X509CertificateInfo *certInfo)
 Parse AlgorithmIdentifier structure.
error_t x509ParseRsaPublicKey (const uint8_t *data, size_t length, X509CertificateInfo *certInfo)
 Parse RSAPublicKey structure.
error_t x509ParseDsaParameters (const uint8_t *data, size_t length, X509CertificateInfo *certInfo)
 Parse DSA domain parameters.
error_t x509ParseDsaPublicKey (const uint8_t *data, size_t length, X509CertificateInfo *certInfo)
 Parse DSAPublicKey structure.
error_t x509ParseEcParameters (const uint8_t *data, size_t length, X509CertificateInfo *certInfo)
 Parse ECParameters structure.
error_t x509ParseEcPublicKey (const uint8_t *data, size_t length, X509CertificateInfo *certInfo)
 Parse ECPublicKey structure.
error_t x509ParseIssuerUniqueId (const uint8_t *data, size_t length, size_t *totalLength, X509CertificateInfo *certInfo)
 Parse IssuerUniqueID structure.
error_t x509ParseSubjectUniqueId (const uint8_t *data, size_t length, size_t *totalLength, X509CertificateInfo *certInfo)
 Parse SubjectUniqueID structure.
error_t x509ParseExtensions (const uint8_t *data, size_t length, size_t *totalLength, X509CertificateInfo *certInfo)
 Parse Extensions structure.
error_t x509ParseBasicConstraints (const uint8_t *data, size_t length, X509CertificateInfo *certInfo)
 Parse BasicConstraints structure.
error_t x509ParseSignatureAlgo (const uint8_t *data, size_t length, size_t *totalLength, X509CertificateInfo *certInfo)
 Parse SignatureAlgorithm structure.
error_t x509ParseSignatureValue (const uint8_t *data, size_t length, size_t *totalLength, X509CertificateInfo *certInfo)
 Parse SignatureValue field.
error_t x509ParseInt (const uint8_t *data, size_t length, uint_t *value)
 Convert string to integer.
error_t x509ReadRsaPublicKey (const X509CertificateInfo *certInfo, RsaPublicKey *key)
 Read a RSA public key.
error_t x509ReadDsaPublicKey (const X509CertificateInfo *certInfo, DsaPublicKey *key)
 Read a DSA public key.
error_t x509ValidateCertificate (const X509CertificateInfo *certInfo, const X509CertificateInfo *issuerCertInfo)
 X.509 certificate validation.

Detailed Description

X.509 certificate parsing and verification.

License

Copyright (C) 2010-2017 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:
1.7.6

Definition in file x509.h.


Enumeration Type Documentation

X.509 versions.

Definition at line 44 of file x509.h.


Function Documentation

error_t x509ParseAlgorithmIdentifier ( const uint8_t *  data,
size_t  length,
size_t *  totalLength,
X509CertificateInfo certInfo 
)

Parse AlgorithmIdentifier structure.

Parameters:
[in]dataPointer to the ASN.1 structure to parse
[in]lengthLength of the ASN.1 structure
[out]totalLengthNumber of bytes that have been parsed
[out]certInfoInformation resulting from the parsing process
Returns:
Error code

Definition at line 971 of file x509.c.

error_t x509ParseBasicConstraints ( const uint8_t *  data,
size_t  length,
X509CertificateInfo certInfo 
)

Parse BasicConstraints structure.

Parameters:
[in]dataPointer to the ASN.1 structure to parse
[in]lengthLength of the ASN.1 structure
[out]certInfoInformation resulting from the parsing process
Returns:
Error code

Definition at line 1661 of file x509.c.

error_t x509ParseCertificate ( const uint8_t *  data,
size_t  length,
X509CertificateInfo certInfo 
)

Parse a X.509 certificate.

Parameters:
[in]dataPointer to the X.509 certificate to parse
[in]lengthLength of the X.509 certificate
[out]certInfoInformation resulting from the parsing process
Returns:
Error code

Definition at line 124 of file x509.c.

error_t x509ParseDsaParameters ( const uint8_t *  data,
size_t  length,
X509CertificateInfo certInfo 
)

Parse DSA domain parameters.

Parameters:
[in]dataPointer to the ASN.1 structure to parse
[in]lengthLength of the ASN.1 structure
[out]certInfoInformation resulting from the parsing process
Returns:
Error code

Definition at line 1144 of file x509.c.

error_t x509ParseDsaPublicKey ( const uint8_t *  data,
size_t  length,
X509CertificateInfo certInfo 
)

Parse DSAPublicKey structure.

Parameters:
[in]dataPointer to the ASN.1 structure to parse
[in]lengthLength of the ASN.1 structure
[out]certInfoInformation resulting from the parsing process
Returns:
Error code

Definition at line 1243 of file x509.c.

error_t x509ParseEcParameters ( const uint8_t *  data,
size_t  length,
X509CertificateInfo certInfo 
)

Parse ECParameters structure.

Parameters:
[in]dataPointer to the ASN.1 structure to parse
[in]lengthLength of the ASN.1 structure
[out]certInfoInformation resulting from the parsing process
Returns:
Error code

Definition at line 1286 of file x509.c.

error_t x509ParseEcPublicKey ( const uint8_t *  data,
size_t  length,
X509CertificateInfo certInfo 
)

Parse ECPublicKey structure.

Parameters:
[in]dataPointer to the ASN.1 structure to parse
[in]lengthLength of the ASN.1 structure
[out]certInfoInformation resulting from the parsing process
Returns:
Error code

Definition at line 1331 of file x509.c.

error_t x509ParseExtensions ( const uint8_t *  data,
size_t  length,
size_t *  totalLength,
X509CertificateInfo certInfo 
)

Parse Extensions structure.

Parameters:
[in]dataPointer to the ASN.1 structure to parse
[in]lengthLength of the ASN.1 structure
[out]totalLengthNumber of bytes that have been parsed
[out]certInfoInformation resulting from the parsing process
Returns:
Error code

Definition at line 1476 of file x509.c.

error_t x509ParseInt ( const uint8_t *  data,
size_t  length,
uint_t *  value 
)

Convert string to integer.

Parameters:
[in]dataString containing the representation of an integral number
[in]lengthLength of the string
[out]valueOn success, the function returns the converted integral number
Returns:
Error code

Definition at line 1847 of file x509.c.

error_t x509ParseIssuerUniqueId ( const uint8_t *  data,
size_t  length,
size_t *  totalLength,
X509CertificateInfo certInfo 
)

Parse IssuerUniqueID structure.

Parameters:
[in]dataPointer to the ASN.1 structure to parse
[in]lengthLength of the ASN.1 structure
[out]totalLengthNumber of bytes that have been parsed
[out]certInfoInformation resulting from the parsing process
Returns:
Error code

Definition at line 1364 of file x509.c.

error_t x509ParseName ( const uint8_t *  data,
size_t  length,
size_t *  totalLength,
X509Name name 
)

Parse Name structure.

Parameters:
[in]dataPointer to the ASN.1 structure to parse
[in]lengthLength of the ASN.1 structure
[out]totalLengthNumber of bytes that have been parsed
[out]nameInformation resulting from the parsing process
Returns:
Error code

Definition at line 486 of file x509.c.

error_t x509ParseRsaPublicKey ( const uint8_t *  data,
size_t  length,
X509CertificateInfo certInfo 
)

Parse RSAPublicKey structure.

Parameters:
[in]dataPointer to the ASN.1 structure to parse
[in]lengthLength of the ASN.1 structure
[out]certInfoInformation resulting from the parsing process
Returns:
Error code

Definition at line 1065 of file x509.c.

error_t x509ParseSerialNumber ( const uint8_t *  data,
size_t  length,
size_t *  totalLength,
X509CertificateInfo certInfo 
)

Parse SerialNumber field.

Parameters:
[in]dataPointer to the ASN.1 structure to parse
[in]lengthLength of the ASN.1 structure
[out]totalLengthNumber of bytes that have been parsed
[out]certInfoInformation resulting from the parsing process
Returns:
Error code

Definition at line 390 of file x509.c.

error_t x509ParseSignature ( const uint8_t *  data,
size_t  length,
size_t *  totalLength,
X509CertificateInfo certInfo 
)

Parse Signature field.

Parameters:
[in]dataPointer to the ASN.1 structure to parse
[in]lengthLength of the ASN.1 structure
[out]totalLengthNumber of bytes that have been parsed
[out]certInfoInformation resulting from the parsing process
Returns:
Error code

Definition at line 432 of file x509.c.

error_t x509ParseSignatureAlgo ( const uint8_t *  data,
size_t  length,
size_t *  totalLength,
X509CertificateInfo certInfo 
)

Parse SignatureAlgorithm structure.

Parameters:
[in]dataPointer to the ASN.1 structure to parse
[in]lengthLength of the ASN.1 structure
[out]totalLengthNumber of bytes that have been parsed
[out]certInfoInformation resulting from the parsing process
Returns:
Error code

Definition at line 1750 of file x509.c.

error_t x509ParseSignatureValue ( const uint8_t *  data,
size_t  length,
size_t *  totalLength,
X509CertificateInfo certInfo 
)

Parse SignatureValue field.

Parameters:
[in]dataPointer to the ASN.1 structure to parse
[in]lengthLength of the ASN.1 structure
[out]totalLengthNumber of bytes that have been parsed
[out]certInfoInformation resulting from the parsing process
Returns:
Error code

Definition at line 1801 of file x509.c.

error_t x509ParseSubjectPublicKeyInfo ( const uint8_t *  data,
size_t  length,
size_t *  totalLength,
X509CertificateInfo certInfo 
)

Parse SubjectPublicKeyInfo structure.

Parameters:
[in]dataPointer to the ASN.1 structure to parse
[in]lengthLength of the ASN.1 structure
[out]totalLengthNumber of bytes that have been parsed
[out]certInfoInformation resulting from the parsing process
Returns:
Error code

Definition at line 865 of file x509.c.

error_t x509ParseSubjectUniqueId ( const uint8_t *  data,
size_t  length,
size_t *  totalLength,
X509CertificateInfo certInfo 
)

Parse SubjectUniqueID structure.

Parameters:
[in]dataPointer to the ASN.1 structure to parse
[in]lengthLength of the ASN.1 structure
[out]totalLengthNumber of bytes that have been parsed
[out]certInfoInformation resulting from the parsing process
Returns:
Error code

Definition at line 1420 of file x509.c.

error_t x509ParseTbsCertificate ( const uint8_t *  data,
size_t  length,
size_t *  totalLength,
X509CertificateInfo certInfo 
)

Parse TBSCertificate structure.

Parameters:
[in]dataPointer to the ASN.1 structure to parse
[in]lengthLength of the ASN.1 structure
[out]totalLengthNumber of bytes that have been parsed
[out]certInfoInformation resulting from the parsing process
Returns:
Error code

Definition at line 186 of file x509.c.

error_t x509ParseTime ( const uint8_t *  data,
size_t  length,
size_t *  totalLength,
DateTime dateTime 
)

Parse UTCTime or GeneralizedTime structure.

Parameters:
[in]dataPointer to the ASN.1 structure to parse
[in]lengthLength of the ASN.1 structure
[out]totalLengthNumber of bytes that have been parsed
[out]dateTimedate resulting from the parsing process
Returns:
Error code

Definition at line 740 of file x509.c.

error_t x509ParseValidity ( const uint8_t *  data,
size_t  length,
size_t *  totalLength,
X509CertificateInfo certInfo 
)

Parse Validity field.

Parameters:
[in]dataPointer to the ASN.1 structure to parse
[in]lengthLength of the ASN.1 structure
[out]totalLengthNumber of bytes that have been parsed
[out]certInfoInformation resulting from the parsing process
Returns:
Error code

Definition at line 681 of file x509.c.

error_t x509ParseVersion ( const uint8_t *  data,
size_t  length,
size_t *  totalLength,
X509CertificateInfo certInfo 
)

Parse Version field.

Parameters:
[in]dataPointer to the ASN.1 structure to parse
[in]lengthLength of the ASN.1 structure
[out]totalLengthNumber of bytes that have been parsed
[out]certInfoInformation resulting from the parsing process
Returns:
Error code

Definition at line 323 of file x509.c.

error_t x509ReadDsaPublicKey ( const X509CertificateInfo certInfo,
DsaPublicKey key 
)

Read a DSA public key.

Parameters:
[in]certInfoX.509 certificate
[out]keyDSA public key
Returns:
Error code

Definition at line 1929 of file x509.c.

error_t x509ReadRsaPublicKey ( const X509CertificateInfo certInfo,
RsaPublicKey key 
)

Read a RSA public key.

Parameters:
[in]certInfoX.509 certificate
[out]keyRSA public key
Returns:
Error code

Definition at line 1879 of file x509.c.

error_t x509ValidateCertificate ( const X509CertificateInfo certInfo,
const X509CertificateInfo issuerCertInfo 
)

X.509 certificate validation.

Parameters:
[in]certInfoX.509 certificate to be verified
[in]issuerCertInfoIssuer certificate
Returns:
Error code

Definition at line 1999 of file x509.c.