openssl - 将 Sectigo/Comodo 的代码签名证书转换为实际可用的 .pfx 文件
问题描述
当我尝试使用 Firefox 从 Sectigo/Comodo 下载代码签名证书时,我最终下载了一个名为 的文件CollectCCC
,没有文件扩展名。我不清楚如何使用它来签署二进制文件。当我尝试使用它来签署二进制文件(/debug
打开)时,我得到以下信息:
> .\installation\signtool.exe sign /debug /f 'C:\Users\username\Downloads\CollectCCC' .\DraughtHub_Link.exe
The following certificates were considered:
Issued to: GoDragons
Issued by: Sectigo RSA Code Signing CA
Expires: Fri Oct 22 00:59:59 2021
SHA1 hash: <hash>
Issued to: Sectigo RSA Code Signing CA
Issued by: USERTrust RSA Certification Authority
Expires: Wed Jan 01 00:59:59 2031
SHA1 hash: <hash>
Issued to: USERTrust RSA Certification Authority
Issued by: AAA Certificate Services
Expires: Mon Jan 01 00:59:59 2029
SHA1 hash: <hash>
Issued to: AAA Certificate Services
Issued by: AAA Certificate Services
Expires: Mon Jan 01 00:59:59 2029
SHA1 hash: <hash>
After EKU filter, 4 certs were left.
After expiry filter, 4 certs were left.
After Private Key filter, 0 certs were left.
SignTool Error: No certificates were found that met all the given criteria.
部分问题是我无法使用 IE 下载他们的证书(他们推荐的方式,叹气),因为我没有使用 IE 创建代码签名证书请求。我使用创建了代码签名证书请求openssl
。
我也尝试将其导入CollectCCC
到 IE 中,但失败了。
免责声明:我不建议将 Sectigo 和/或 Comodo 用于代码签名证书!我和他们的经历很糟糕!为获得更好的服务付出更多是值得的。
解决方案
经过大量谷歌搜索,我最终确定该CollectCCC
文件的类型为.p7s
.
您可以使用以下命令将.p7s
文件转换为.pfx
文件(对二进制文件进行签名所需)openssl
(这是一个两步过程):
openssl pkcs7 -inform der -in CollectCCC -print_certs -out CollectCCC.pem
openssl pkcs12 -export -out certificate.pfx -inkey ~/.csr/www.draughthub.com.key -in CollectCCC.pem
您将在其中替换~/.csr/www.draughthub.com.key
为您创建的私钥的位置以提出代码签名证书请求。第二步将提示您输入密码。这是您用于创建请求的密码(以及相应的私钥)。
推荐阅读
- time-complexity - 确定递归函数的时间复杂度
- flutter - 无法使用条码扫描器显示条码的内容
- azure-devops - Azure DevOps 从动态存储库名称构建
- symfony - Symfony Doctrine findOneBy 不等于
- qt - 为什么 SwipeView 组件不尊重 Item 模型属性?
- tableau-api - 在地图上显示移动平均线的变化
- c++ - 二叉搜索树中的搜索功能实现
- python - 我有一个关于运行 python manage.py test 的命令行的 Django 问题
- java - 是否可以在测试用例中使用 Mockito 返回 LinkedHashMap 的空列表
- python - 根据条件组织数据框中的列