Certificate conflict when using jose4j

Issue #112 invalid
Former user created an issue

Hello,

I'm working on a project currently which uses jose4j to add keys generated from Microsoft AD to the certificate. I get the Microsoft keys using the following HTTP call:

 Client client = ClientBuilder.newClient();
        Response response = client.target(MICROSOFT_SERVICE_URL)
                .request(MediaType.APPLICATION_JSON_TYPE)
                .get();

The project then has to make a request to an external SOAP API. This is where the conflict is being caused. I've got the following code which sets the system properties required for the certificate:

System.setProperty("com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump", "true");
        System.setProperty("com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump", "true");
        System.setProperty("com.sun.xml.ws.transport.http.HttpAdapter.dump", "true");
        System.setProperty("com.sun.xml.internal.ws.transport.http.HttpAdapter.dump", "true");
        System.setProperty("javax.net.ssl.keyStoreType", "jks");
        System.setProperty("javax.net.ssl.keyStorePassword", "changeit");
        System.setProperty("javax.net.ssl.keyStore", "KeyStore.cert");
        System.setProperty("javax.net.ssl.trustStore", "KeyStore.cert");

When i make the request i get the following error:

javax.servlet.ServletException: javax.ws.rs.ProcessingException: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

But when i comment out the keyStore and trustStore code it works.

Is there anything in the libary that would be causing this conflict ?

Any advice will be appreciated.

Alex

Comments (2)

  1. Log in to comment