Interface for the X509 Certificate parsing module.
Copyright (c) 2017-2018 Microchip Technology Inc. and its subsidiaries.
#include "root_tls_cert/crypto/crypto_types.h"
#include "asn1.h"
#include "root_tls_cert/crypto/crypto.h"
#include "root_tls_cert/crypto/tls_buffer_manager.h"
Data Structures | |
struct | tstrMemPool |
struct | tstrX509Cert |
struct | tstrX520Name |
Macros | |
#define | X509_CERT_DECODE(x509Buf, x509Sz, Pool, x509Out, dumpFlag, ret) |
#define | X509_FAIL -1 |
#define | X509_NAME_MAX_SZ (64) |
#define | X509_SERIAL_NO_MAX_SZ (64) |
#define | X509_STATUS_DECODE_ERR 4 |
#define | X509_STATUS_EXPIRED 1 |
#define | X509_STATUS_REVOKED 2 |
#define | X509_STATUS_VALID 0 |
#define | X509_SUCCESS 0 |
Typedefs | |
typedef void *(* | tpfMemPoolAllocFn )(void *pvHdl, uint32 u32AllocSz) |
Functions | |
sint8 | X509_DecodeEcdsaSignature (tstrAsn1Context *pstrX509Asn1Cxt, uint8 *pu8Sig, uint16 *pu16SigSz) |
sint8 | X509Cert_Decode (tstrTlsBuffer *pstrX509Buffer, uint32 u32CertSize, tstrMemPool *pstrPool, tstrX509Cert *pstrCert, uint8 bDumpX509) |
void | X509Cert_Dump (tstrX509Cert *pstrCert) |
#define X509_CERT_DECODE | ( | x509Buf, | |
x509Sz, | |||
Pool, | |||
x509Out, | |||
dumpFlag, | |||
ret | |||
) |
#define X509_FAIL -1 |
Referenced by Cert_ComputeTBSCertHash(), Cert_DecodeDistinguishedName(), Cert_DecodeECCPubKey(), Cert_DecodeRSAPubKey(), Cert_DecodeSignature(), Cert_DecodeSubjectPubKey(), Cert_DecodeTBSCertificate(), Cert_DecodeTime(), Cert_DecodeValidity(), Cert_DecodeX520Name(), X509_DecodeEcdsaSignature(), and X509Cert_Decode().
#define X509_NAME_MAX_SZ (64) |
Referenced by Cert_DecodeX520Name().
#define X509_SERIAL_NO_MAX_SZ (64) |
Referenced by Cert_DecodeTBSCertificate().
#define X509_STATUS_DECODE_ERR 4 |
Error decoding the certificate time.
Referenced by Cert_DecodeValidity().
#define X509_STATUS_EXPIRED 1 |
The X.509 certificate is expired.
Referenced by Cert_DecodeValidity().
#define X509_STATUS_REVOKED 2 |
The X.509 certificate is marked as revoked and should not be trusted.
#define X509_STATUS_VALID 0 |
The X.509 certificate is valid.
Referenced by Cert_DecodeValidity().
#define X509_SUCCESS 0 |
Referenced by Cert_ComputeTBSCertHash(), Cert_DecodeDistinguishedName(), Cert_DecodeECCPubKey(), Cert_DecodeRSAPubKey(), Cert_DecodeSignature(), Cert_DecodeTBSCertificate(), Cert_DecodeTime(), Cert_DecodeValidity(), Cert_DecodeX520Name(), CryptoX509CertDecode(), X509_DecodeEcdsaSignature(), and X509Cert_Decode().
tpfMemPoolAllocFn |
sint8 X509_DecodeEcdsaSignature | ( | tstrAsn1Context * | pstrX509Asn1Cxt, |
uint8 * | pu8Sig, | ||
uint16 * | pu16SigSz | ||
) |
References ASN1_GetNextElement(), ASN1_INTEGER, ASN1_Read(), ASN1_SEQUENCE, NULL, tstrAsn1Element::u32Length, tstrAsn1Element::u8Tag, X509_FAIL, and X509_SUCCESS.
Referenced by Cert_DecodeSignature().
sint8 X509Cert_Decode | ( | tstrTlsBuffer * | pstrX509Buffer, |
uint32 | u32CertSize, | ||
tstrMemPool * | pstrPool, | ||
tstrX509Cert * | pstrCert, | ||
uint8 | bDumpX509 | ||
) |
References ASN1_GetNextElement(), ASN1_SEQUENCE, Cert_ComputeTBSCertHash(), Cert_DecodeAlgID(), Cert_DecodeSignature(), Cert_DecodeTBSCertificate(), tstrX509Cert::enuHashAlg, tstrX509Cert::enuSignAlg, tstrMemPool::fpAlloc, NULL, tstrX509Cert::pstrMemPool, tstrAsn1Context::pstrTlsBuffer, TLS_BufferGetPos(), tstrAsn1Element::u32Length, tstrX509AlgID::u8AlgParam1, tstrX509AlgID::u8AlgParam2, tstrAsn1Element::u8Tag, X509_FAIL, X509_SUCCESS, and X509Cert_Dump().
Referenced by CryptoX509CertDecode().
void X509Cert_Dump | ( | tstrX509Cert * | pstrCert | ) |
References tstrX520Name::acCmnName, tstrX509Cert::au8SerialNo, tstrX509Cert::enuHashAlg, tstrX509Cert::enuSignAlg, tstrPublicKey::enuType, HASH_ALG_SHA1, HASH_ALG_SHA224, HASH_ALG_SHA256, HASH_ALG_SHA512, i, M2M_DUMP_BUF, NULL, tstrRSAPublicKey::pu8E, tstrRSAPublicKey::pu8N, tstrX509Cert::pu8Sig, PUBKEY_ALG_ECC, PUBKEY_ALG_RSA, tstrPublicKey::strEccKey, tstrX509Cert::strExpiryDate, tstrX509Cert::strIssuer, tstrX509Cert::strPubKey, tstrECPublicKey::strQ, tstrPublicKey::strRSAKey, tstrX509Cert::strStartDate, tstrX509Cert::strSubject, TLS_INFO, TLS_LOG, TLS_SIG_ALG_ECDSA, TLS_SIG_ALG_RSA, tstrRSAPublicKey::u16ESize, tstrRSAPublicKey::u16NSize, tstrX509Cert::u16SigSz, tstrSystemTime::u16Year, tstrSystemTime::u8Day, tstrSystemTime::u8Hour, tstrSystemTime::u8Minute, tstrSystemTime::u8Month, tstrSystemTime::u8Second, tstrX509Cert::u8SerialNumberLength, and tstrX509Cert::u8Version.
Referenced by X509Cert_Decode().