JavaKeytool命令使用是怎样的-创新互联

Java Keytool 命令使用是怎样的,相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。

公司专注于为企业提供网站制作、成都网站设计、微信公众号开发、商城网站制作成都小程序开发,软件定制网站设计等一站式互联网企业服务。凭借多年丰富的经验,我们会仔细了解各客户的需求而做出多方面的分析、设计、整合,为客户设计出具风格及创意性的商业解决方案,成都创新互联更提供一系列网站制作和网站推广的服务。

Java Keytool 命令使用

如果没有Keytool工具,请先安装jre/jdk(如何安装这里不做详细介绍)

生成私钥

keytool -genkey -alias getssl -keyalg RSA -keystore www.getssl.cn.jks -keysize 2048

生成CSR

keytool -certreq -alias getssl -keystore www.getssl.cn.jks -file getssl.csr

导入根证书或者中级证书

keytool -import -trustcacerts -alias root -file GeoTrust.crt -keystore www.getssl.cn.jks

导入CA签发的证书

keytool -import -trustcacerts -alias getssl -file www.getssl.cn.crt -keystore www.getssl.cn.jks

生成自签名证书(可选,不想购买证书可以使用此项,浏览器不能信任)

keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass password -validity 360 -keysize 2048

根据Alias名字查询导入的证书

keytool -list -v -keystore keystore.jks -alias getssl

根据Alias名字删除导入的证书

keytool -delete -alias getssl -keystore keystore.jks

修改Keystore文件密码

keytool -storepasswd -new 新密码 -keystore keystore.jks
keytool -keypasswd -alias 1 -new 新密码 -keystore keystore.jks

根据Alias名字导出证书

keytool -export -alias getssl -file myssl.crt -keystore keystore.jks

导出私钥

keytool -importkeystore -srckeystore www.getssl.cn.jks -destkeystore keystore.p12 -deststoretype PKCS12
openssl pkcs12 -in keystore.p12  -nodes -nocerts -out mydomain.key

显示CA信任证书

keytool -list -v -keystore $JAVA_HOME/jre/lib/security/cacerts

导入一个CA证书到JAVA 信任列表

keytool -import -trustcacerts -file /path/to/ca/ca.pem -alias mydomain -keystore $JAVA_HOME/jre/lib/security/cacerts

证书格式转换

PFX 转成 JKS

keytool -importkeystore -srckeystore mypfxfile.pfx -srcstoretype pkcs12 -destkeystore newjkskeystore.jks -deststoretype JKS

JKS转成PFX

keytool -importkeystore -srckeystore myjksfile.jks -srcstoretype JKS -deststoretype PKCS12 -destkeystore newpfxkeystore.pfx

看完上述内容,你们掌握Java Keytool 命令使用是怎样的的方法了吗?如果还想学到更多技能或想了解更多相关内容,欢迎关注创新互联-成都网站建设公司行业资讯频道,感谢各位的阅读!


本文题目:JavaKeytool命令使用是怎样的-创新互联
转载源于:http://myzitong.com/article/djjhih.html