0

I am trying to contact a service over https using RestTemplate. I have got their crt and I added it to java cacerts truststore and everything worked.

But now If I wanted to remove it from cacerts and add it to my a trust store that exist in resource folder

so I have the following in the properties file

server.ssl.trust-store=classpath:service1.truststore
server.ssl.trust-store-password={pass}

I added the crt to service1.truststore

This does not work..... I get

SunCertPathBuilderException: unable to find valid certification path to requested target

Can someone explain the difference here between adding the cert to my truststore vs cacerts?

I have the same CAs in both truststores.

user955165
  • 447
  • 3
  • 8
  • 17
  • Did you add the cert to trust store? using "keytool -importkeystore........changit..." – z atef Nov 26 '20 at 23:30
  • Yes.... keytool -import -alias service -file service.crt -keystore service1.truststore – user955165 Nov 27 '20 at 00:00
  • Are you able to verify its insatlled properly? see https://stackoverflow.com/questions/12893995/how-to-check-certificate-name-and-alias-in-keystore-files – z atef Nov 27 '20 at 00:12
  • Yes I confirmed the cert in the store – user955165 Nov 27 '20 at 00:45
  • What version of spring boot are you using? also, did you read this https://stackoverflow.com/questions/9210514/unable-to-find-valid-certification-path-to-requested-target-error-even-after-c – z atef Nov 27 '20 at 00:56

0 Answers0