hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From RossW <rosshwal...@gmail.com>
Subject SSL Site
Date Tue, 03 Apr 2007 05:23:18 GMT

Hiyas,

I hope you guys can help cause this one is driving me mad.  Ok, so the good
news first, I can successfully connect my Java SWT App to a normal http site
which also has basic authent setup and i can extract stuff from the page. 
When i try to do the same thing from a SSL or https site i get IO errors.  I
appoligise for not putting the exact trace details in here but i am hoping
this isnt neccessary.  The site has an unverifiable certificate (this cant
be changed) so i have had to setup a security manager to exept all
certificates verified or not.  The docs on the apache site imply that i
should then be able to connect to it like it would a normal page but i have
found this isnt the case.  The code i am using is not exactly designed for
Jakarta commons libs but it should still work shouldnt it ?  This is the
code i have (i got the idea for this code from a site i cant recall the name
of sorry)

[code]
	    TrustManager[] trustAllCerts = new TrustManager[]{
	        new X509TrustManager() {
	            public java.security.cert.X509Certificate[]
getAcceptedIssuers() {
	                return null;
	            }
	            public void checkClientTrusted(
	                java.security.cert.X509Certificate[] certs, String
authType) {
	            }
	            public void checkServerTrusted(
	                java.security.cert.X509Certificate[] certs, String
authType) {
	            }
	        }
	    };
	    
	    try {
	    	SSLContext sc = SSLContext.getInstance("SSL");
	        sc.init(null, trustAllCerts, new java.security.SecureRandom());
	       
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
	    } catch (Exception e) {
	    	
	    	e.getMessage();
	    	
	    }
			
			HttpClient chester_client = new HttpClient();
[/code] 

please help me!!
-- 
View this message in context: http://www.nabble.com/SSL-Site-tf3509897.html#a9803919
Sent from the HttpClient-User mailing list archive at Nabble.com.

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