我需要pfx文件来安装IIS网站上的https。
我有两个单独的文件:证书(。cer或pem)和私钥(.crt),但IIS只接受.pfx文件。
我显然安装了证书,它在证书管理器(mmc)中可用,但当我选择证书导出向导时,我无法选择PFX格式(它是灰色的)
有什么工具可以做到这一点吗?或者c#中有编程的例子吗?
我需要pfx文件来安装IIS网站上的https。
我有两个单独的文件:证书(。cer或pem)和私钥(.crt),但IIS只接受.pfx文件。
我显然安装了证书,它在证书管理器(mmc)中可用,但当我选择证书导出向导时,我无法选择PFX格式(它是灰色的)
有什么工具可以做到这一点吗?或者c#中有编程的例子吗?
当前回答
我有你要求的链接。使用OpenSSL将CRT和KEY文件合并为PFX
以上连结摘录:
First we need to extract the root CA certificate from the existing .crt file, because we need this later. So open up the .crt and click on the Certification Path tab. Click the topmost certificate (In this case VeriSign) and hit View Certificate. Select the Details tab and hit Copy to File… Select Base-64 encoded X.509 (.CER) certificate Save it as rootca.cer or something similar. Place it in the same folder as the other files. Rename it from rootca.cer to rootca.crt Now we should have 3 files in our folder from which we can create a PFX file. Here is where we need OpenSSL. We can either download and install it on Windows, or simply open terminal on OSX.
编辑:
有一个支持链接,提供了关于如何安装证书的分步信息。 安装成功后,导出证书,选择.pfx格式,包含私钥。 重要提示:要以.pfx格式导出证书,您需要在请求证书的同一台机器上执行以下步骤。 导入的文件可以上传到服务器。
其他回答
需要使用makecert工具。
以管理员身份打开命令提示符,输入以下命令:
makecert -sky exchange -r -n "CN=<CertificateName>" -pe -a sha1 -len 2048 -ss My "<CertificateName>.cer"
其中<CertifcateName> =要创建的证书的名称。
然后,您可以通过键入certmgr打开管理控制台的证书管理器管理单元。在开始菜单中,单击个人>证书>,您的证书应该可用。
这是一篇文章。
https://azure.microsoft.com/documentation/articles/cloud-services-certs-create/
Windows不需要安装OpenSSL的解决方案
我最近试图解决同样的问题——我只有一台windows笔记本电脑,没有安装openssl(也没有足够的管理权限来安装它)。原来windows有一个内置的实用程序,叫做certutil,它能够将。crt和。key文件组合成。pfx。医生来了。
您需要创建一个新文件夹,并将.crt和关键文件放在其中。重命名两个文件,使其具有相同的名称(但扩展名不同):
{{sitename}}.crt
{{siteName}}.key
如果你的密钥文件是一个普通的txt -只是改变扩展名。key。
之后,在该文件夹中打开cmd并运行certutil -mergepfx [INPUTFILE] [OUTPUTFILE]
例子:
证书文件:“mySite.crt”
密钥文件:mySite.key
certutil命令:certutil -mergepfx mySite。crt mySite.pfx
注意:您将被要求为新创建的.pfx文件提供密码-不要忘记记忆/存储它-因为在目标系统上导入证书时将需要它。
我从.key和.pem文件创建了.pfx文件。
比如这个openssl pkcs12 -inkey rootCA。输入rootCA。-export -out rootCA.pfx . pem
我正在使用libreSSL v2.8.3在macbook上尝试openssl,并得到错误“没有证书匹配私钥”。我有一个域证书,2个中间证书和1个根证书。所以我使用以下命令成功地工作:
openssl pkcs12 -export -clcerts -inkey private.csr.key -in domain.name.crt -certfile intermediate1.crt -certfile intermediate2.crt -certfile root.crt -out domain.name.p12 -name "Your Name"
它将要求在导入过程中使用的密码。该命令将生成一个.p12文件,该文件可以重命名为.pfx,因为两者是相同的。
我想推广“X证书和密钥管理器”或xca.exe,它就像OpenSSL的GUI版本。你可以通过以下步骤生成pfx文件:
在“private Keys”页签导入私钥; 在“Certificates”页签中导入证书; 生成pfx文件,选择证书,然后“导出”,格式选择PKCS #12。
就是这样。