I'd like to use Keytool to export a certificate from my KeyStore.

I'd also like to change the certificate password, is it possible?

What I thought should be done is one of the following: 1. Changing the certificate password during export 2. Changing the certificate password after export

I couldn't find a way to do either option with keytool.

2 Answers 2


1- Changing the keystore password:

keytool -storepasswd -new new_storepass -keystore keystore.jks

2- Exporting the certificate:

keytool -export -alias mydomain -file mydomain.crt -keystore keystore.jks


  • I don't want to change the existing keystore password.
    – danieln
    Commented Nov 8, 2015 at 11:04
  • The password is set to protect the private key. What exactly are you trying to do? Combine export cert and change pwd in the same command?
    – Seb B.
    Commented Nov 8, 2015 at 11:05
  • If you just want to export the certificate, you don't need to protect it with a pwd, it's not confidential (publicKey).
    – Seb B.
    Commented Nov 8, 2015 at 11:12

My solution for changing the password on a certificate within a keystore was:

keytool -keypasswd -new NewCertPass -keystore keystore.jks -storepass KeystorePass -alias mydomain -keypass OldCertPass
  • Welcome. Can you explain why this works? We tend to like to see more than just a commandline optionset but some comments on why or how it answers the question.
    – schroeder
    Commented Oct 19, 2018 at 8:02
  • Thanks Endareth, this command helped me. I didn't need to change the password, just verify that the one I have is correct. Commented Apr 21, 2020 at 14:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .