I have a JKS keystore with certicate signed by CA. I need to export it in PEM format in order to use it with nginx. I need to do it in such a way that it includes the whole chai
You can easily convert a JKS file into a PKCS12 file:
keytool -importkeystore -srckeystore keystore.jks -srcstoretype JKS -deststoretype PKCS12 -destkeystore keystore.p12
You can then extract the private key and any certs with:
openssl pkcs12 -in keystore.p12