如果您决定签署您的代码,您将需要:
- 信号码.exe
- 制作证书.exe
- cert2spc.exe
- pvk2pfx.exe
下载这些工具的最佳位置是什么?
有没有办法在不下载大量 Microsoft Windows SDK 的情况下做到这一点?
如果您决定签署您的代码,您将需要:
下载这些工具的最佳位置是什么?
有没有办法在不下载大量 Microsoft Windows SDK 的情况下做到这一点?
从Windows SDK开始。那应该有你正在寻找的大部分内容。
此外,SignCode.exe在 .NET 1.1 之后已被弃用。SignTool.exe是替代品。
通常,只有少数 SDK 工具可以在 Microsoft 官方软件包之外再分发。它们列在一个redist.txt文件中。在我的系统上,我在其中找到了一个 .NET SDKredist.txt文件%ProgramFiles%\Microsoft.NET\SDK\v2.0 64bit(我假设该文件夹在 x86 系统上称为“v2.0”)。它是这样说的:
.NET 框架 SDK 文件 根据软件的许可条款, 以下 .EXE 文件可能未经修改即可分发: 魔术师UI.exe 魔法师.exe Makecert.exe
所以看起来这些文件中的大多数都不能再分发。再说一次,我的答案是下载 Windows SDK。 请记住,如果您愿意,您可以只安装一部分工具;安装程序允许您选择/取消选择任何组件(例如,仅 .NET 开发工具)。
我刚刚安装了适用于 Windows 8 的 Windows SDK。但我仍然找不到,SignTool.exe也找不到SignCode.exe.
直到我意识到微软改变了它的安装路径。现在它已安装到以下位置之一:
C:\Program Files (x86)\Windows Kits\8.1\bin\x64C:\Program Files (x86)\Windows Kits\8.1\bin\x86C:\Program Files (x86)\Windows Kits\8.0\bin\x64C:\Program Files (x86)\Windows Kits\8.0\bin\x86在 Windows 10 上编辑,可以在以下位置找到二进制文件:
C:\Program Files (x86)\Windows Kits\10\bin\x86我相信前三个是.NET Framework SDK的一部分,而最后一个是Windows Driver Kit的一部分。
我找不到将 pvk2pfx.exe 列为平台 SDK(现在显然是 Windows SDK)一部分的文档,但我最初认为它来自那里。
我尝试了下面的方法并且它有效,虽然它没有让你 SignCode.exe(它已被弃用并被 SignTool.exe 取代)
您可以通过仅安装Visual Studio 安装中的 C++ Windows 开发工具来获取SignTool.exe (我的是古老的:2005)。更多详情@ Lindersoft.com。
如何将 PFX/P12 文件转换为 SPC/PVK 格式
导出带有私钥的证书。
使用带有以下选项的导出向导:
Export Private Key (Yes)
DO NOT TICK include all certificates in the certification path if possible
TICK enable strong protection
DO NOT TICK delete private key
先决条件:OpenSSL 0.9.8 或更高版本。首选 OpenSSL 1.x。
注意:如果您运行的是 Windows,您可以在此处下载 OpenSSL。否则,您可以直接从 OpenSSL 网站找到已编译的二进制文件,或查阅您的操作系统的包管理功能。
私钥 (PVK)
Extract your Private Key from the PFX/P12 file to PEM format.
openssl pkcs12 -in PFX_FILE -nocerts -nodes -out PEM_KEY_FILE
Note: The PFX/P12 password will be asked. This is the password you gave the file upon exporting it.
Convert PEM Private Key to PVK format.
OpenSSL 0.9.8 series:
pvk -in PEM_KEY_FILE -topvk -out PVK_FILE
OpenSSL 1.x series:
openssl rsa -in PEM_KEY_FILE -outform PVK -pvk-strong -out PVK_FILE
Note #1: In order to use pvk for OpenSSL 0.9.8 series, you must download PVK Transform.
Note #2: A PEM passphrase may be asked. This will be the password/passphrase that you will use to sign your code.
软件发行商证书 (SPC)
Extract Certificate from P12/PFX file.
openssl pkcs12 -in PFX_FILE -nokeys -out CERT_PEM_FILE
Convert Certificate to SPC format.
openssl crl2pkcs7 -nocrl -certfile CERT_PEM_FILE -outform DER -out SPC_FILE
注意:如果您从 IE 之外的其他浏览器导出证书,请确保在 CERT_PEM_FILE 中只有您的证书存在,否则代码签名将不起作用!
示例转换
PVK openssl pkcs12 -in my_pfx_file.pfx -nocerts -nodes -out rsa.pem openssl rsa -in rsa.pem -outform PVK -pvk-strong -out mykey.pvk
SPC openssl pkcs12 -in my_pfx_file.pfx -nokeys -nodes -out cert.pem openssl crl2pkcs7 -nocrl -certfile cert.pem -outform DER -out cert.spc
此信息由Komodo提供。
第 1 步:下载:
http://download.microsoft.com/download/A/6/A/A6AC035D-DA3F-4F0C-ADA4-37C8E5D34E3D/winsdk_web.exe
或者
http://www.microsoft.com/en-us/download/details.aspx?id=8279
第2步:
C:\Users\user1>"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin\signto
ol.exe"