【问题标题】:Openssl command line fails to verify detached smime signature created moments earlierOpenssl 命令行无法验证之前创建的分离的 smime 签名
【发布时间】:2012-06-05 22:33:47
【问题描述】:

我在 OSX 10.6 上使用 openssl 1.0.1b 的命令行界面。

首先我创建一个 DSA 密钥。

openssl dsaparam -noout -out privatekey.pem -genkey 1024

接下来我从该密钥创建一个自签名证书。

openssl req -new -outform PEM -out certificate.pem -key privatekey.pem -keyform PEM -sha1 -x509 -days 1000

接下来我使用该证书和密钥来创建文件的分离 smime 签名。

openssl smime -sign -in file.zip -out file.zip.signature -outform DER -inkey privatekey.pem -signer certificate.pem

最后我立即尝试验证同一个文件/签名*

openssl smime -verify -in file.zip.signature -inform DER -content file.zip -noverify certificate.pem > /dev/null

但不知何故,我的摘要失败了。

PKCS7 routines:PKCS7_signatureVerify:digest failure:pk7_doit.c:1097:
PKCS7 routines:PKCS7_verify:signature failure:pk7_smime.c:410

没有改变文件,手动 md5 哈希匹配前后,但不知何故签名摘要失败。有没有人知道我做错了什么?

谢谢。

`* 注意 -noverify 用于告诉 openssl 不要警告我证书正在自签名

【问题讨论】:

    标签: openssl signature verify pkcs#7 smime


    【解决方案1】:

    我已经解决了这个问题。

    因为我没有使用 -binary 标志 openssl 正在将输入文件中的 \n 转换为 \r\n

    【讨论】:

      猜你喜欢
      • 2011-07-05
      • 2018-03-09
      • 2013-02-06
      • 1970-01-01
      • 1970-01-01
      • 2017-03-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多