无法使用 JDK6 生成密钥库,但可以使用 JDK5 生成

Unable to generate keystore using JDK6 but able to generate using JDK5

我正在尝试使用以下 keytool 命令为我的应用程序生成密钥库:

keytool -genkey -alias tomcat -keystore tomcat.keystore -keyalg RSA -keysize 2048 < keystore.data.txt

它在 JDK5 上运行良好,在 JDK6 上运行不佳。 仅供参考:

使用JDK5执行时

Enter keystore password:  What is your first and last name?
[Unknown]:  What is the name of your organizational unit?
[Unknown]:  What is the name of your organization?
[Unknown]:  What is the name of your City or Locality?
[Unknown]:  What is the name of your State or Province?
[Unknown]:  What is the two-letter country code for this unit?
[Unknown]:  Is CN=tpserver-hostname, OU=MyCompany, O=MyOrg., L=MyCity, ST=MyState (ST), C=IN correct?
[no]:
Enter key password for <tomcat>
   (RETURN if same as keystore password):

与JDK6执行相同时

Enter keystore password:  Re-enter new password: They don't match. Try again
Enter keystore password:  Re-enter new password: They don't match. Try again
Enter keystore password:  Re-enter new password: They don't match. Try again
Too many failures - try later

请帮助我。

我找到了问题的解决方案。

'Re-enter new password:' 是 jdk6 和 jdk7 版本中的新内容,不询问 jdk5。因此,在我的 'keystore.data.txt' 文件中的密码下复制并添加新密码,然后能够生成密钥库文件。

是的,你是对的。 'Re-enter new password'是从JDK 6开始加入的。所以你必须在密码

之后输入