如何转换PFX证书文件以在linux服务器上与Apache一起使用?
我从Windows证书服务创建了PFX。PFX包含整个证书链。(它只是一个根证书和主证书,没有中间证书。)
引领我吧,智者们。
发布于 2012-01-08 09:25:30
使用OpenSSL,您可以使用下一个命令将pfx转换为与Apache兼容的格式:
openssl pkcs12 -in domain.pfx -clcerts -nokeys -out domain.cer
openssl pkcs12 -in domain.pfx -nocerts -nodes -out domain.key 第一个命令提取domain.cer的公钥。
第二个命令提取domain.key的私钥。
使用以下命令更新Apache配置文件:
<VirtualHost 192.168.0.1:443>
...
SSLEngine on
SSLCertificateFile /path/to/domain.cer
SSLCertificateKeyFile /path/to/domain.key
...
</VirtualHost>发布于 2013-03-27 18:23:39
此外,
openssl pkcs12 -in domain.pfx -clcerts -nokeys -out domain.cer
openssl pkcs12 -in domain.pfx -nocerts -nodes -out domain.key我还生成了证书颁发机构(CA)证书:
openssl pkcs12 -in domain.pfx -out domain-ca.crt -nodes -nokeys -cacerts并将其包含在Apache配置文件中:
<VirtualHost 192.168.0.1:443>
...
SSLEngine on
SSLCertificateFile /path/to/domain.cer
SSLCertificateKeyFile /path/to/domain.key
SSLCACertificateFile /path/to/domain-ca.crt
...
</VirtualHost>发布于 2013-02-01 22:56:06
为了让它与Apache一起工作,我们需要一个额外的步骤。
openssl pkcs12 -in domain.pfx -clcerts -nokeys -out domain.cer
openssl pkcs12 -in domain.pfx -nocerts -nodes -out domain_encrypted.key
openssl rsa -in domain_encrypted.key -out domain.key最后一个命令对密钥进行解密,以便与Apache一起使用。domain.key文件应如下所示:
-----BEGIN RSA PRIVATE KEY-----
MjQxODIwNTFaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3d3d3
LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxp
YWIuKTElMCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEG
A1UEAxMqRW50cnVzdC5uZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgp
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArU1LqRKGsuqjIAcVFmQq
-----END RSA PRIVATE KEY-----https://stackoverflow.com/questions/8774574
复制相似问题