hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raul Acevedo <r...@cantara.com>
Subject how to do client authentication
Date Thu, 29 Nov 2007 04:08:27 GMT
Is there a way to do client authentication with HttpClient without
setting javax.net.ssl.keyStore?

I tried the following code after building the contrib files:

    HttpClient httpClient = new HttpClient();
    URL keyStoreURL = new URL("file:/home/raul/keyStore.jks");
    URL trustStoreURL = new URL("file:/home/raul/trustStore.jks");
    AuthSSLProtocolSocketFactory socketFactory =
        new AuthSSLProtocolSocketFactory(
                keyStoreURL, "keyStorePassword", trustStoreURL, "trustStorePassword");
    Protocol httpsProtocol = new Protocol(url.getProtocol(), socketFactory, url.getPort());
    httpClient.getHostConfiguration().setHost(url.getHost(), url.getPort(), httpsProtocol);

But this fails with:

    java.net.SocketException: Default SSL context init failed: null


Raul Acevedo

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

View raw message