尝试将证书(只是更新)更新到Tomcat服务器上的现有密钥库

我有一个.crt文件来更新运行Tomcat 5.5的服务器。 如果我运行:

keytool - import -alias tomcat -keystore tomcat.ks - trustcacerts -file website.net.crt 

我得到以下错误:

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

顺便说一句,密钥库文件的默认密码是changeit,我不知道为什么它不接受它

我们与我们的ssl.com证书有同样的问题,但那里的支持人员非常有帮助,并告诉我们基本上我们的服务器上有多个版本的Java,我们需要显式调用我们正在使用的版本的keytool应用程序避免冲突。 例如,在我们的服务器上:

代替

 keytool - import -alias tomcat -keystore tomcat.ks - trustcacerts -file website.net.crt 

我们会用

 /usr/local/jdk/keytool - import -alias tomcat -keystore tomcat.ks - trustcacerts -file website.net.crt 

我认为这是说你的密钥库已经搞乱了。 你可以用密钥库做任何事情,看看它是坏的吗?

您的密钥库不仅需要您自己的证书信息, 还需要将证书链接回证书颁发机构(CA)。 对我来说,我最终在我的密钥库中有四个条目,其中只有一个是我特有的。 我只是为我的GoDaddy证书做了这个; 这些是我input的命令:

 >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 

您可能需要首先获得您的密钥库。 Keytool可能会很痛苦。

看看http://portecle.sourceforge.net/看看是否有帮助&#x3002;

我认为你运行的是错误的keytool。 JDK自带的那个不使用那个类。 你有没有安装GNU CLASSPATH? 如果是的话,将其删除。 这不是Java,只是一个贫穷而非常偏袒的模仿。 然后重复使用原始密钥库。 任何由错误的keytool创build的东西都应该扔掉。