Added PKCS7 PEM support: "-----BEGIN PKCS7-----" and "-----END PKCS7-----"

This commit is contained in:
aidan garske
2024-07-02 07:58:01 -07:00
parent 32066373c2
commit c065e4a854
2 changed files with 14 additions and 2 deletions

View File

@ -24414,6 +24414,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-----";
@ -24521,6 +24525,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:
@ -25558,7 +25569,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
};