I am trying to automate keystore generation using the Java keystore tool. The command I am using is :
keytool -keystore keystore -alias jetty -genkey -keyalg
See the full documentation about command line or by typing keytool
without any arguments.
Specifically you may want to look options -storepass password -keypass password
don't forget -noprompt, otherwise you will be asked to input Yes or No
Try this:
keytool -genkey -noprompt \
-alias alias1 \
-dname "CN=mqttserver.ibm.com, OU=ID, O=IBM, L=Hursley, S=Hants, C=GB" \
-keystore keystore \
-storepass password \
-keypass password