如何更改密钥库中密钥的别名? [英] How to change the alias of a key within a keystore?
问题描述
我使用别名为:
memofile.reference.emma.jar=/Users/simpatico/.netbeans/6.8/modules/ext/emma.jar
我不记得为什么我选择了这么长的别名.我怀疑这只是备忘录,但在我的项目设置中我有:
I don't remember why I chose such a long alias. I suspect it was memo only, but in my project settings I have:
jnlp.signjar.alias=memofile.reference.emma.jar=/Users/simpatico/.netbeans/6.8/modules/ext/emma.jar
我现在正在更新应用程序并使用 maven 我需要将别名指定为:
I'm now updating the application and using maven I need to specify the alias as:
<keystorealias>memofile.reference.emma.jar=/Users/simpatico/.netbeans/6.8/modules/ext/emma.jar
</keystorealias>
然而这行不通.尝试使用别名 mjee
的另一个密钥它可以工作.
Yet that doesn't work. Trying another key with alias mjee
it works.
那么我可以更改密钥的别名吗?如果是这样,如何?否则,Maven 为什么不接受我的别名?
So could I change the alias of the key? If so, how? Otherwise, why wouldn't Maven accept my alias?
推荐答案
可以使用 keytool
的 keyclone
命令复制密钥库中的密钥:>
It is possible to duplicate a key in a keystore with the keyclone
command of keytool
:
keytool -keyclone -alias "your-very-very-long-alias" -dest "new-alias" -keypass keypass -new new_keypass -keystore /path/to/keystore -storepass storepass
changealias
命令更改现有条目的别名:
The changealias
command changes the alias for an existing entry:
keytool -changealias -alias "your-very-very-long-alias" -destalias "new-alias" -keypass keypass -keystore /path/to/keystore -storepass storepass
对于那些想要提示输入密码的人,只需删除相应的密码标志(changealias
示例):
For those that want to be prompted to enter password just remove the respective password flags (changealias
example):
keytool -changealias -alias "your-very-very-long-alias" -destalias "new-alias" -keystore "/path/to/keystore"
这篇关于如何更改密钥库中密钥的别名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!