ITPub博客

首页 > IT基础架构 > 网络安全 > SSL证书格式及转化方法

SSL证书格式及转化方法

原创 网络安全 作者:RacentYY 时间:2022-01-14 14:25:25 0 删除 编辑

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

常见的 SSL证书格式

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

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

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

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

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

SSL证书格式转化方法

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

方法一:使用 OpenSSL、Keytool转化

1.pem转换p fx

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

2 . pem 转换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

3. pfx 转换 pem

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

4. pfx 转换jks

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

5 . jks 转换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  

6. jks 转化pfx

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

 

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

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

 

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

锐成信息为您提供各种SSL证书服务,有需要可联系:021-55669186

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69998338/viewspace-2852272/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
埋头搬砖,只为提高互联网安全意识

注册时间:2021-04-14

  • 博文量
    70
  • 访问量
    40894