Exporting certificates from a Java keystore
Busy day at work filled with a number of disappointments, however one thing which made my day – I found that there is a patently easy way to convert JKS keystores to PKCS12 certificate bundles (and vice versa). It’s a keytool command that was introduced with JDK 6:
Convert JKS to P12
keytool -importkeystore -srckeystore keystore.jks -srcstoretype JKS -deststoretype PKCS12 -destkeystore keystore.p12
Convert P12 to JKS
keytool -importkeystore -srckeystore keystore.p12 -srcstoretype PKCS12 -deststoretype JKS -destkeystore keystore.jks
Mucho gratitude to tomas at EJBCA for blogging about this last year .. I’m just annoyed at myself for not having found the post earlier.
- zac.