没有密钥库的Keytool [英] Keytool without keystore
问题描述
我有一个关于keytool的问题.
I have a question about keytool..
我将使用以下命令:
keytool -importkeystore -srckeystore foo.jks -destkeystore foo.p12 -srcstoretype jks -deststoretype pkcs12
我可以不指定srckeystore吗?我需要此请求,因为我不知道我使用的密钥库.. :) 我以这种方式创建了证书:
Can I don't specify the srckeystore? I need this request because I don't know my keystore that I use.. :) I created the certificate in this way:
keytool -genkey -alias myalias -keyalg RSA -keysize 2048
因此,我没有指定密钥库...这样,Keytool将使用哪个密钥库?
so, I don't have specified the keystore...In this way, Keytool which keystore will use?
推荐答案
如果使用keytool
命令生成密钥库,但是没有-keystore
选项,它将在默认位置创建密钥库,这是用户的主目录.文件名将为".keystore".
If you use the keytool
command to generate a keystore and you do not have a -keystore
option, it will create the keystore in the default location, which is the user's home directory. And the filename will be ".keystore".
对于-importkeystore
选项,-srckeystore
是必需的,因此您必须提供创建的".keystore"文件的路径.
For the -importkeystore
option, -srckeystore
is required, so you will have to give the path to the ".keystore" file that you created.
为避免这种混乱,在创建新的密钥库时,请使用-keystore
选项为其提供一个已知的文件名.
To avoid this confusion, when you create a new keystore, give it a known filename by using the -keystore
option.
例如:
keytool -genkey -alias myalias -keyalg RSA -keysize 2048 -keystore foo.jks
现在,将其转换为PKCS12密钥库的命令应该可以使用了.
Now your command to convert it to a PKCS12 keystore should work.
有关更多详细信息,请参见 keytool文档.
For more details, see the keytool documentation.
这篇关于没有密钥库的Keytool的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!