从cert文件转换为pfx文件 [英] Conversion from cert file to pfx file

查看:1465
本文介绍了从cert文件转换为pfx文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将cert文件转换为pfx文件?我尝试将我的cerf文件导入IE,但它从来没有显示在个人选项卡下,因此我不能导出。

Is it possible to convert a cert file to a pfx file? I tried importing my cerf file into IE, but it is never shown under the "personal" tab, thus I cannot export there.

我正在寻找是否有替代可用。

I am looking for if there is alternatives available.

FYI,cerf文件是使用keytool创建的,然后导出到cert文件。

FYI, the cerf file is created by using "keytool" and then doing an export to a cert file.

推荐答案

本文介绍从.cer文件创建.pfx文件的两种方法:

This article describes two ways of creating a .pfx file from a .cer file:

  • Maxime Lamure: Create your own .pfx file for ClickOnce

创建您的公开&私人密钥(您将被提示定义私钥的密码):

Create your public & private Keys (You will be prompt to define the private key’s password):

makecert.exe -sv MyKey.pvk -nCN =。 NET就绪!!! MyKey.cer

使用公钥和私钥创建PFX文件

Create your PFX file from the public and private key

pvk2pfx.exe -pvk MyKey.pvk -spc MyKey.cer -pfx MyPFX.pfx -po toto

你可以在C#中通过将字节数组直接写入到一个文件来实现:

Programmaticaly you could do so in C# by writing the byte array directly to a file:

byte[] certificateData = certificate.Export(X509ContentType.Pfx, "YourPassword");
File.WriteAllBytes(@"C:\YourCert.pfx", certificateData);

一般来说(如果你使用IE 8),你可能想看看这个答案on SO:

And generally (if you're using IE 8) you might want to have a look at this answer on SO:

  • How to make IE8 trust a self-signed certificate in 20 irritating steps

希望能帮助你。

这篇关于从cert文件转换为pfx文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆