English 中文(简体)
keytool-genkey错误:密钥库文件不存在
原标题:keytool -genkey error: Keystore file does not exist

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

我使用的命令是:

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

但我总是遇到这样一个恼人的错误:

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

我不明白为什么我会犯这个错误。上面的命令应该创建一个新的密钥存储库,那么为什么它会抱怨一个不存在的存储库呢?

最佳回答

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

即。

keytool -genkey -alias myKey -keystore store.jks
keytool -selfcert -alias myKey -keystore store.jks
问题回答

以管理员身份运行命令提示符,即可完成。

首先使用以下命令生成上传密钥:

keytool -genkeypair -v -keystore my-upload-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000

然后运行

keytool -exportcert -keystore path-to-debug-or-production-keystore -list -v 

-selfcert选项在Java 6的keytool中被废弃。请在此处查看“更改”的最后一节:Java 6密钥工具

因此,对于Java 6及以后版本,请将-selfcert替换为-certreq

Seems a old link but this is what I tried - Hope this helps someone. In my case as .keystore file was missing in the below location, I had run the following command; keytool -genkey -alias mykey -keystore "C:Usersusername.keystore" This creates a .keystore file in the location, system asks you for information like What is your first and last name? What is the name of your organizational unit? What is the name of your organization? What is the name of your City or Locality? What is the name of your State or Province? What is the two-letter country code for this unit? Is CN=XXX, OU=XXX, O=XXX, L=XXX, ST=XXX, C=IN correct?

说“是”,就会创建密钥库。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签