Author's note: this is an older article I brought over from my prior blog by popular request. Some of the information may be a little dated.
In case it's helpful to other folks, here's how to convert a Java Keystore file (JKS) to a PKCS#12 archive file (PFX). You'll need java installed somewhere on a local system so you can leverage the handy
1) Copy the JKS file to the respective jre
bin folder. Versions and specific paths can vary but an example would be
c:\Program Files\Java\<jre version>\bin\
2) Navigate to that directory from the Windows command prompt and leverage the following command:
keytool -importkeystore -srckeystore "<source jks filename>" -srcstoretype JKS -srcstorepass <jks password> -destkeystore "<destination pfx filename>" -deststoretype PKCS12 -deststorepass <desired pfx password>
So for example, let's say my JKS file was named
myjksfile.jks and it had a password of
foopassword... and let's say that I wanted to convert it to a PFX file called
mypfxfile.pfx with a different password of
foopassword2. The complete command would look like:
keytool -importkeystore -srckeystore "myjksfile.jks" -srcstoretype JKS -srcstorepass foopassword -destkeystore "mypfxfile.pfx" -deststoretype PKCS12 -deststorepass foopassword2
- The quotation marks are optional. I just put them there in case the file paths/names have spaces.
- It's probably best to not use shell-specific characters or else you'll need to escape them.