使用keytool工具常用证书转换

使用keytool工具常用证书转换

p12 转 jks
keytool -importkeystore -srckeystore keystore.p12 -srcstoretype PKCS12 -deststoretype JKS -destkeystore keystore.jks

jks 转 p12
keytool -importkeystore -srckeystore keystore.jks -srcstoretype JKS -deststoretype PKCS12 -destkeystore keystore.p12

jks导出crt证书
keytool -export -alias test -keystore trust.jks -storepass 123456 -file test.cer

crt证书导入jks
keytool -import -v -alias test -file test.cer -keystore trust.jks -storepass 123456 -noprompt 

去除pem格式的key的密码(输出的密码不输入即可)
openssl rsa -in crt1.key -out crt2.key

合并pem格式输出pfx(p12)
openssl pkcs12 -export -inkey test.key -in cert2.crt -out test.pfx

指定intermedian和CA
openssl pkcs12 -export -out mypkcs12.pfx -inkey my.private.key -in mycert.crt -certfile intermediate.crt -CAfile ca.crt 

pfx 转 pem
openssl pkcs12 -in test.pfx -out test.pem -nodes

pem 转 key
openssl rsa -in test.pem -out test.key

pem 转 crt
openssl x509 -in test.pem -out test.crt

cert 转 pem
openssl x509 -in test.cer -out test.pem -outform PEM

pem 转 der
openssl x509 -in test.pem -inform PEM -out test.der -outform DER

der 转 pem
openssl x509 -in test.cer -inform DER -out test.pem -outform PEM

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值