常用的Java Keytool Keystore命令
keytool -list -v -keystore keystore.jks
Thanks To
一. Keytool创建和导入命令
创建keystore和密钥对
Generate a Java keystore and key pair
keytool -genkey -alias mydomain -keyalg RSA -keystore keystore.jks -keysize 2048
为存在的keystore生成证书请求文件CSR
Generate a certificate signing request (CSR) for an existing Java keystore
keytool -certreq -alias mydomain -keystore keystore.jks -file mydomain.csr
导入根证书或中级证书到keystore
Import a root or intermediate CA certificate to an existing Java keystore
keytool -import -trustcacerts -alias root -file mydomain.crt -keystore keystore.jks
导入SSL服务器证书到keystore
Import a signed primary certificate to an existing Java keystore
keytool -import -trustcacerts -alias mydomain -file mydomain.crt -keystore keystore.jks
为存在的keystore生成自签名证书
Generate a keystore and self-signed certificate
keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass password -validity 360 -keysize 2048
二. Keytool查看命令
查看单个证书
Check a stand-alone certificate
keytool -printcert -v -file mydomain.crt
列出keystore存在的所有证书
Check which certificates are in a Java keystore
keytool -list -v -keystore keystore.jks
使用别名查看keystore特定条目
Check a particular keystore entry using an alias
keytool -list -v -keystore keystore.jks -alias mydomain
三. 其他Keytool命令
删除keystore里面指定证书
Delete a certificate from a Java Keytool keystore
keytool -delete -alias mydomain -keystore keystore.jks
更改keysore密码
Change a Java keystore password
keytool -storepasswd -new new_storepass -keystore keystore.jks
导出keystore里面的指定证书
Export a certificate from a keystore
keytool -export -alias mydomain -file mydomain.crt -keystore keystore.jks
列出信任的CA证书
List Trusted CA Certs
keytool -list -v -keystore $JAVA_HOME/jre/lib/security/cacerts
导入新的CA到信任证书
Import New CA into Trusted Certs
keytool -import -trustcacerts -file /path/to/ca/ca.pem -alias CA_ALIAS -keystore $JAVA_HOME/jre/lib/security/cacerts
No comments:
Post a Comment