手机端下拉列表
400-002-9968

博客 > SSL证书格式及转化方法

SSL证书格式及转化方法

  • 标签:
  • SSL证书
  • SSL证书格式
  • SSL证书格式转化

浏览量:3625次评论:0次

作者:Nick时间:2022-01-14 11:04:46

SSL证书格式主要有公钥证书格式标准X.509中定义的PEM和DER、公钥密码标准PKCS中定义的PKCS#7和PKCS#12、Tomcat专用的JKS。常见的SSL证书格式及转化方法如下:

常见的SSL证书格式

DERDistinguished Encoding Rules的缩写,二进制编码的证书格式,相当于PEM格式的二进制版本,证书后缀有: .DER .CER .CRT,主要用于Java平台

PEM: Privacy Enhanced Mail的缩写,Base64编码的证书格式,是将二进制版本Base64编码后,以”—–BEGIN…”开头, “—–END…”结尾。证书后缀有: .PEM .CER .CRT,主要用于ApacheNginx

PKCS#7: PKCSPublic-Key Cryptography Standards)标准中的PKCS#7Cryptographic Message Syntax Standard)。它不包含私钥,并将证书链和用户证书单独存放。证书后缀有: .P7B .P7C .SPC,主要用于TomcatWindows Server

PKCS#12PKCSPublic-Key Cryptography Standards)标准中的PKCS#12Personal Information Exchange Syntax Standard)。它包含私钥,证书链,用户证书,并设置了密码。证书后缀有:  .P12 .PFX,主要用于Windows Server

JKS: JavaKeyStore的缩写,它包含私钥,证书链,用户证书,并设置了密码。证书后缀是.jks。主要用于Tomcat

SSL证书格式转化方法

WebTrust认证的CA机构签发的证书通常只提供PEM格式或PKCS#7格式,如需其他证书格式,可以在下面常用的两种方法中任选其一进行格式转化。

方法一:使用OpenSSLKeytool转化

1pem转换pfx

openssl pkcs12 -export -in 'test.pem' -inkey 'test.key' -out 'test.p12' -passout pass:123456

2pem转换jks

openssl pkcs12 -export -in 'test.pem' -inkey 'test.key' -out 'test.p12' -passout pass:123456
keytool -importkeystore -srckeystore 'test.p12' -srcstoretype PKCS12 -destkeystore 'test.jks' -srcstorepass 123456 -deststorepass 123456

3pfx转换pem

openssl pkcs12 -in test.p12 -passin pass:123456 -out test3.pem -nodes

4pfx转换jks

keytool -importkeystore -srckeystore 'test.p12' -srcstoretype PKCS12 -destkeystore 'test.jks' -srcstorepass 123456 -deststorepass 123456

5jks转换pem   

keytool -importkeystore -srckeystore 'test.jks' -srcstoretype jks -destkeystore 'test.p12' -deststoretype PKCS12 -srcstorepass 123456  -deststorepass 123456
openssl pkcs12 -in test.p12 -passin pass:123456 -out test3.pem -nodes

6jks转化pfx

keytool -importkeystore -srckeystore 'test.jks' -srcstoretype jks -destkeystore 'test.p12' -deststoretype PKCS12 -srcstorepass 123456  -deststorepass 123456

方法二:SSL证书格式转化工具

对于非专业人士,方法一显得有点复杂。在线SSL证书转化工具只需要按要求提示上传相关证书文件,选择目标格式后即可完成转换,较为简单。如下图:


不同服务器类型支持的SSL证书格式不同,请根据自己的服务器选择对应的证书格式即可安装SSL证书。

我的评论

还未登录?点击登录

微信扫码沟通
微信扫码沟通

微信扫码沟通

售前咨询
合作
售后
return head