Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added PKCS7 PEM support: #7704

Merged
merged 1 commit into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion wolfcrypt/src/asn.c
Original file line number Diff line number Diff line change
Expand Up @@ -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-----";
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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;
}
Expand Down
3 changes: 2 additions & 1 deletion wolfssl/wolfcrypt/asn_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};


Expand Down