Keytool says the alias exists and does not exist. How to start from scratch with a clean slate?
For a project I'm working on we need certificates for authentication. When I ran keytool.exe for the first time, I got this:
> keytool.exe -list
Your keystore contains 0 entries
However, I tried to import the certificates incorrectly:
keytool.exe -import -alias dev01 -file cacert1.crt -keystore C:\Dev\Resources\Java\JDK_7\jdk1.7.0_67\jre\lib\security\cacerts
Then when I ran the ad I got this:
> keytool.exe -list
Keystore type: JKS
Keystore provider: SUN
Your keystore contains 0 entries
So I thought, "Strange, I'll do it again." So I ran the command again, but keytool gave me this error:
keytool error: java.lang.Exception: Certificate not imported, alias <dev01> already exists
Then when I ran the ad I got this:
> keytool.exe -list
Keystore type: JKS
Keystore provider: SUN
Your keystore contains 0 entries
However, whenever I do a listing, the keytool always says that I have 0 entries. Then I discovered from a coworker that I actually need to execute the command:
keytool.exe -import -trustcacerts -file cacert1.crt -alias dev01 -keystore C:\Dev\Resources\Java\JDK_7\jdk1.7.0_67\jre\lib\security\cacerts
I tried to remove "JKS" and "SUN" but I can't figure out how to do it. At this point, all I want is to go back to a clean slate and start with the correct import command. How can i do this?
+3
source to share