RSA Key parser/decoder.
Copyright (c) 2017-2018 Microchip Technology Inc. and its subsidiaries.
#include "crypto_types.h"
#include "root_tls_cert/x509/x509_cert.h"
#include "root_tls_cert/pem.h"
#include "root_tls_cert/x509/asn1.h"
#include "crypto_api.h"
Enumerations | |
enum | RSAKeyParsing { RSA_N, RSA_E, RSA_D, RSA_P, RSA_Q, RSA_DP, RSA_DQ, RSA_QINV, RSA_DONE } |
A state machine for parsing the RSA Private key. It is ordered with the same order of the RSA key elements occurance in the ASN.1 form. More... | |
Functions | |
sint8 | CryptoDecodeRsaPrivKey (uint8 *pu8RsaKeyFile, uint32 u32KeySize, tstrASN1RSAPrivateKey *pstrRsaPrivKey) |
static sint8 | ParsePrivKey (uint8 *pu8PrivKey, uint16 u16KeySize, tstrASN1RSAPrivateKey *pstrKey) |
static sint8 | ParseRsaPrivKey (uint8 *pu8PrivKey, uint16 u16KeySize, tstrASN1RSAPrivateKey *pstrAsn1Key) |
enum RSAKeyParsing |
sint8 CryptoDecodeRsaPrivKey | ( | uint8 * | pu8RsaKeyFile, |
uint32 | u32KeySize, | ||
tstrASN1RSAPrivateKey * | pstrRsaPrivKey | ||
) |
References DecodeBase64File(), M2M_ERR_FAIL, M2M_SUCCESS, NULL, ParsePrivKey(), ParseRsaPrivKey(), PEM_PRIV_KEY, PEM_RSA_PRIV_KEY, and ret.
Referenced by WriteTlsServerKeyMaterial().
|
static |
References ASN1_GetNextElement(), ASN1_OBJECT_IDENTIFIER, ASN1_Read(), ASN1_SEQUENCE, M2M_ERR_FAIL, NULL, ParseRsaPrivKey(), tstrAsn1Context::pstrTlsBuffer, tstrTlsBuffer::pu8Buff, ret, tstrTlsBuffer::u16BuffSz, tstrTlsBuffer::u16ReadOffset, tstrAsn1Element::u32Length, and tstrAsn1Element::u8Tag.
Referenced by CryptoDecodeRsaPrivKey().
|
static |
References ASN1_GetNextElement(), ASN1_Read(), ASN1_SEQUENCE, M2M_ERR, M2M_ERR_FAIL, M2M_SUCCESS, NULL, tstrAsn1Context::pstrTlsBuffer, tstrASN1RSAPrivateKey::pu8AllocPtr, tstrTlsBuffer::pu8Buff, tstrRsaPrivateKey::pu8d, tstrRsaPrivateKey::pu8dP, tstrRsaPrivateKey::pu8dQ, tstrRsaPrivateKey::pu8e, tstrRsaPrivateKey::pu8N, tstrRsaPrivateKey::pu8p, tstrRsaPrivateKey::pu8q, tstrRsaPrivateKey::pu8QInv, ret, RSA_D, RSA_DONE, RSA_DP, RSA_DQ, RSA_E, RSA_N, RSA_P, RSA_Q, RSA_QINV, tstrASN1RSAPrivateKey::strRsaPrivKey, tstrTlsBuffer::u16BuffSz, tstrRsaPrivateKey::u16dPSize, tstrRsaPrivateKey::u16dQSize, tstrRsaPrivateKey::u16dSize, tstrRsaPrivateKey::u16eSize, tstrASN1RSAPrivateKey::u16KeyBufSz, tstrRsaPrivateKey::u16NSize, tstrRsaPrivateKey::u16PSize, tstrRsaPrivateKey::u16QInvSize, tstrRsaPrivateKey::u16QSize, tstrTlsBuffer::u16ReadOffset, tstrAsn1Element::u32Length, tstrRsaPrivateKey::u32Version, tstrAsn1Element::u8Tag, and WORD_ALIGN.
Referenced by CryptoDecodeRsaPrivKey(), and ParsePrivKey().