Converting a JKS KeyStore to a single PEM file can easily be accomplished using the following command:
keytool -list -rfc -keystore "myKeystore.jks" | sed -e "/-*BEGIN [A-Z]*-*/,/-*END [A-Z]-*/!d" >> "myKeystore.pem"
Explanation:
keytool -list -rfc -keystore "myKeystore.jks"
lists everything in the 'myKeyStore.jks' KeyStore in PEM format. However, it also prints extra information.| sed -e "/-*BEGIN [A-Z]*-*/,/-*END [A-Z]-*/!d"
filters out everything we don't need. We are left with only the PEMs of everything in the KeyStore.>> "myKeystore.pem"
write the PEMs to the file 'myKeyStore.pem'.