I am trying to delete already import certificate by keytool command
keytool -delete -noprompt -alias "initcert" -keystore keycloak.jks
But getting below exception
keytool error: java.lang.Exception: Keystore file does not exist: keycloak.jks
Same issue with
keytool -delete -alias "initcert" -keystore keycloak.cer
issue
keytool error: java.lang.Exception: Keystore file does not exist: keycloak.cer
Now i am trying to import the certificate with same alias name
keytool -import -noprompt -trustcacerts -alias "initcert" -file "C:\Code_Base\keycloak_certificates\keycloak_135.250.138.74_server\keycloak.cer" -keystore "C:\Program Files\Java\jdk1.8.0_152\jre\lib\security\cacerts"
But again end with
keytool error: java.lang.Exception: Certificate not imported, alias already exists
You can make use of KeyStore Explorer to check if exists and manage your certs easily,
KeyStore Explorer Download Link
Just open your keystore file with the explorer, do the stuff you want and save it back.