排行榜 统计
  • 文章总数:1225 篇
  • 评论总数:5 条
  • 分类总数:7 个
  • 最后更新:一小时前

OpenSSL证书转PFX

本文阅读 1 分钟
首页 常用工具 正文
55Link友情链接交易平台

OpenSSL证书转pfx

pem证书转pfx证书分两种,一种带ca证书转换,一种不带ca证书转换

1. pem转pfx(不带ca证书)

以test.pem转test.pfx为例

openssl rsa -in test.pem -out test.key
openssl x509 -in test.pem -out test.crt
openssl pkcs12 -export -out test.pfx -inkey test.key -in test.crt

2. pem转pfx(带ca证书)

以test.pem和ca.crt(ca.pem)转 test_ca.pfx为例

openssl rsa -in test.pem -out test.key
openssl x509 -in test.pem -out test.crt
openssl pkcs12 -export -out test_ca.pfx -inkey test.key -in test.crt -CAfile ca.crt

3. 如果ca证书为pem格式

openssl pkcs12 -export -out test_ca.pfx -inkey test.key -in test.crt -CAfile ca.pem
openssl pkcs12 -export -out client-ca.pfx -inkey client-key.pem -in client-cert.pem -CAfile cacert.pem
openssl pkcs12 -export -out client.pfx -inkey client-key.pem -in client-cert.pem

主要解决实际场景问题

asp.net https使用Cloudflare 签名证书

  1. 首先,到 Cloudflare 申请证书.
    证书申请

  2. 然后 下载/复制 pem格式证书到本地.

  1. 下载Windows平台最新编译的OpenSSL

  2. 执行OpenSSL命令

openssl pkcs12 -export -out Cloudflare.pfx -inkey key.pem -in certificate.pem -password pass:"123456"

openssl pkcs12 -export -out Cloudflare2.pfx -inkey key.pem -in certificate.pem -CAfile origin_ca_rsa_root.pem -password pass:"123456"
public static IHostBuilder CreateHostBuilder(string[] args) =>
    Host.CreateDefaultBuilder(args)
        .ConfigureWebHostDefaults(webBuilder =>
        {
            webBuilder.UseStartup<Startup>()
                .UseKestrel(options =>
                {
                    options.AddServerHeader = false;
                    options.ListenAnyIP(80);
                    options.ListenAnyIP(443, lopr =>
                    {
                        lopr.UseHttps(
                            new System.Security.Cryptography.X509Certificates.X509Certificate2(
                                "Cloudflare.pfx", "123456"));
                    });
                });


        });
本文来自投稿,不代表本站立场,如若转载,请注明出处:https://typecho.firshare.cn/archives/684.html
免责声明:文章内容不代表本站立场,本站不对其内容的真实性、完整性、准确性给予任何担保、暗示和承诺,仅供读者参考,文章版权归原作者所有。避免网络欺诈,本站不倡导任何交易行为。如您私自与本站转载自公开互联网中的资讯内容中提及到的个人或平台产生交易,则需自行承担后果。本站在注明来源的前提下推荐原文至此,仅作为优良公众、公开信息分享阅读,不进行商业发布、发表及从事营利性活动。如本文内容影响到您的合法权益(内容、图片等),请及时联系本站,我们会及时删除处理。
-- 展开阅读全文 --
多版本并发控制 MVCC
« 上一篇 09-14
SmartAssembly 各配置项说明(最全)
下一篇 » 09-14