获取代码签名证书的步骤

问题描述 投票:4回答:2

我们使用证书在我们的产品中签署ActiveX。 通常客户端发送私人密钥的spc和pvk文件和密码。 我使用spc和pvk文件生成pfx文件并使用此pfx文件签署ActiveX。

以前的证书很快就会过期,客户向我发送了新证书。 但现在他向我发送了密钥库文件和电子邮件,其中包含BASE64格式的证书。 电子邮件中有以下条目:

Below is your Code Signing certificate:
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----

Below is the intermediate CA certificate:
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----

Below is your certificate in pkcs7 format:
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----

我做了下一步创建pfx文件的步骤:

1. Put certificate in pkcs7 format from email to file certificate.p7b.

2. Export certificate in pkcs7 format into certificate.cer file.
openssl.exe pkcs7 -print_certs -in certificate.p7b -out certificate.cer

3. Generate certificate.spc file from certificate.cer.
cert2Spc.exe certificate.cer certificate.spc

4. Export private key from keystore into PKCS#12 (.p12) file.
keytool -importkeystore -srckeystore keystore -destkeystore new-store.p12 -deststoretype PKCS12

5. Extract private key from PKCS#12 to PEM.
openssl.exe pkcs12 -in new-store.p12 -nodes -out private.rsa.pem

6. Create PVK file from PEM.
openssl rsa -in private.rsa.pem -outform PVK -pvk-strong -out FILENAME.pvk

7. Create PFX file from SPC and PVK files.
pvk2pfx.exe -pvk FILENAME.pvk -pi <password> -spc certificate.spc -pfx myproject.pfx -po <password>

这是正确的方法吗? 对我来说很多步骤。 生成pfx文件有多短路径?

我应该如何处理电子邮件中的“代码签名证书”?

openssl certificate keystore keytool pfx
2个回答
0
投票

这是正确的路径,尤其是在必须从Java密钥库导出证书时。

我遇到了类似的问题,不得不将Java证书转换为pfx,并从你的问题中找到了很好的灵感。


0
投票

如果要缩短过程,可以跳过步骤3,因为pvk2pfx接受.cer格式作为.spc的替代。

© www.soinside.com 2019 - 2024. All rights reserved.