When I'm using:
"C:\Program Files\Java\jdk1.8.0_151\bin\keytool.exe" -genkey
-v -keystore my.keystore -keyalg RSA -keysize 2048 -validity 10000 -alias app
then an interactive process begins which asks name, password, etc.
Is there a way to have a non-interactive generation of keys, where parameters are directly in the command line parameters?
Use the standard JDK keytool utility to generate and load a new key and a self-signed certificate. When prompted, supply the certificate and password information. Doing so protects the keystore file and the keys within in the file.
Use the -exportcert command to read a certificate from the keystore that is associated with -alias alias and store it in the -file file. When a file is not specified, the certificate is output to stdout . By default, the certificate is output in binary encoding.
This works:
keytool -genkey -keystore my.keystore -keyalg RSA -keysize 2048 \
-validity 10000 -alias app -dname "cn=Unknown, ou=Unknown, o=Unknown, c=Unknown" \
-storepass abcdef12 -keypass abcdef12
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With