How to automate Keystore generation using the java keystore tool? w/o user interaction
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