hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Problem in SSL Client Authentication using Apache-Commons-HTTPClient API-v3.0
Date Fri, 18 Apr 2008 23:18:27 GMT

On Wed, 2008-04-16 at 13:33 +0500, Muhammad Khurram Saleem wrote:
> Hi everyone !
> here is my problem:
> *1 -* I'm failing to do SSL Client Authentication using
> Apache-Commons-HTTPClient API v 3.0.
> *2 -* But I'm successful in doing SSL Server Authentication using
> Apache-Commons-HTTPClient API v3.0
> I'm using JDK v-1.5.0_06
> 
> Following are my steps for 2:
> I have override the following settings of JRE for SSL Server Auth:
> 
> System.setProperty( "javax.net.ssl.trustStore" , this.sslKeystoreFilePath);
> System.setProperty( "javax.net.ssl.trustStorePassword" ,
> this.sslKeystorePassword );
> System.setProperty( "java.protocol.handler.pkgs" ,
> "com.sun.net.ssl.internal.www.protocol" );
> Security.addProvider( *new* com.sun.net.ssl.internal.ssl.Provider() );
> 
> and Its doing fine.
> But I don't find any useful class to do SSL Client Authentication.
> I know the way to do SSL Client Authentication using pure JSSE i.e.
> 
> getCertsAndKeysFromPFXWithJSSE(); //Getting Keys and Certs from PFX using JSSE
> SSLContext sc = SSLContext.getInstance("SSL");
> sc.init(kmf.getKeyManagers(), null, *null*); //kmf=KeyManagerFactory
> SSLSocketFactory f = sc.getSocketFactory();
> SSLSocket c = (SSLSocket) f.createSocket(url, port);
> //Enabling Client Authentication
> c.setNeedClientAuth(*true*);
> printSocketInfo(c);
> sendRequest("hello".getBytes(), c, url);
> 
> This code is also working fine.
> 
> But I'm unable to perform the same task using Apache-Commons-HTTPClient API
> v 3.0. [I have to use this API]. Is there any way that I can plug my
> functionality with Apache-Commons-HTTPClient API v 3.0 at JSSE level.
> 
> please help me in this regard.
> 

Please take a look at the HttpClient SSL guide

http://hc.apache.org/httpclient-3.x/sslguide.html

Oleg


> br
> 
> KS


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


Mime
View raw message