常用数字证书格式相互转换-OpenSSL/Keytool/Jks2pfx

常用数字证书格式相互转换-OpenSSL/Keytool/Jks2pfx

1: pfx转换cer,crt,key

导出私钥必须输入密码

  1. openssl pkcs12 -in test.wosign.pfx -nodes -out test.pem

去除pem证书密码,转换成rsa格式,如果使用DSA格式,只需将rsa替换成dsa

  1. openssl rsa -in test.pem -out test.key
  2. openssl x509 -in test.pem -out test.crtcer

2: key和cer转换为pfx

  1. openssl pkcs12 -export -in client1.crt -inkey client1.key -out client1.pfx

3: .jks转为.pfx

  1. JKS2PFX server.jks 123456 tomcat exportfile c:\progra~1\Java\jre1.5.0_06\bin (转换后文件存放在相应目录下。)

4: .pfx转换.jks

  1. Keytool -importkeystore -srckeystore aaa.pfx -destkeystore 173.jks -srcstoretype PKCS12 -deststoretype JKS

5: 创建PFX格式证书(pkcs12 )

  1. openssl pkcs12 -export -in my.cer -inkey my.key -out mycert.pfx

6: 证书编码格式转换

  1. #PEM to DER
  2. openssl x509 -in cert.crt -outform der -out cert.der
  3. #DER to PEM
  4. openssl x509 -in cert.crt -inform der -outform pem -out cert.pem

 

posted on 2017-09-20 15:33  法海降妖  阅读(1527)  评论(0)    收藏  举报