Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

keytool error: java.lang.Exception: Certificate reply and certificate in keystore are identical

Tags:

java

ssl

keytool

i want to sign my jar file with certificate. i have followed below steps. C:\Program Files\Java\jdk-10.0.2\bin>keytool -genkey -alias testals -keystore testks

C:\Program Files\Java\jdk-10.0.2\bin>keytool -export -keystore testks -alias testals -file testcer.cer

Certificate stored in file

C:\Program Files\Java\jdk-10.0.2\bin>keytool -import -alias testals -file testcer.cer -keystore testks

but while importing getting exception as Certificate reply and certificate in keystore are identical.

please help me how can do this?

like image 760
sai Avatar asked Oct 19 '25 14:10

sai


1 Answers

While importing use different alias name, don't use the alias name which used for exporting. It will work.

It's because you are importing the self signed certificate for root, not for the server certificate.

like image 174
Felix Andrew Avatar answered Oct 22 '25 03:10

Felix Andrew



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!