Use STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7) to extract the individual SignerInfos contained in your PKCS7. To get a real signature from a separate SignerInfo, you will need to access the corresponding pointer manually. PKCS7_SIGNER_INFO is defined as:
typedef struct pkcs7_signer_info_st { ASN1_INTEGER *version; PKCS7_ISSUER_AND_SERIAL *issuer_and_serial; X509_ALGOR *digest_alg; STACK_OF(X509_ATTRIBUTE) *auth_attr; X509_ALGOR *digest_enc_alg; ASN1_OCTET_STRING *enc_digest; STACK_OF(X509_ATTRIBUTE) *unauth_attr; EVP_PKEY *pkey; } PKCS7_SIGNER_INFO;
The correct field (slightly misleading) enc_digest .
source share