Cannot retrieve signer certificate with openssl library in C
Rares Dumitrache
2014-10-20 09:46:18 UTC

I have a signing certificate with which I sign a message with openssl
command line. I do NOT use -nocerts option, so the signing certificate
should be embedded in the CMS message. I verify that it exists by
retrieving it with command:
openssl cms -verify -in infile.ini -certsout cert_to_test.pem and I
test the certificate and it works.

Now I want to retrieve the certificate in C, using openssl library. I
read the CMS message file, then I read the SMIME and try to get the
signer. Here is the functions called:

pBioFile= BIO_new_file(file, "r");

pCms = SMIME_read_CMS(pBioFile, NULL); -> pCms is not NULL

pCms_signer = CMS_get0_SignerInfos(pCms);

sk_CMS_SignerInfo_num(pskCms_signer ) -> return 0 meaning no
certificates were found.

Can anyone help with what am I doing wrong?

OpenSSL Project http://www.openssl.org
User Support Mailing List openssl-users-MCmKBN63+***@public.gmane.org
Automated List Manager majordomo-MCmKBN63+***@public.gmane.org