crt key转p12, jks p12互转,windows生成jks,

crt key转p12, jks p12互转,windows生成jks,

摘自:https://blog.csdn.net/u010801696/article/details/86546191

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u010801696/article/details/86546191

crt转为p12证书

openssl pkcs12 -export -in client.crt -inkey client.key -out iot.p12 -name "iot" 

jks p12互转

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

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

windows生成jks

生成jks文件

keytool -genkeypair -alias icesslkey -keyalg RSA -validity 3650 -keystore icekeystore.jks

RSA是非对称密钥算法,可改为keytool其他算法,365代表证书的有效期10年

查看生成的jks文件信息

keytool -list -v -keystore icekeystore.jks

导出公钥证书

keytool -export -alias icesslkey -keystore icekeystore.jks -rfc -file icecert.cer

icecert.cer为导出的证书名字

将证书导入到truststore

keytool -import -v -trustcacerts -alias icesslkey -file icecert.cer -keystore icetruststore.ts

原文地址:https://www.cnblogs.com/LiuYanYGZ/p/10439652.html