Graph connection returns PKIX path building failed

I have been successfully using the very useful new Graph feature of Aspose with version aspose-email-22.7-jdk16.jar.
I just tested Aspose version 23.4, and it starts to return PKIX cert errors, as shown below. How do I hook in a web cert Trust Manager to overcome this?

AsposeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target ---> javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target --- End of inner exception stack trace --- [Ljava.lang.StackTraceElement;@5b742bc8 at com.aspose.email.zym.c(SourceFile:197) at com.aspose.email.zyl.a(SourceFile:48) at com.aspose.email.zym.n(SourceFile:73) at com.aspose.email.zyn.listFolders(SourceFile:77)

[this exception is raised at GraphFolderInfoCollection folders = client.listFolders(); ]

Hello @mbeedell

Your issue is taken for investigation. We’ll contact you as soon as we have results.

Thanks for reporting your case.

@mbeedell
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): EMAILJAVA-35194

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Hello @mbeedell,

Could you check the issue with 23.7 release
You can disable predefined sslcontext using code:

HttpUtility.setSSLContext(null);

The system works fine with 22.7. I just tried my code with 23.4 and this is when the https cert problem showed (I have not tried the other releases).

The Java eMail library does not contain the HttpUtility class. It does have an HttpProxy class. The GraphClient (that I am trying to use) does not have a setSSLContext method, and it’s http proxy is null - so I cant see how to create a proxy against which I can set the requirements. I tried something like this:
mygraphclient.getProxy().setSupportedAuthenticationMethods(HttpAuthenticationMethods.NoAuthentication)

Hello @mbeedell,

This is my mistake, i have added fixes in latest version 23.7.

I have just tried this new version (23.7) and is still returns the PKIX error. Is there a new https utils class that I should use? - I cant see any references to this in the release notes.

AsposeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target ---> javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target --- End of inner exception stack trace --- [Ljava.lang.StackTraceElement;@5866731 at com.aspose.email.zym.c(SourceFile:200) at com.aspose.email.zyl.a(SourceFile:48) at com.aspose.email.zym.n(SourceFile:73) at com.aspose.email.zyn.listFolders(SourceFile:77) at getNDRusingGraph.run(getNDRusingGraph.groovy:91) Caused by: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at com.aspose.email.zym.c(SourceFile:179) ... 4 more

Hello @mbeedell,

Did you set the ssl context to null like I described above before connection?

HttpUtility.setSSLContext(null);

I apologise - yes, that resolved the issue, thank you. Perhaps adding a what’s new in this release comment would help!
Thank you

@mbeedell,

Thank you for your feedback, we wanted to make sure that the issue is resolved on your side.
The new functionality will be documented.