openssl-从PKCS7消息中提取原始数据

时间:2018-10-29 17:05:22

标签: openssl

与外部API提供程序集成时,我们都交换了公钥,当我调用服务提供程序的API时,我使用openssl cms -sign实用程序用我的私钥对数据进行签名,并且当服务提供者返回我对其签名数据进行响应时使用他们的私钥。服务提供商正在将数据发送到base64, 现在,我想将包含数据和签名的PKCS7 base64字符串分解为单独的数据:原始数据和分离的PKCS7签名。

我正在使用以下命令:

openssl cms -verify -in signed_message.txt -out out.txt -signer public_key_of_client_who_signed_the_message.pem

signed_message.txt的内容为:(服务提供商仅返回base64字符串)

MIME-Version: 1.0
Content-Disposition: attachment; filename="smime.p7m"
Content-Type: application/pkcs7-mime; smime-type=signed-data; name="smime.p7m"
Content-Transfer-Encoding: base64

BASE64 STRING COMING FROM SERVICE PROVIDER

但出现以下错误:

Error reading S/MIME message
55032:error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag:tasn_dec.c:1220:
55032:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error:tasn_dec.c:386:Type=CMS_ContentInfo
55032:error:0D0D106E:asn1 encoding routines:B64_READ_ASN1:decode error:asn_mime.c:192:
55032:error:0D0D40CB:asn1 encoding routines:SMIME_read_ASN1:asn1 parse error:asn_mime.c:518:

请帮助我如何获取原始数据和证书详细信息。

0 个答案:

没有答案
相关问题