Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 65734200BFA for ; Wed, 28 Dec 2016 09:59:00 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 64264160B2E; Wed, 28 Dec 2016 08:59:00 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id ADE31160B35 for ; Wed, 28 Dec 2016 09:58:59 +0100 (CET) Received: (qmail 68939 invoked by uid 500); 28 Dec 2016 08:58:58 -0000 Mailing-List: contact dev-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list dev@hc.apache.org Received: (qmail 68660 invoked by uid 99); 28 Dec 2016 08:58:58 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Dec 2016 08:58:58 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 754EF2C1F56 for ; Wed, 28 Dec 2016 08:58:58 +0000 (UTC) Date: Wed, 28 Dec 2016 08:58:58 +0000 (UTC) From: "Gayan Bandaranayake (JIRA)" To: dev@hc.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (HTTPCLIENT-1797) Closeable async http client not sending client certificate when server requests MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 28 Dec 2016 08:59:00 -0000 Gayan Bandaranayake created HTTPCLIENT-1797: ----------------------------------------------- Summary: Closeable async http client not sending client certificate when server requests 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 below. SSLContext sslContext; try { sslContext = SSLContexts.custom() .loadTrustMaterial(new TrustSelfSignedStrategy()) .build(); } catch (NoSuchAlgorithmException | KeyStoreException | KeyManagementException e) { logger.error("An error occurred while creating ssl context,", e); throw new RuntimeException(e); } SSLIOSessionStrategy sslSessionStrategy = new SSLIOSessionStrategy( sslContext, new String[]{"TLSv1"}, null, SSLIOSessionStrategy.getDefaultHostnameVerifier()); httpClient = HttpAsyncClients .custom() .setConnectionManager(connectionManager) .setSSLHostnameVerifier(SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER) .setSSLStrategy(sslSessionStrategy) .build(); httpClient.start(); 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 (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org For additional commands, e-mail: dev-help@hc.apache.org