8

Error message :PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target HTTPS server Certificate Issuer is "COMODO RSA Domain Validation Secure Server CA" with Signature hash algorithm Name "Sha256".

Here is the sample code

HttpRequest req = new HttpRequest();
req.setEndpoint(<HTTPS server>);
req.setMethod('POST');
req.setHeader('Content-type','application/json');
HTTPResponse res = http.send(req);
System.debug(res.getBody());
1
  • 3
    Check if your endpoint has valid SSL certificate(f.e. ssllabs.com), if no -- ask endpoint owner to improve it. If that's not possible--middleware proxy is your solution
    – kurunve
    Jan 23, 2018 at 9:17

1 Answer 1

9

Recently ran into this issue myself.

The problem in my case was that the SSL certificate on the server I was calling out to was not installed correctly.

As I understand, most SSL cert providers issue certificates to their customers using "Intermediate" certificates (which are signed by a "Root" certificate held by the issuing company).

Browsers (and Salesforce) trust the root certificates, so to have Salesforce trust the certificate that you were issued, your certificate needs to include the entire chain of certificates back up to one of the trusted root certificates (e.g. your cert -> intermediate cert -> root cert).

When the certificate chain is broken, you get this error.

Fixing SSL certs on external servers is beyond the scope of this site (and a bit beyond my personal knowledge).

1
  • How do we get the chain of certificate for Salesforce? Feb 17 at 11:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .