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.


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
    Nov 8 '15 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.
    Nov 8 '15 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.
    Nov 8 '15 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
    Oct 19 '18 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. Apr 21 '20 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.