hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sachin Nikumbh <saniku...@gmail.com>
Subject HTTP async client and accessing server certificate (SSL)
Date Mon, 29 Apr 2013 15:27:04 GMT
Hi,

I am currently using the HTTP async client in my application to communicate
with a proprietary server. Now, I need to extend the functionality to
include HTTPS support. We need to provide client authentication and I have
the following picture of how I can provide client credentials.

My first question is, is this the correct approach? Am I missing anything
here?

************************************************

SSLContext context = ..... ; // Create with user provided
keystore/truststore

AsyncScheme scheme = new AsyncScheme( "https", 9910, new
SSLLayeringStrategy(context) );

HttpAsyncClient httpClientAsync = new DefaultHttpAsyncClient();

PoolingClientAsyncConnectionManager connectionMgr =
(PoolingClientAsyncConnectionManager)httpClientAsync.getConnectionManager();

AsyncSchemeRegistry asyncReg = connectionMgr.getSchemeRegistry();

asyncReg.register(scheme);
************************************************

My second question is about server authorization for which I need access to
the server certificate. I need to get the CN value from the certificate
which I am later going to use internally. I am basically looking for
something similar to java.net.HttpsUrlConnection.getPeerPrincipal or
java.net.HttpsUrlConnection.getServerCertificates.

Any help will be greatly appreciated.

Thanks
Sachin

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message