Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
403 views
in Technique[技术] by (71.8m points)

windows - 如何从证书和私钥创建.pfx文件?(How to create .pfx file from certificate and private key?)

I need .pfx file to install https on website on IIS.

(我需要.pfx文件在IIS上的网站上安装https。)

I have two separate files: certificate (.cer or pem) and private key (.crt) but IIS accepts only .pfx files.

(我有两个单独的文件:证书(.cer或pem)和私钥(.crt)但IIS只接受.pfx文件。)

I obviously installed certificate and it is available in certificate manager (mmc) but when I select Certificate Export Wizard I cannot select PFX format (it's greyed out)

(我显然安装了证书,它在证书管理器(mmc)中可用,但是当我选择证书导出向导时,我无法选择PFX格式(它是灰色的))

Are there any tools to do that or C# examples of doing that programtically?

(是否有任何工具可以做到这一点或C#以编程方式执行此操作的示例?)

  ask by jlp translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You will need to use openssl.

(您将需要使用openssl。)

openssl pkcs12 -export -out domain.name.pfx -inkey domain.name.key -in domain.name.crt

The key file is just a text file with your private key in it.

(密钥文件只是一个包含私钥的文本文件。)

If you have a root CA and intermediate certs, then include them as well using multiple -in params

(如果您有根CA和中间证书,那么也可以使用多个-in参数包含它们)

openssl pkcs12 -export -out domain.name.pfx -inkey domain.name.key -in domain.name.crt -in intermediate.crt -in rootca.crt

You can install openssl from here: openssl

(你可以从这里安装openssl: openssl)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...