hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gayan Bandaranayake (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HTTPCLIENT-1797) Closeable async http client not sending client certificate when server requests
Date Wed, 28 Dec 2016 08:58:58 GMT
Gayan Bandaranayake created HTTPCLIENT-1797:

             Summary: Closeable async http client not sending client certificate when server
                 Key: HTTPCLIENT-1797
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1797
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: HttpClient (async)
         Environment: Ubuntu with java 1.8
            Reporter: Gayan Bandaranayake
            Priority: Blocker

I am trying to connect to a server which requires two way SSL authentication with apache CloseableHttpAsyncClient.
I have provided the JVM with keystore and truststore using -Djavax.net.ssl.keyStore and -Djavax.net.ssl.trustStore.
However, the client does not send the certificate to the server when asked. From the server
side I keep getting the following exception.

javax.net.ssl.SSLHandshakeException: null cert chain
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1937)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:302)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:292)
at sun.security.ssl.ServerHandshaker.clientCertificate(ServerHandshaker.java:1804)

I have checked the packet trace and the server requests for the client certificate mentioning
trusted authorities. But the client message for certificate contains a certificate of length
0. Same application has a SOAP client which also connects to the same server with two say
SSL authentication which is working fine. Please find the code to initialize the http client

SSLContext sslContext;
        try {
            sslContext = SSLContexts.custom()
                    .loadTrustMaterial(new TrustSelfSignedStrategy())

        } catch (NoSuchAlgorithmException | KeyStoreException | KeyManagementException e)
            logger.error("An error occurred while creating ssl context,", e);
            throw new RuntimeException(e);
        SSLIOSessionStrategy sslSessionStrategy = new SSLIOSessionStrategy(
                new String[]{"TLSv1"},

        httpClient = HttpAsyncClients


I have tried registering ConnectionSocketFactory for http and SSLConnectionSocketFactory for
https using ConnectionSocketFactory registry and it also did not work. 

This message was sent by Atlassian JIRA

To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org

View raw message