keytool -genkey error: Keystore file does not exist
85,125
Solution 1
Generating a key pair (and a new keystore) has to be done as a separate operation to creating a self-signed certificate for that key.
i.e.
keytool -genkey -alias myKey -keystore store.jks
keytool -selfcert -alias myKey -keystore store.jks
Solution 2
Run command prompt as Administrator and it will be done.
Solution 3
First generate the upload key using below command:
keytool -genkeypair -v -keystore my-upload-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000
then run
keytool -exportcert -keystore path-to-debug-or-production-keystore -list -v
![Admin](/assets/logo_square_200-5d0d61d6853298bd2a4fe063103715b4daf2819fc21225efa21dfb93e61952ea.png)
Author by
Admin
Updated on October 22, 2020Comments
-
Admin over 3 years
I try to create a new self certified keystore file
The command I use is:
keytool -genkey -selfcert -dname "cn=My Name, ou=Orga unit" -alias selfcertified -keypass somepass -keystore keystore.jks -storepass anotherpass -validity 365
but I always get this annoying error:
keytool error: java.lang.Exception: Keystore file does not exist: keystore.jks
I do not understand why I'm getting this error. The command above should create a new keystore, so why is it complaining about a non existing store?
-
Admin over 13 yearsfrom the keytool online documentation: A keystore is created whenever you use a -genkey, -import, or -identitydb command to add data to a keystore that doesn't yet exist. (download.oracle.com/javase/1.4.2/docs/tooldocs/solaris/…). according to this, the keytool command should create a new keystore instead of saying it does not exist. could you plz give an example of how to perform these two steps you mentioned?
-
OrangeDog over 13 years@Chris Friedl -
-genkey
and-selfcert
are separate commands: you can't do both at once. -
Admin over 13 yearsthanks! - two separate commands did it finally. the funny thing is, there are several sites providing tutorials with the two commands in one line as i have written above.
-
Mann almost 12 yearsIt says store file not found? what is store.jks here?