keytool -genkey错误:密钥库文件不存在 [英] keytool -genkey error: Keystore file does not exist

查看:6495
本文介绍了keytool -genkey错误:密钥库文件不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试创建一个新的自我认证密钥库文件

I try to create a new self certified keystore file

我使用的命令是:

keytool -genkey -selfcert -dname "cn=My Name, ou=Orga unit" -alias selfcertified -keypass somepass -keystore keystore.jks -storepass anotherpass -validity 365

但我总是得到这个恼人的错误:

but I always get this annoying error:

keytool error: java.lang.Exception: Keystore file does not exist: keystore.jks

我不明白为什么我得到这个错误。

I do not understand why I'm getting this error. The command above should create a new keystore, so why is it complaining about a non existing store?

推荐答案

生成一个密钥对(和一个新的密钥库)必须作为一个单独的操作来创建该密钥的自签名证书。

Generating a key pair (and a new keystore) has to be done as a separate operation to creating a self-signed certificate for that key.

ie

keytool -genkey -alias myKey -keystore store.jks
keytool -selfcert -alias myKey -keystore store.jks

这篇关于keytool -genkey错误:密钥库文件不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆