keytool error: java.lang.Exception: Keystore file exists, but is empty
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.
Aniket Thakur
Hi there, I love to code and learn new things! I firmly believe that "It is your attitude rather than your aptitude that determines your altitude" and "Nothing is impossible if you give it your sincere try". My Blog - Open Source For Geeks You can also view - My Playstore Apps and My Git repositories / Gists Youtube channel Chrome Plugin All the Best! Stay in touch :) (LinkedIn Profile)
Updated on June 14, 2021Comments
-
Aniket Thakur almost 3 years
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