126

I'm trying to import a trusted certificated into the Java cacerts keystore, but I have a problem. I tried to list existing trusted certificates and it seems that the keystore isn't password protected.

$ keytool -list -keystore cacerts
Enter keystore password:

*****************  WARNING WARNING WARNING  *****************
* The integrity of the information stored in your keystore  *
* has NOT been verified!  In order to verify its integrity, *
* you must provide your keystore password.                  *
*****************  WARNING WARNING WARNING  *****************

Keystore type: JKS
Keystore provider: SUN

Your keystore contains 76 entries

I tried to import a trusted certificate:

$ keytool -importcert -alias "JiraCert" -file /root/c9ssl.crt -keystore /etc/java-6-sun/security/cacerts
Enter keystore password:  
Keystore password is too short - must be at least 6 characters
Enter keystore password:  
Keystore password is too short - must be at least 6 characters
Enter keystore password:  
Keystore password is too short - must be at least 6 characters
Too many failures - try later

I also tried to change the password from "none" to something:

$ keytool -storepasswd -keystore cacerts.back
Enter keystore password:
Keystore password is too short - must be at least 6 characters
Enter keystore password:
Keystore password is too short - must be at least 6 characters
Enter keystore password:
Keystore password is too short - must be at least 6 characters
Too many failures - try later
4

5 回答 5

210

这意味着 cacerts 密钥库不受密码保护

这是一个错误的假设。如果您仔细阅读,您会发现该列表是在没有验证密钥库完整性的情况下提供的,因为您没有提供密码。该清单不需要密码,但您的密钥库肯定有密码,如下所示:

为了验证其完整性,您必须提供您的密钥库密码。

Java 的默认 cacerts 密码是“changeit”,除非你在 Mac 上,在某个点上它是“changeme”。显然,从 Mountain Lion 开始(基于此处的评论和另一个答案),Mac 的密码现在也是“changeit”,可能是因为 Oracle 现在也在处理 Mac JVM 的分发。

于 2011-12-27T01:37:23.723 回答
57

keystore 的密码默认为:“changeit”。我按照您在此处输入的命令执行了证书导入。我希望你已经解决了你的问题。

于 2013-08-22T18:11:25.593 回答
7

如果处理 android 的 Google 登录,调试密钥库的密码是android,如下所示:https ://developers.google.com/android/guides/client-auth

于 2021-07-01T17:51:33.760 回答
4

Mac Mountain Lion 现在使用 Oracle 的密码相同。

于 2012-11-21T13:02:29.853 回答
0

进入非密码保护的 Java 密钥库并更改密码可以在 Java 编程语言本身的帮助下完成。

那篇文章包含的代码:

thetechawesomeness.ideasmatter.info

于 2019-10-05T13:36:37.127 回答