openssl和Java的keytool证书相关的命令总结

时间:2022-11-29 12:26:12

Java的keytool

keytool -genkey -alias myserver -keyalg RSA -keysize  -keystore oauth-server.keystore -validity
keytool -export -alias myserver -file myserver.cer -keystore myserver.keystore
keytool -import -file myserver.cer -keystore myserver.truststore -alias myserver -noprompt keytool -list -v -keystore myserver.keystore -storepass
keytool -printcert -file myserver.cer

openssl

openssl genrsa -des3 -out test.key
openssl rsa -in test.key -out test_nopass.key
openssl req -new -key test.key -out test.csr
openssl x509 -req -days -in test.csr -signkey test.key -out test.crt

java的keytool导入openssl的证书

keytool -import -file test.crt -keystore app.truststore -alias oauth_server -noprompt