1 23 24 package org.infoglue.cms.security; 25 26 import java.io.*; 27 import java.net.*; 28 import javax.net.SocketFactory; 29 import javax.net.ssl.SSLSocketFactory; 30 import javax.net.ssl.*; 31 32 33 51 52 public class DummySSLSocketFactory extends SSLSocketFactory 53 { 54 private SSLSocketFactory factory; 55 56 public DummySSLSocketFactory() 57 { 58 try 59 { 60 SSLContext sslcontext = SSLContext.getInstance( "TLS"); 61 sslcontext.init( null, new TrustManager[] { new DummyTrustManager()}, 63 new java.security.SecureRandom ()); 64 factory = ( SSLSocketFactory) sslcontext.getSocketFactory(); 65 66 } 67 catch( Exception ex) 68 { 69 ex.printStackTrace(); 70 } 71 } 72 73 public static SocketFactory getDefault() 74 { 75 return new DummySSLSocketFactory(); 76 } 77 78 public Socket createSocket() throws IOException 79 { 80 return factory.createSocket(); 81 } 82 83 public Socket createSocket( Socket socket, String s, int i, boolean flag) throws IOException 84 { 85 return factory.createSocket( socket, s, i, flag); 86 } 87 88 public Socket createSocket( InetAddress inaddr, int i, InetAddress inaddr1, int j) throws IOException 89 { 90 return factory.createSocket( inaddr, i, inaddr1, j); 91 } 92 93 public Socket createSocket( InetAddress inaddr, int i) throws IOException 94 { 95 return factory.createSocket( inaddr, i); 96 } 97 98 public Socket createSocket( String s, int i, InetAddress inaddr, int j) throws IOException 99 { 100 return factory.createSocket( s, i, inaddr, j); 101 } 102 103 public Socket createSocket( String s, int i) throws IOException 104 { 105 return factory.createSocket( s, i); 106 } 107 108 public String [] getDefaultCipherSuites() 109 { 110 return factory.getSupportedCipherSuites(); 111 } 112 113 public String [] getSupportedCipherSuites() 114 { 115 return factory.getSupportedCipherSuites(); 116 } 117 } | Popular Tags |