I am trying to generate a private key using keytool
command, but it asks me for many details like my key passphrase, my name and my organization details. I want to pass all the inputs in one command.
For an instance:
###SHELL###
$ keytool -genkey -v -keystore TestApp.keystore -alias TestApp -keyalg RSA -keysize 2048 -validity 10000
Enter passphrase: my passphrase here
Repeat the passphrase: my passphrase again
Enter your full name: my name
Enter your organization unit: my org. unit
Enter your organization name: my org. name
Enter password for keystore (press return for same as key passphrase): i press enter here
Success!!
$ _
Here, I want to pipe all these inputs (passphrase, name, etc.) into the STDIN,, so that I shouldn't be asked for these inputs after entering the command.
Is this possible? If yes then please tell how. I am new to Bash scripting so please bear with me :)
(echo
"correct horse battery stable"
; echo "correct horse battery stable"; echo "Ashish"; echo "Super User"; echo "Stack Exchange"; echo) | keytool -genkey -v -keystore TestApp.keystore -alias TestApp -keyalg RSA -keysize 2048 -validity 10000
?