How can I extract signature from pkcs7 envelop?

主宰稳场 提交于 2019-12-11 03:16:03

问题


I want to extract signature from pkcs7 envelop. How can i do it ?


回答1:


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.



来源:https://stackoverflow.com/questions/9224757/how-can-i-extract-signature-from-pkcs7-envelop

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!