gpt4 book ai didi

java - 如何使用 java keystore 工具自动生成 keystore ?没有用户交互

转载 作者:IT老高 更新时间:2023-10-28 11:44:39 33 4
gpt4 key购买 nike

我正在尝试使用 Java keystore 工具自动生成 keystore 。我使用的命令是:

keytool -keystore keystore -alias jetty -genkey -keyalg RSA

但是在这个命令之后,用户需要输入某些输入,如下所示:

Enter keystore password:  password
What is your first and last name?
[Unknown]: jetty.mortbay.org
What is the name of your organizational unit?
[Unknown]: Jetty
What is the name of your organization?
[Unknown]: Mort Bay Consulting Pty. Ltd.
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=jetty.mortbay.org, OU=Jetty, O=Mort Bay Consulting Pty. Ltd.,
L=Unknown, ST=Unknown, C=Unknown correct?
[no]: yes

Enter key password for <jetty>
(RETURN if same as keystore password): password

除了用户输入这些值之外,有没有任何方法可以在没有用户交互的情况下提供这些值,无论是在命令中还是通过脚本?

谢谢

最佳答案

试试这个:

keytool -genkey -noprompt \
-alias alias1 \
-dname "CN=mqttserver.ibm.com, OU=ID, O=IBM, L=Hursley, S=Hants, C=GB" \
-keystore keystore \
-storepass password \
-keypass password

关于java - 如何使用 java keystore 工具自动生成 keystore ?没有用户交互,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13578134/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com