hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From steve_ol...@illinoispower.com
Subject New user question
Date Wed, 09 Jun 2004 20:53:36 GMT
We're wanting to use HttpClient to do an HTTPS session that requires a user
certificate submission for authentication.  Are there samples that anyone
can point me to on this topic?  If not, I'd appreciate any tips anyone
might have on how best to to this with HttpClient.  I did some googling and
just dodn't find much in the way of hits.  Here's equivalent J2SE code
fragment that I was hoping to use HttpClient to replace:

            SSLContext ctx = SSLContext.getInstance("TLS");
            KeyManagerFactory kmf =
KeyManagerFactory.getInstance("SunX509");
            KeyStore ks = KeyStore.getInstance("PKCS12");
            ks.load(new FileInputStream(keystorePath),
keystorePassword.toCharArray());
            kmf.init(ks, keystorePassword.toCharArray());
            ctx.init(kmf.getKeyManagers(), null, null);
            SSLSocketFactory factory = ctx.getSocketFactory();

            SSLSocket socket = (SSLSocket) factory.createSocket(host,
port);
            socket.startHandshake();

At this point the GET is sent and the response is retrieved and everything
works.

Another question - does HttpClient run ok on JRE 1.5?  Unfortunately the
site we are communicating with uses a user cert with a 4096 bit RSA key,
which is larger than JRE 1.4's JSSE/JCE supports but works ok on 1.5.  So
if HttpClient has any issues with JRE 1.5 that anyone is already aware of,
I'd love to hear about that as well.

Thanks in advance...



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


Mime
View raw message