Ask Your Question
1

How can the alias be set while using keytool to import a keystore in Java?

asked 2022-06-28 11:00:00 +0000

djk gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-03-13 08:00:00 +0000

nofretete gravatar image

To set an alias while using keytool to import a keystore in Java, use the -alias command-line option when importing the certificate.

Syntax:

keytool -importkeystore -srckeystore [source-keystore] -destkeystore [destination-keystore] -srcalias [source-alias] -destalias [destination-alias]

where

  • [source-keystore] is the path to the keystore containing the certificate to be imported
  • [destination-keystore] is the path to the keystore into which the certificate will be imported
  • [source-alias] is the alias of the certificate in the source keystore
  • [destination-alias] is the new alias for the imported certificate in the destination keystore

Example:

keytool -importkeystore -srckeystore mykeystore.p12 -srcstoretype PKCS12 -destkeystore mykeystore.jks -deststoretype JKS -srcalias mycert -destalias mynewalias

This command imports the certificate with alias "mycert" from the PKCS12 keystore "mykeystore.p12" and saves it with a new alias "mynewalias" in the JKS keystore "mykeystore.jks".

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-06-28 11:00:00 +0000

Seen: 7 times

Last updated: Mar 13 '22