1/30/21

How to Change JKS KeyStore Private Key Password

Use following keytool command to change the key store password

>keytool  -storepasswd  -new [new password ]  -keystore  [path to key store]

As an example, if you are changing password of jvkeystore.jks file.

$ keytool -storepasswd -new newjvkeystore -keystore jvkeystore.jks

Enter keystore password: 

Use following keytool command to change private key password

>keytool -keypasswd  -alias [Alias name for private key]  -keystore [path to key store]

Then it would promote for key store password,  private key password and new private key passwords.

As an example,

$ keytool -keypasswd -alias jvkeystore -keystore jvkeystore.jks 

Enter keystore password: 

Enter key password for <jvkeystore>

New key password for <jvkeystore>: 

Re-enter new key password for <jvkeystore>: 

If you are not know the alias of private key, you can find it by listing the keystore details.    You can look for PrivateKeyEntry

$ keytool -list -keystore jvkeystore.jks 

Enter keystore password:

Keystore type: JKS

Keystore provider: SUN

Your keystore contains 37 entries


jvkeystore.cert, Feb 26, 2010, trustedCertEntry, 

Certificate fingerprint (SHA1): 34:2F:8E:60:4F:95:2C:74:10:0A:62:4B:DC:35:51:91:4C:B1:AE:BD

jvkeystore, May 26, 2014, PrivateKeyEntry, 

Certificate fingerprint (SHA1): 6B:F8:E1:36:EB:36:D4:A5:6E:A0:5C:7A:E4:B9:A4:5B:63:BF:97:5D

How to Change JKS KeyStore Private Key Password

Use following keytool command to change the key store password >keytool  -storepasswd  -new [new password ]  -keystore  [path to key stor...