I have pem certificate with private key and server certificate. I can execute it using curl and all works ok.
curl -O -k --cert-type pem --cert mypem.pem url
But I want to use it with java, most preferably will be RestTemplate from spring.
I have pem certificate with private key and server certificate. I can execute it using curl and all works ok.
curl -O -k --cert-type pem --cert mypem.pem url
But I want to use it with java, most preferably will be RestTemplate from spring.
You need to import the certificate in the java trust store.
BTW pem and cer(t) files are the same, just a different name for the extension
Additional links
So knowledge about using pem certificate with RestTemplate is distracted.
Steps which must be done:
Add server certificate to trustStore, using keytool or portecle. When you want to use custom trusttore use this script
Next configure ssl to RestTemplate. It may be done like below:
and
Finally you can use inject restTemplate to connect to url.