java - How do disable SSLv3 in Apache HttpClient -
with reference poodle vulnerability, need force code use only tlsv1 , not sslv3. have set sslprotocols="tlsv1" in server.xml file, , set system property "https.protocols" "tlsv1". though works connections created using httpsurlconnection, doesnt solve connections created using org.apache.commons.httpclient.httpclient
java version 1.5+
my sample code follows
connection initiation
multithreadedhttpconnectionmanager httpconnectionmanager = new multithreadedhttpconnectionmanager(); connparams = httpconnectionmanager.getparams(); connparams.setdefaultmaxconnectionsperhost(10); connparams.setmaxtotalconnections(75); connparams.setconnectiontimeout(1000); connparams.setsotimeout(30000); httpconnectionmanager.setparams(connparams); clientparams = new httpclientparams(); clientparams.setparameter(httpmethodparams.retry_handler, new defaulthttpmethodretryhandler(0, true)); try{ protocol customhttps = new protocol("https", new easysslprotocolsocketfactory(), 443); protocol.registerprotocol("https",customhttps); //no i18n } catch(exception ex) { ex.printstacktrace(); } httpclient = new org.apache.commons.httpclient.httpclient(clientparams, httpconnectionmanager);
url calling
httpmethod method = new getmethod(url); client.executemethod(method); properties servicedata = new properties(); servicedata.load(method.getresponsebodyasstream());
error received
javax.net.ssl.sslhandshakeexception: received fatal alert: handshake_failure @ com.sun.net.ssl.internal.ssl.alerts.getsslexception(alerts.java:174) @ com.sun.net.ssl.internal.ssl.alerts.getsslexception(alerts.java:136) @ com.sun.net.ssl.internal.ssl.sslsocketimpl.recvalert(sslsocketimpl.java:1720) @ com.sun.net.ssl.internal.ssl.sslsocketimpl.readrecord(sslsocketimpl.java:954) @ com.sun.net.ssl.internal.ssl.sslsocketimpl.performinitialhandshake(sslsocketimpl.java:1138) @ com.sun.net.ssl.internal.ssl.sslsocketimpl.writerecord(sslsocketimpl.java:632)
any solve highly appreciated.
thanks in advance.
--n.shankar
Comments
Post a Comment