在.net中使用时,pfx格式用得更多,但但let's encrypt下发的格式是cer的,转换方式如下:

# cer 转 pfx
openssl pkcs12 -export -out fullchain.pfx -inkey private.key -in fullchain.cer

# p7b 转 crt
openssl pkcs7 -print_certs -in fullchain.p7b -out fullchain.crt

# 分解命令:
pkcs12 # OpenSSL中PKCS#12文件的文件实用程序
-export -out fullchain.pfx  # 导出并保存
-inkey private.key # 使用私钥文件作为与证书结合的私钥
-in fullchain.cer # fullchain.cer作为将与私钥组合的证书
-certfile more.cer # 可选,如果要在PFX文件中包含任何其他证书

# help
https://www.ssl.com/how-to/create-a-pfx-p12-certificate-file-using-openssl/

参考地址: https://www.netnr.com/gist/code/5655561838775774270

posted on 2023-02-04 14:04  天方  阅读(317)  评论(0编辑  收藏  举报