gpt4 book ai didi

java - keytool 错误 : java. lang.Exception : Keystore file exists, 但为空

转载 作者:IT老高 更新时间:2023-10-28 20:34:32 27 4
gpt4 key购买 nike

我是 SSL 新手。

我正在尝试使用 keytool 为 SSL 连接创建 keystore 。首先我尝试了以下命令

[aniket@localhost bin]$ keytool -genkey -alias myKeyStore -keyalg RSA -keystore
/home/aniket/keystore

它询问我密码和其他详细信息,最后给了我以下错误

keytool error: java.io.FileNotFoundException: /home/aniket/keystore 
(Is a directory)

所以我在 keystore 文件夹中创建了一个文件 keystoreFile.txt 并执行了

[aniket@localhost bin]$ keytool -genkey -alias myKeyStore -keyalg RSA -keystore
/home/aniket/keystore/keystoreFile.txt

现在(没有提示输入密码等)我得到了

keytool error: java.lang.Exception: Keystore file exists, but is empty:
/home/aniket/keystore/keystoreFile.tx

文件的内容应该是什么。我虽然 keytool 会生成 key 对(一个公钥和相关的私钥

最佳答案

删除空的 keystoreFile.txt,然后再次运行第二个命令

[aniket@localhost bin]$ keytool -genkey -alias myKeyStore -keyalg RSA -keystore
/home/aniket/keystore/keystoreFile.txt

它正在尝试创建您使用 -keystore 标志指定的文件。你的第一个命令失败的原因是你给了它一个现有的目录名。

关于java - keytool 错误 : java. lang.Exception : Keystore file exists, 但为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18913296/

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