首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >签名工具PKCS7分离签名失败,错误为: pkcs7签名

签名工具PKCS7分离签名失败,错误为: pkcs7签名
EN

Stack Overflow用户
提问于 2021-09-09 19:16:03
回答 1查看 137关注 0票数 0

我在使用windows的signtool.exe创建Zip文件的分离PKCS#7签名时遇到问题。

我设法签署了一个带有嵌入签名的exe文件,但我正在努力使用命令来分离签名Zip文件。我可能遗漏了一些明显的东西。

代码语言:javascript
复制
PS C:\somewhere> Get-ChildItem -path cert:\LocalMachine\My


   PSParentPath: Microsoft.PowerShell.Security\Certificate::LocalMachine\My

Thumbprint         Subject
----------         -------
0ABCD...01234      CN=my-signing-cert.example.com, OU=(obfuscated), O=(obfuscated)...



PS C:\somewhere> & "C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64\signtool.exe" sign /debug /v /tr http://timestamp.digicert.com /fd sha256 /sha1 0ABCD...01234 /sm /p7ce DetachedSignedData /p7co 1.2.840.113549.1.7.2 /p7 "C:\somewhere\test-tiny-zip-file.zip.sig" "C:\somewhere\test-zip-file.zip"


The following certificates were considered:
    Issued to: my-signing-cert.example.com
    Issued by: my-ca-cert.example.com
    Expires:   Wed Mar 23 15:33:34 2022
    SHA1 hash: 0ABCD...01234

After EKU filter, 1 certs were left.
After expiry filter, 1 certs were left.
After Hash filter, 1 certs were left.
After Private Key filter, 1 certs were left.
The following certificate was selected:
    Issued to: my-signing-cert.example.com
    Issued by: my-ca-cert.example.com
    Expires:   Wed Mar 23 15:33:34 2022
    SHA1 hash: 0ABCD...01234

Done Adding Additional Store
SignTool Error: An unexpected internal error has occurred.
Error information: "Error: pkcs7 sign." (-2147024893/0x80070003)
EN

回答 1

Stack Overflow用户

发布于 2021-09-09 19:16:03

问题出在/p7参数中。它采用一条to a folder, not to a file路径。

/p7 Path指定为每个指定的内容文件生成公钥加密标准(PKCS) #7文件。PKCS #7文件被命名为path\filename.p7

此外:

RFC参数/p7ce可以具有以下两个值之一:对于分离的signature.

  • the参数,DetachedSignedDatapkcs7DetachedSignedData采用值1.2.840.113549.1.7.2,该值映射到DetachedSignedData

  • RFC。

代码语言:javascript
复制
& "C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64\signtool.exe" `
    sign /debug /v /tr http://timestamp.digicert.com `
    /fd sha256 /sha1 0ABCD...01234 /sm /p7ce DetachedSignedData `
    /p7co 1.2.840.113549.1.7.2 /p7 "C:\somewhere\" `
    "C:\somewhere\test-zip-file.zip"
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69123657

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档