使用OpenSSL轉換X509 PEM與PFX證書

FrankYou發表於2017-09-25

PKCS(Public Key Cryptography Standards)

PKCS12:定義了包含私鑰與公鑰證書(public key certificate)的檔案格式。私鑰採密碼(password)保護。常見的PFX就履行了PKCS#12。

 

X509(PEM格式的)轉PFX格式:

openssl pkcs12 -export -inkey test.key -in test.cer -out test.pfx

注:test.key和test.cert都是PEM格式的私鑰和公鑰證書

  

PFX轉X509:

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

相關文章