将密钥库密码从无密码更改为非空白密码 [英] Change keystore password from no password to a non blank password
问题描述
我有一个jks密钥库,没有密码.当我运行命令
I have a jks keystore with no password. When I run the command
keytool -list -keystore mykeystore.jks
它提示我输入密钥库密码,我只需按"enter"(输入).
And it prompts me for the keystore password, I simply hit 'enter'.
请注意,密钥库密码不是默认的Java密码"changeit".它是空白的
Please note that the keystore password IS NOT the default java password of 'changeit'. It is blank
当我尝试跑步时
keytool -storepasswd -keystore mykeystore.jks
将密码更改为非空白字符串.它首先提示我输入当前密码.只需按Enter键即可,因为它为空
to change the password to a non blank string. It firsts prompts me for the current password. Simply hitting enter since it is blank says
keytool -storepasswd -keystore mykeystore.jks
Enter keystore password:
Keystore password is too short - must be at least 6 characters
只需要与所有人确认密码不是'changeit'
Just to confirm with everyone that the password is not 'changeit'
keytool -storepasswd -keystore mykeystore.jks
Enter keystore password: changeit
keytool error: java.io.IOException: Keystore was tampered with, or password was incorrect
您知道在现有密码为空的情况下如何更改密钥库密码吗?
Any idea how I can change the keystore password if the existing password is blank?
推荐答案
在keytool参数中添加-storepass.
Add -storepass to keytool arguments.
keytool -storepasswd -storepass '' -keystore mykeystore.jks
但还要注意,-list命令并不总是需要密码.在两种情况下,我都可以执行follow命令:不使用密码或使用有效密码
But also notice that -list command does not always require a password. I could execute follow command in both cases: without password or with valid password
$JAVA_HOME/bin/keytool -list -keystore $JAVA_HOME/jre/lib/security/cacerts
这篇关于将密钥库密码从无密码更改为非空白密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!