I need to extract the user certificate from a pkcs7 signature file. I can do it via the command line using the following:
openssl pkcs7 -in somesign.pks7 -inform PEM -print_certs
This will give me the entire certificate chain and I can process the resulting file to extract what I want.
Is there any way to do that with the openssl_pkcs7_ commands? I saw that openssl_pkcs7_verify has the $outfilename where the certs would be stored but I don't have the signed message, but it seems the $filename should have both the signature and the message, which is not my case (signature is in a separate file).
Try this