G.S*_*G.S 8 java keystore keytool ssl-certificate
我使用以下命令为我的Web应用程序生成了jks。
keytool -genkey -keyalg RSA -alias my-app -validity 10800 -keysize 2048 -sigalg SHA1withRSA -keystore myapp.jks
Run Code Online (Sandbox Code Playgroud)
该命令提示了一些问题,如下所示:
Enter keystore password:
Re-enter new password:
What is your first and last name?
[Unknown]: GS
What is the name of your organizational unit?
[Unknown]: XX
What is the name of your organization?
[Unknown]: YY
What is the name of your City or Locality?
[Unknown]: ZZ
What is the name of your State or Province?
[Unknown]: AA
What is the two-letter country code for this unit?
[Unknown]: BB
Is CN=GS, OU=XX, O=YY, L=ZZ, ST=AA, C=BB correct?
[no]: yes
Enter key password for <my-app> //Why this password is required???
(RETURN if same as keystore password):
Run Code Online (Sandbox Code Playgroud)
只有在密钥库密码(首次提示)和密钥密码都使用时,Tomcat才能读取此密钥库。当我使用其他密码代替“密钥密码”时,由于密钥库文件,tomcat无法启动。
我的问题是密钥密码的意义是什么?
PS:我看到了此链接。他们在这里说:
Press RETURN when prompted for the key password (this action makes the key password the same as the KeyStore password).
Run Code Online (Sandbox Code Playgroud)
如果两个密码必须相同,那么知道两次输入密码有什么意义?
正如@Maas 已经回答的那样,访问存储在 KeyStore 中的密钥条目需要 keyPassword。
它发生的方式是首先使用 KeyStore 密码来访问/解锁 KeyStore,然后使用 keyPassword 解密该 KeyStore 中的密钥条目。
通常,ssl 的各种实现/使用考虑对 KeyStorePassword 和 keyPassword 使用相同的密码
在 tomcat 中也是如此。如果你看到文档tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html他们已经明确指出“你的私钥密码和密钥库密码应该相同。如果它们不同,你会得到一个错误java.io.IOException 的行:无法恢复密钥,如Bugzilla 问题 38217 中所述,其中包含对此问题的进一步参考”
甚至 JSSE 实现也希望 KeyStorePassword 和 KeyPassword 相同。
| 归档时间: |
|
| 查看次数: |
7264 次 |
| 最近记录: |