Topic: PKCS7 to X509 conversion.

Hi,
Is there any wolfssl API calls or procedures for converting parsed PKCS7 certificate to X.509 certificate.

Share

Re: PKCS7 to X509 conversion.

Hi,

Yes, wolfCrypt PKCS#7 API can be used to decode a p7b certificate and extract out an X.509 certificate.

You will want to use wc_PKCS7_Init() to initialize a PKCS7 structure, then use wc_PKCS7_VerifySignedData() to decode the p7b certificate.  wc_PKCS7_VerifySignedData() will place decoded X.509 DER-encoded certificates into the pkcs7->cert array, with the size of each stored in the pkcs7->certSz array.

The following GitHub Issue has more details on API usage:

https://github.com/wolfSSL/wolfssl/issues/3638

Can you share more details about the project you are looking to use wolfCrypt in?

Thanks,
Chris