Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
209 views
in Technique[技术] by (71.8m points)

java - How to change the alias of a key within a keystore?

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

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>

Yet that doesn't work. Trying another key with alias mjee it works.

So could I change the alias of the key? If so, how? Otherwise, why wouldn't Maven accept my alias?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

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

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"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...