keytool错误密钥库被篡改,或密码不正确 [英] keytool error Keystore was tampered with, or password was incorrect
问题描述
我在本地计算机上生成证书时遇到以下错误。
I am getting following error while generating certificates on my local machine.
C:\Users\abc>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
因为您没有指定一个显式的密钥库,它将尝试生成(在您的情况下,因为您要获得异常以便更新)keystore C:\ usersrs \abc> .keyst ore
当然,您需要为.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:\users\abc>.keystore
and of course you need to provide old password for .keystore while I believe you are providing your version (a new one).
解决方案
-
从以下位置删除
.keystore
C:\users\abc>
位置并尝试命令
或尝试执行以下命令将创建一个新的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 works equally.
这篇关于keytool错误密钥库被篡改,或密码不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!