keytool 错误 Keystore 被篡改,或密码不正确 [英] keytool error Keystore was tampered with, or password was incorrect
问题描述
我在本地机器上生成证书时遇到以下错误.
I am getting following error while generating certificates on my local machine.
C:Usersabc>keytool -genkey -alias tomcat -keyalg RSA
Enter keystore password:
keytool error: java.io.IOException: Keystore was tampered with, or password was incorrect
我认为 jdk 版本存在一些问题.我在我同事的机器上运行了相同的命令,它运行良好.
I think there is some problems in jdk version.I ran the same command on my collegues machine and it is working fine.
请分享您的意见.
推荐答案
根据你的描述,我假设你在 windows 机器上,你的家是 abc
From your description I assume you are on windows machine and your home is abc
现在:原因
当你运行这个命令时
keytool -genkey -alias tomcat -keyalg RSA
因为你没有指定一个显式的密钥库,它会尝试生成(在你的情况下,当你得到异常更新时)密钥库 C:usersabc>.keystore
当然您需要为 .keystore 提供旧密码,而我相信您提供的是您的版本(新密码).
because you are not specifying an explicit keystore it will try to generate (and in your case as you are getting exception so to update) keystore C:usersabc>.keystore
and of course you need to provide old password for .keystore while I believe you are providing your version (a new one).
解决方案
或者从
C:usersabc>
位置删除.keystore
并尝试命令
Either delete
.keystore
fromC:usersabc>
location and try the command
或者尝试以下命令来创建一个新的 xyzkeystore:
or try following command which will create a new xyzkeystore:
keytool -genkey -keystore xyzkeystore -alias tomcat -keyalg RSA
注意: -genkey
现在已经过时了,而是使用 -genkeypair
虽然两者都一样工作.
Note: -genkey
is old now rather use -genkeypair
althought both work equally.
这篇关于keytool 错误 Keystore 被篡改,或密码不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!