我尝试了下面的方法,它成功了,虽然它没有得到你 SignCode.exe(它已被弃用并被 SignTool.exe 取代)
您可以通过安装 just 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提供。