keytool -help
生成密钥对
keytool -genkey -help
-keyalg:密钥算法名称
-alias:条目的别名
-keystore:密钥库名称
-dname
-storepass:密钥库口令
-validity:有效天数
-keysize:密钥位大小
-keypass:密钥口令
keytool -genkey -keyalg RSA -alias miyao -keystore lihao.jks -dname “CN=db, OU=IT, O=My Company, L=Birmingham, ST=West Midlands, C=GB” -storepass AAbb1234 -validity 3600 -keysize 2048 -keypass AAbb1234
生成自签名证书
keytool -selfcert -help
-v:详细输出
-alias:别名
-keypass:密钥口令
-keystore:密钥库名称
-storepass:密钥库口令
-storetype:密钥库类型
-validity:有效天数
keytool -selfcert -v -alias miyao -keypass AAbb1234 -keystore lihao.jks -storepass AAbb1234 -storetype jks -validity 3600
导出证书
keytool -export help
-file:输出文件名
-keystore:密钥库名称
-storepass:密钥库口令
keytool -export -v -alias miyao -file “db-rootCA.der” -keystore lihao.jks -storepass AAbb1234
导入证书或证书链
keytool -import help
-trustcacerts:信任来自 cacerts 的证书
-keystore:
keytool -import -v -trustcacerts -alias miyao -file “db-rootCA.der” -keystore trust.jks -storepass AAbb1234 -noprompt
关闭在开启
KeyStores=CustomIdentityAndCustomTrust
CustomIdentityKeystoreType=jks
CustomIdentityKeyStoreFileName=C:\Program Files\Java\jdk1.8.0_201\bin\lihao.jks
CustomIdentityKeyStorePassPhrase=AAbb1234
CustomIdentityPrivateKeyPassPhrase=AAbb1234
CustomIdentityAlias=miyao
CustomTrustKeystoreType=jks
CustomTrustKeyStoreFileName=C:\Program Files\Java\jdk1.8.0_201\bin\trust.jks
CustomTrustKeyStorePassPhrase=AAbb1234
都关闭在打开
05-28
12-25
8961
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)