【发布时间】:2020-06-09 16:33:44
【问题描述】:
我是密钥生成的新手。当我跟进这些步骤时,我收到如下错误...
D:\My_Personal_Projects\springblog>keytool -importkeystore -srckeystore springblog.jks -destkeystore springblog.jks -deststoretype pkcs12"
Enter source keystore password:
Enter key password for <springblog>
keytool error: java.lang.Exception: The destination pkcs12 keystore has different storepass and keypass. Please retry with -destkeypass specified.
以下是我经历的步骤
D:\My_Personal_Projects\springblogfrontend>cd springblogfrontend
D:\My_Personal_Projects\springblogfrontend\springblogfrontend>keytool -genkey -alias springblog -keyalg RSA --keystore springblog.jks
-keysize 2048
Enter keystore password:
Re-enter new password:
What is your first and last name?
[Unknown]: Niroshan
What is the name of your organizational unit?
[Unknown]: springblog
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=Niroshan, OU=springblog, O=Unknown, L=Unknown, ST=Unknown, C=Unknown correct?
[no]: yes
Enter key password for <springblog>
(RETURN if same as keystore password):
Re-enter new password:
Warning:
The JKS keystore uses a proprietary format. It is recommended to migrate to PKCS12 which is an industry standard format using "keytool -importkeystore -srckeystore springblog.jks -destkeystore springblog.jks -deststoretype pkcs12".
D:\My_Personal_Projects\springblogfrontend\springblogfrontend>keytool -importkeystore -srckeystore springblog.jks -destkeystore springblog.jks -deststoretype pkcs12
Enter source keystore password:
Enter key password for <springblog>
keytool error: java.lang.Exception: The destination pkcs12 keystore has different storepass and keypass. Please retry with -destkeypass specified.
是什么导致了这个错误?非常感谢任何帮助
【问题讨论】:
-
为什么将 PKCXS#12 密钥库命名为
*.jks?不要那样做。 -
@user207421:显然是因为 keytool 警告(在 8usomething 和 9.0.1 中)说,虽然我同意这不是一个好主意。 OP:您使用的是哪种 Java? AFAIK only j8 默认情况下都会创建 jks 并发出警告,但在我有
-importkeystore的版本中,两次提示输入目标存储密码,在源密码之前。 -
我实际上对此很陌生。这是我的第一代密钥。我能知道这个密钥生成 user207421 dave_thompson_085 背后的想法吗?我也还没想出解决办法。
标签: java spring-boot authentication jwt keystore