linux - 尝试使用 Openssl 解密 S/MIME 文件

标签 linux email openssl encryption smime

我是openssl新人。 我正在尝试编写一个 python 脚本(调用 openssl)来解密多个 p12 加密的 eml 文件但失败了。

我可以在 Thunderbird 中正常打开它们。

这是我尝试过的:

openssl pkcs12 -in keys/pkitepki.p12 -clcerts -nokeys -out file.crt.pem
openssl pkcs12 -in keys/pkitepki.p12 -nocerts -out file.key.pem
openssl smime -decrypt -in smime.p7m -recip file.crt.pem  -inkey file.key.pem 

我得到的错误是:

Error reading S/MIME message
139955665413864:error:0D0D40D1:asn1 encoding routines:SMIME_read_ASN1:no content type:asn_mime.c:451

我的步骤有什么问题吗?

最佳答案

输入不应该是 smime.p7m。它应该是其中包含 smime.p7m 的电子邮件。应该有电子邮件 header 和 base64 编码的内容。

关于linux - 尝试使用 Openssl 解密 S/MIME 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28518775/

相关文章:

python - 如何配置 Jenkins "New Item"以将文件推送到网络上的特定服务器?

c - C中的模拟树命令

email - 使用 Laravel 在 AWS SES 中处理退回和投诉

c# - Papercut 中的附件

c++ - 如何正确处理 OpenSSL 错误 (BIO)

java - Docker:组合多个图像

linux - 在 bash 脚本中重用虚拟文件

email - 有没有人用 CakePHP 电子邮件组件设置 DKIM?

c++ - Boost.Asio SSL 上下文未验证证书

openssl 忽略序列号扩展名