« Back to documentation index 
    
x509.c File Reference 
X.509 certificate parsing and verification.  
More... 
Go to the source code of this file. 
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. 
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.c .
Function Documentation 
      
        
          error_t  x509ParseAlgorithmIdentifier ( 
          const uint8_t *  
           data ,  
         
        
          size_t  
           length ,  
         
        
          size_t *  
           totalLength ,  
         
        
          X509CertificateInfo  *  certInfo   
         
        
          ) 
           
      
 
Parse AlgorithmIdentifier structure. 
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] certInfo Information resulting from the parsing process  
   
Returns: Error code  Definition at line 971  of file x509.c .
 
 
Parse BasicConstraints structure. 
Parameters: 
  
    [in] data Pointer to the ASN.1 structure to parse  [in] length Length of the ASN.1 structure  [out] certInfo Information resulting from the parsing process  
   
Returns: Error code  Definition at line 1661  of file x509.c .
 
 
Parse a X.509 certificate. 
Parameters: 
  
    [in] data Pointer to the X.509 certificate to parse  [in] length Length of the X.509 certificate  [out] certInfo Information resulting from the parsing process  
   
Returns: Error code  Definition at line 124  of file x509.c .
 
 
Parse DSA domain parameters. 
Parameters: 
  
    [in] data Pointer to the ASN.1 structure to parse  [in] length Length of the ASN.1 structure  [out] certInfo Information resulting from the parsing process  
   
Returns: Error code  Definition at line 1144  of file x509.c .
 
 
Parse DSAPublicKey structure. 
Parameters: 
  
    [in] data Pointer to the ASN.1 structure to parse  [in] length Length of the ASN.1 structure  [out] certInfo Information resulting from the parsing process  
   
Returns: Error code  Definition at line 1243  of file x509.c .
 
 
Parse ECParameters structure. 
Parameters: 
  
    [in] data Pointer to the ASN.1 structure to parse  [in] length Length of the ASN.1 structure  [out] certInfo Information resulting from the parsing process  
   
Returns: Error code  Definition at line 1286  of file x509.c .
 
 
Parse ECPublicKey structure. 
Parameters: 
  
    [in] data Pointer to the ASN.1 structure to parse  [in] length Length of the ASN.1 structure  [out] certInfo Information resulting from the parsing process  
   
Returns: Error code  Definition at line 1331  of file x509.c .
 
 
Parse Extensions structure. 
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] certInfo Information 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] data String containing the representation of an integral number  [in] length Length of the string  [out] value On success, the function returns the converted integral number  
   
Returns: Error code  Definition at line 1847  of file x509.c .
 
 
Parse IssuerUniqueID structure. 
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] certInfo Information 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] 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] name Information resulting from the parsing process  
   
Returns: Error code  Definition at line 486  of file x509.c .
 
 
Parse RSAPublicKey structure. 
Parameters: 
  
    [in] data Pointer to the ASN.1 structure to parse  [in] length Length of the ASN.1 structure  [out] certInfo Information resulting from the parsing process  
   
Returns: Error code  Definition at line 1065  of file x509.c .
 
 
Parse SerialNumber 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] certInfo Information resulting from the parsing process  
   
Returns: Error code  Definition at line 390  of file x509.c .
 
 
Parse Signature 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] certInfo Information resulting from the parsing process  
   
Returns: Error code  Definition at line 432  of file x509.c .
 
 
Parse SignatureAlgorithm structure. 
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] certInfo Information resulting from the parsing process  
   
Returns: Error code  Definition at line 1750  of file x509.c .
 
 
Parse SignatureValue 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] certInfo Information 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] 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] certInfo Information resulting from the parsing process  
   
Returns: Error code  Definition at line 865  of file x509.c .
 
 
Parse SubjectUniqueID structure. 
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] certInfo Information resulting from the parsing process  
   
Returns: Error code  Definition at line 1420  of file x509.c .
 
 
Parse TBSCertificate structure. 
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] certInfo Information 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] 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] dateTime date resulting from the parsing process  
   
Returns: Error code  Definition at line 740  of file x509.c .
 
 
Parse Validity 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] certInfo Information resulting from the parsing process  
   
Returns: Error code  Definition at line 681  of file x509.c .
 
 
Parse Version 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] certInfo Information resulting from the parsing process  
   
Returns: Error code  Definition at line 323  of file x509.c .
 
 
Read a DSA public key. 
Parameters: 
  
    [in] certInfo X.509 certificate  [out] key DSA public key  
   
Returns: Error code  Definition at line 1929  of file x509.c .
 
 
Read a RSA public key. 
Parameters: 
  
    [in] certInfo X.509 certificate  [out] key RSA public key  
   
Returns: Error code  Definition at line 1879  of file x509.c .
 
 
X.509 certificate validation. 
Parameters: 
  
    [in] certInfo X.509 certificate to be verified  [in] issuerCertInfo Issuer certificate  
   
Returns: Error code  Definition at line 1999  of file x509.c .