One of the public API I'm using forgot to provide the certificate of the intermediary issuing authority when renewing its certificate resulting in PKIX exception for my app (PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target).. I want to add the server API certificate that I downloaded to the truststore so that my Springboot application can access the API.
Following the doc I tried to add the certificate une sing SSL bundles.
@Bean
protected RestTemplate createRestTemplateClient(@Autowired RestTemplateBuilder restBuilder,SslBundles sslBundles ) {
restBuilder.setSslBundle(sslBundles.getBundle("scanr")).build();
return restBuilder.build();
}
With the following application.properties and scanr.pem in the resources folder
spring.ssl.bundle.pem.scanr.truststore.certificate=classpath:scanr.pem
He same PKIX exception is still thrown. Am I missing something?