Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

keytool -genkey error: Keystore file does not exist

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?

like image 906
Chris Friedl Avatar asked Feb 07 '11 10:02

Chris Friedl


1 Answers

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
like image 132
OrangeDog Avatar answered Sep 20 '22 12:09

OrangeDog