I am new to SSL.
I am trying to create keystore for SSL connection using keytool. First I tried the following command
[aniket@localhost bin]$ keytool -genkey -alias myKeyStore -keyalg RSA -keystore
/home/aniket/keystore
It asked me password and other details and finally gave me following error
keytool error: java.io.FileNotFoundException: /home/aniket/keystore
(Is a directory)
So I created a file keystoreFile.txt inside keystore folder and executed
[aniket@localhost bin]$ keytool -genkey -alias myKeyStore -keyalg RSA -keystore
/home/aniket/keystore/keystoreFile.txt
and now(no prompt for password etc) I am getting
keytool error: java.lang.Exception: Keystore file exists, but is empty:
/home/aniket/keystore/keystoreFile.tx
What should be the contents of the file. I though keytool will generate key pair (a public key and associated private
Delete the empty keystoreFile.txt, then run your 2nd command again
[aniket@localhost bin]$ keytool -genkey -alias myKeyStore -keyalg RSA -keystore
/home/aniket/keystore/keystoreFile.txt
It's trying to create the file you specify with the -keystore
flag. The reason your first one command failed is that you gave it an existing directory name.