Java – How to create a PFX file from a Java Keystore


I have a Java keystore (.jks file) holding a single certificate. How can I create a .pfx file from this keystore?

Best Answer

From Java 6 onwards, keytool has an -importkeystore option, which should be able to convert a JKS store into a PKCS#12 store (.p12/.pfx):

keytool -importkeystore -srckeystore thekeystore.jks \
            -srcstoretype JKS \
            -destkeystore thekeystore.pfx \
            -deststoretype PKCS12

It will ask you to enter a password for source and destination (jks, pfx) files