[CRITICAL/BLOCKER] sun.security.validator.ValidatorException / Unable to find valid certification path to requested target

We are not able to print anything while making a callout from Salesforce.

The request for mailMergeFieldNames FAILS WITH CERT ERROR.

Seems like it cannot find a valid certificate or certificate is not included
Can you please rectify this ASAP ?

This is the log from the request

20:59:47.110 (110353222)|CALLOUT_REQUEST|[1347]|System.HttpRequest[Endpoint=https://api.aspose.com/v1.1/words//mailMergeFieldNames?folder=&appSID=&signature=, Method=GET]
20:59:47.413 (413011811)|CALLOUT_REQUEST|[1347]|System.HttpRequest retrying request in response to handshake failure: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
20:59:47.647 (647566897)|EXCEPTION_THROWN|[1347]|System.CalloutException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Hi Sunil,
Certificate issue has been fixed. Can you please try again and confirm if the issue has been fixed at your end as well?
Best Regards,

Ijaz
I sent you an email separately on this with the callout link. This issue is happening from salesforce callout.

Here’s a link that might be helpful:
https://salesforce.stackexchange.com/questions/9426/issue-in-callout-to-an-external-rest-service-over-https-from-salesforce

Sent another email with sample code

Any update?

Hi,
Sorry, we were unable to reproduce this issue at our end before because there was no such issue in .NET or PHP.
Looks like this issue is specific to Salesforce. We are working to resolve this issue as soon as possible. You will be updated as soon as it is resolved.
Sorry for the inconvenience.
Best Regards,

Hi Sunil,
Our team is fixing this issue. In the meantime, can you please compare the following Sign method with your Sign method and use this method if your copy is different?

public static String Sign(String data)
{
    String HMAC_SHA1 = 'HmacSHA1';
    try
    {
        data = data.replace(' ', '%20');
        URL url = new URL(data);
        String path = url.getPath();
        path = path.replace(' ', '%20');

        // Remove final slash here as it can be added automatically.
        path = path.removeEnd('/');
        String filePart = url.getPath() + (url.getQuery() == null ? '?' + 'appSID=' + AsposeCloudApp.AppSID : '?' + url.getQuery() + '&appSID=' + AsposeCloudApp.AppSID);
        url = new URL(url.getProtocol(), url.getHost(), url.getPort(), filePart);
        // compute the hmac on input data bytes
        Blob mac = Crypto.generateMac('hmacSHA1', Blob.valueOf(filePart), EncodingUtil.base64Decode(AsposeCloudApp.AppKey));
        String base64 = EncodingUtil.base64Encode(mac);
        system.debug('base64: ' + base64);
        // Remove invalid symbols.
        String result = base64.replace('+', '-').replace('/', '_');
        system.debug('signature: ' + result);
        String encodedUrl = url.toExternalForm() + '&signature=' + result;
        system.debug('full URL: ' + encodedUrl);
        return encodedUrl;
    }
    catch (Exception ex)
    {
        system.debug(ex.getStackTraceString());
        return null;
    }
}

Best Regards,

It seems ok to me.

I believe there was something fixed from your end which fixed the issue. We are able to print documents at the moment .

Thanks for the quick fix

Hi Sunil,
Yes, there was some problem with the SSL certificate. It was fixed.
Sorry for the inconvenience caused by this issue.
Best Regards,

Hi @muhammad.ijaz,

I have the same issue (“PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target”) with a server which is connected to Salesforce and I’m not able to find into the web the solution to fix the server with the good certificate. I know that it’s been a long time since you made this post but if you remember the solution you put in place for the SSL certificate, I’m a taker.

Thanks you,
Best Regards,
Maxime

This topic has been moved to the related forum: https://forum.aspose.cloud/t/3942