使用openssl轉換pem為pfx證書


pem證書轉pfx證書分兩種,一種帶ca證書轉換,一種不帶ca證書轉換


1.pem轉pfx(不帶ca證書)

以test.pem轉test.pfx為例

1. openssl rsa -in test.pem -out test.key
2. openssl x509 -in test.pem -out test.crt
3. 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為例

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


如果ca證書為pem格式

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


ps(個人用):

1. openssl pkcs12 -export -out client.pfx -inkey client.key -in client.crt
2. openssl pkcs12 -export -out client-ca.pfx -inkey client.key -in client.crt -CAfile ca.crt


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM