CER/CRT轉(zhuǎn)換為PEM
這兩種格式的證書可通過直接修改證書文件擴展名的方式轉(zhuǎn)換,如將”server.crt”直接重命名為”server.pem”即可
PFX轉(zhuǎn)換為PEM
PFX格式一般出現(xiàn)在windows server中,可通過openssl命令轉(zhuǎn)換。
提取私鑰: openssl pkcs12 -in certname.pfx -nocerts -out key.pem -nodes
提取證書:openssl pkcs12 -in certname.pfx -nokeys -out cert.pem
P7B轉(zhuǎn)換為PEM
P7B格式一般出現(xiàn)在windows server和tomcat中,可通過openssl命令轉(zhuǎn)換。
證書轉(zhuǎn)化:openssl pkcs7 -print_certs -in incertificat.p7b -out outcertificate.cer
獲取outcertificat.cer里面[—–BEGIN CERTIFICATE—–, —–END CERTIFICATE—–]的內(nèi)容,保存為pem格式作為證書上傳。
私鑰轉(zhuǎn)化:無私鑰
DER轉(zhuǎn)換為PEM
DER格式一般出現(xiàn)在java平臺中。
證書轉(zhuǎn)化:openssl x509 -inform der -in certificate.cer -out certificate.pem
私鑰轉(zhuǎn)化:openssl rsa -inform DER -outform PEM -in privatekey.der -out privatekey.pem
轉(zhuǎn)換后的證書文件(*.pem)應(yīng)類似使用notepad++等文本編輯器打開。