4

我们使用证书在我们的产品中签署 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 文件是否有很多最短路径?

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

4

2 回答 2

0

This is the correct path, especially if you have to export the certificate from a Java keystore.

I had a similar problem, having to convert a Java certificate to pfx and have found great inspiration from your question.

于 2014-01-08T15:11:23.263 回答
0

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

于 2014-01-27T10:42:33.267 回答