Merge pull request #7704 from aidangarske/PKCS7_PEM

Added PKCS7 PEM support:
This commit is contained in:
David Garske
2024-07-19 07:39:51 -07:00
committed by GitHub
2 changed files with 14 additions and 2 deletions

View File

@ -24526,6 +24526,10 @@ wcchar END_ENC_PRIV_KEY = "-----END ENCRYPTED PRIVATE KEY-----";
wcchar END_EC_PARAM = "-----END EC PARAMETERS-----";
#endif
#endif
#ifdef HAVE_PKCS7
wcchar BEGIN_PKCS7 = "-----BEGIN PKCS7-----";
wcchar END_PKCS7 = "-----END PKCS7-----";
#endif
#if defined(HAVE_ECC) || defined(HAVE_ED25519) || defined(HAVE_ED448) || \
!defined(NO_DSA)
wcchar BEGIN_DSA_PRIV = "-----BEGIN DSA PRIVATE KEY-----";
@ -24633,6 +24637,13 @@ int wc_PemGetHeaderFooter(int type, const char** header, const char** footer)
ret = 0;
break;
#endif
#ifdef HAVE_PKCS7
case PKCS7_TYPE:
if (header) *header = BEGIN_PKCS7;
if (footer) *footer = END_PKCS7;
ret = 0;
break;
#endif
#ifndef NO_DSA
case DSA_TYPE:
case DSA_PRIVATEKEY_TYPE:
@ -25670,7 +25681,7 @@ int wc_CertPemToDer(const unsigned char* pem, int pemSz,
}
if (type != CERT_TYPE && type != CHAIN_CERT_TYPE && type != CA_TYPE &&
type != CERTREQ_TYPE) {
type != CERTREQ_TYPE && type != PKCS7_TYPE) {
WOLFSSL_MSG("Bad cert type");
return BAD_FUNC_ARG;
}

View File

@ -177,7 +177,8 @@ enum CertType {
SPHINCS_SMALL_LEVEL3_TYPE,
SPHINCS_SMALL_LEVEL5_TYPE,
ECC_PARAM_TYPE,
CHAIN_CERT_TYPE
CHAIN_CERT_TYPE,
PKCS7_TYPE
};