如何更改密钥库中密钥的别名? [英] How to change the alias of a key within a keystore?
问题描述
我签署了JWS应用程序 MemorizEasy ,其密钥为:
I signed my JWS application MemorizEasy with a key whose alias is:
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屋!