I want to extract signature from pkcs7 envelop. How can i do it ?
Asked
Active
Viewed 1,966 times
1 Answers
4
Use STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7)
to retrieve the individual SignerInfos contained in your PKCS7.
To get the actual signature from an individual SignerInfo, you will have to access the corresponding pointer manually. PKCS7_SIGNER_INFO is defined as:
typedef struct pkcs7_signer_info_st
{
ASN1_INTEGER *version; /* version 1 */
PKCS7_ISSUER_AND_SERIAL *issuer_and_serial;
X509_ALGOR *digest_alg;
STACK_OF(X509_ATTRIBUTE) *auth_attr; /* [ 0 ] */
X509_ALGOR *digest_enc_alg;
ASN1_OCTET_STRING *enc_digest;
STACK_OF(X509_ATTRIBUTE) *unauth_attr; /* [ 1 ] */
/* The private key to sign with */
EVP_PKEY *pkey;
} PKCS7_SIGNER_INFO;
The correct field is (slightly misleading) enc_digest
.

emboss
- 38,880
- 7
- 101
- 108
-
Is there a way to get this in python? – Barun Sharma Feb 05 '15 at 11:08