Java – keytool – genkey error: keystore file does not exist
•
Java
I try to create a new self certified keystore file
The commands I use are:
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 mistake:
keytool error: java.lang.Exception: Keystore file does not exist: keystore.jks
I don't understand why I got this mistake The above command should create a new keystore, so why does it complain about a non existing store?
Solution
Generating a key pair (and a new keystore) must create a self - signed certificate for the key as a separate operation
Namely
keytool -genkey -alias myKey -keystore store.jks keytool -selfcert -alias myKey -keystore store.jks
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码