keytool 工具常用证书转换

青苗 青苗 | 241 | 2022-10-20

keytool 工具常用证书转换

kisso = cookie sso 基于 Cookie 的 SSO 中间件,它是一把快速开发 java Web 登录系统(SSO)的瑞士军刀。

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 转 cer

keytool -alias jwtkey -exportcert -keystore trust.jks -file public.cer -storepass 123456

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

文章标签: Java
推荐指数:

真诚点赞 诚不我欺~

keytool 工具常用证书转换

点赞 收藏 评论

关于作者

青苗
青苗

青苗幼儿园园长

等级 LV4

粉丝 15

获赞 39

经验 931