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
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".
Asked: 2022-06-28 11:00:00 +0000
Seen: 7 times
Last updated: Mar 13 '22