I have a .crt file to update the server thats running Tomcat 5.5. If I run:

keytool - import -alias tomcat -keystore tomcat.ks - trustcacerts -file website.net.crt I get the following error:

keytool error: gnu.javax.crypto.keyring.MalformedKeyringException: incorrect magic

Please advise

BTW, the default password for the keystore file is changeit and I am not sure why its not accepting it

link|improve this question
Check out: serverfault.com/questions/144831/… – Warner Jul 19 '10 at 18:37
feedback

2 Answers

I think it's saying that your keystore is messed up. Can you do anything with the keystore to see if it's bad?

link|improve this answer
I tried importing the root certificate and new certificate to a new local keystore by running: keytool -import -alias root -keystore tomcat.ks -trustcacerts -file gd_intermediate.crt and keytool -import -alias tomcat -keystore tomcat.keystore -trustcacerts -file website.net.crt I shutdown and startup the tomcat server and the site to https:// can't be displayed. so I have to restore to the old keystore file to get it up and running again but it needs to renewed for SSL. Please advise – Steve Jul 19 '10 at 18:31
The logs say SEVERE: Catalina.start: LifecycleException: service.getName(): "Catalina"; Protocol handler start failed: java.io.IOException: Invalid keystore format at org.apache.catalina.connector.Connector.start(Connector.java:1097) – Steve Jul 19 '10 at 18:36
feedback

Your keystore needs to have more than just your own certificate info; it also needs to have the certs chaining back to your Certificate Authority (CA). For mine, I end up with four entries in my keystore, only one of which is specific to me. I just did this for my GoDaddy certificate; these are the commands I entered:

>keytool -import -alias root -keystore tomcat.sat.keystore -tr ustcacerts -file valicert_class2_root.crt 

Enter keystore password: PASSWORD 

Certificate already exists in system-wide CA keystore under alias <valicertclass2ca> Do you still want to add it to your own keystore? [no]: yes 

Certificate was added to keystore 

>keytool -import -alias cross -keystore tomcat.sat.keystore -trustcacerts -file gd_cross_intermediate.crt 

Enter keystore password: PASSWORD 

Certificate was added to keystore 

>keytool -import -alias intermed -keystore tomcat.sat.keystore -trustcacerts -file gd_intermediate.crt 

Enter keystore password: PASSWORD 

Certificate was added to keystore  

>keytool -import -alias tomcat -keystore tomcat.sat.keystore -trustcacerts -file loxpress.com.crt 

Enter keystore password: PASSWORD

Certificate reply was installed in keystore  
link|improve this answer
feedback

Your Answer

 
or
required, but never shown