keytool : Certificate import gives error message - Keystore was tampered with, or password was incorrect
I have got this sorted out. I was using my password that is 'password' to update cacerts keystore in JDK while default password for cacerts keystore is 'changeit'
Comments
-
Kalher almost 4 years
My goal is to generate a certificate, export it in a file and import in JDK keystore.
In first step I have generated a self signed certificate using following command, providing password as 'password' for keystore and key:
keytool -genkeypair -keystore .keystore -alias uasera -keyalg RSA
In second step I exported the certificate using similar password and following command:
keytool -exportcert -keystore .keystore -alias usera -file usera.crt
NOW!
I am trying to import this certificate in cacerts in JDK using similar password and following command but getting exception.
keytool -importcert -file usera.crt -keypass password -keystore "C:\Program Files\Java\jdk1.7.0_13\jre\lib\security\cacerts"
ERROR
K:\java\certificates>keytool -importcert -file usera.crt -keypass password -keystore "C:\Program Files\Java\jdk1.7.0_13\jre\lib\security\cacerts" Enter keystore password: keytool error: java.io.IOException: Keystore was tampered with, or password was incorrect
-
L-Samuels about 10 yearsThanks I was just about to post my related question when i stumbled upon this. With me the inverse was happening, I was using 'changeit' when i should have been using 'password'
-
code_dredd about 6 yearsAs an added note, if you're trying to use the
cacerts
keystore, you should use the-cacerts
argument instead of-keystore <path>
to handle it. -
Edijae Crusar about 5 yearsI never knew the default password is
changeit