Curl doesn't have support for java keystore file, so therefor the file should be converted to a PEM format. It consists of the following multiple steps:
- Convert keystore to p12 file
- Convert p12 file to pem file
- Run curl command with pem files
keytool -importkeystore -srckeystore truststore.jks -destkeystore truststore.p12 -srcstoretype JKS -deststoretype PKCS12
openssl pkcs12 -in truststore.p12 -out truststore.pem
curl secret --cacert truststore.pem https://localhost:8443/api/hello
Example curl request for mutual authentication, loading trusted certificates and loading private and public key of the client:
Repeat step 1 (if applicable) and step 2 for the identity.jks which contains the keypair.
curl --cert identity.pem --cacert truststore.pem https://localhost:8443/api/hello