我正在尝试用我拥有的pfx文件签署Windows 8 appx包。我使用如下命令:

signtool.exe sign /fd sha256 /f "key.pfx" "app.appx"

由此,我得到:

SignTool错误:没有找到符合所有给定标准的证书。

我没有达到什么“标准”?这仅用于测试,因此这些是自签名证书。我尝试过导入密钥,然后对其进行签名,但它总是导致相同的错误。我怎么解决这个问题?


当前回答

当通过Visual Studio得到这个错误时,这是因为有一个签名证书设置来匹配它最初开发的计算机。

您可以通过转到项目属性>签名选项卡并检查证书详细信息来检查这一点。

您可以取消选中“Sign the ClickOnce清单”以禁用签名。

如果您不想关闭此选项,则必须安装证书。

其他回答

请始终先检查您的证书有效期,因为大多数证书都有有效期。在我的情况下,证书已经过期,我正在试图建立项目。

标准包括帐户名(与之关联的私钥)、域、公司、到期日期、预期用途等等。

导致这个错误的原因有很多,其中一些已经列出了。这里还有一个提示:在导入证书时,请确保使用从证书颁发机构(CA)接收的原始文件,否则可能会丢失一些属性。

示例:最近,我试图导入从同一台机器上的另一个帐户导出的证书。证书对我的帐户可见,但没有与我的帐户相关联,因此signtool在没有明确提供文件名和密码的情况下拒绝识别它。当作为构建过程的一部分并显式地写入批处理文件或源文件时,可能不够安全。(导入ca颁发的原始证书就解决了这个问题。)

我也有同样的问题,读了一些答案(贴在这里),我看到我的证书过期了。

只需从我的启动项目创建一个新的。然后在证书管理器删除了过期的证书。

现在一切都编译好了。

我有同样的“私钥过滤后,0 certs被留下”的消息,我花了太多的时间试图弄清楚这条消息的意思。

问题是我在Windows证书存储中错误地安装了证书,因此没有与代码签名证书相关联的私钥。

我应该做的是:

Using either Firefox or Internet Explorer, submit the request to the issuer. This generates a PRIVATE KEY which is stored silently by the browser (a dialog appears for a fraction of a second in Firefox). Note that other browsers may not work: your life is too short to find out if they do. Submit the request, jump through the issuer's validation hoops and loops, sacrifice a goat, pray to the gods, submit a signed statement from your great grandparents, etc. Download the certificate (.crt) and import it into the same browser. The browser now has both the private key and the certificate. Export the certificate from the browser as a Personal Information Exchange (.p12) file. You will be asked to supply a password to protect this file. Keep a backup copy of the .p12 file. Run the Certificate Manager (certmgr.msc), right click on the Personal certificate store, select All Tasks/Import... and import the .p12 file into Windows. You will be asked for the password you used to protect the file. At this point, depending upon your security requirements, you can mark the key as exportable so you can restore a copy from the Windows store. You can also mark that a password is required before use if you want to break batch scripts. Run signtool successfully, breathe a sigh of relief, and ponder how much of your life you have wasted due to bad error messages and poor or missing documentation.

我在控制台应用程序开发中遇到了同样的问题,作为一个快速的解决方案,

那就去项目物业,

点击签名选项卡,取消选中“签名ClickOnce清单”。

图片描述:

供你参考,你也可以看到这个少于一分钟的视频解决方案。上面的图片是从视频中截取的。