crt转为p12证书算法
openssl pkcs12 -export -in client.crt -inkey client.key -out iot.p12 -name "iot" ssl
jks p12互转openssl
keytool -importkeystore -srckeystore iot.p12 -srcstoretype PKCS12 -deststoretype JKS -destkeystore iot.jksit
keytool -importkeystore -srckeystore iot.jks -srcstoretype JKS -deststoretype PKCS12 -destkeystore iot.p12io
生成jks文件class
keytool -genkeypair -alias icesslkey -keyalg RSA -validity 3650 -keystore icekeystore.jksimport
RSA是非对称密钥算法,可改成keytool其余算法,365表明证书的有效期10年 cli
查看生成的jks文件信息file
keytool -list -v -keystore icekeystore.jksrust
导出公钥证书
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