FileDocCategorySizeDatePackage
SSLSocketFactory.javaAPI DocGlassfish v2 API5854Fri May 04 22:36:20 BST 2007com.sun.web.security

SSLSocketFactory

public class SSLSocketFactory extends Object implements org.apache.catalina.net.ServerSocketFactory
SSL server socket factory.
author
Harish Prabandham
author
Vivek Nagar
author
Harpreet Singh

Fields Summary
static Logger
_logger
private static final boolean
clientAuth
private static com.sun.enterprise.util.LocalStringManagerImpl
localStrings
private SSLContext
context
private SSLServerSocketFactory
factory
private String[]
cipherSuites
private static SecureRandom
sr
private static KeyManager[]
keyManagers
private static TrustManager[]
trustManagers
Constructors Summary
public SSLSocketFactory()
Create the SSL socket factory. Initialize the key managers and trust managers which are passed to the SSL context.



                            
       
	try {
	    if(keyManagers == null || trustManagers == null) {
		SSLUtils.initStoresAtStartup();
	    }
	    context = SSLContext.getInstance("TLS");
	    context.init(keyManagers, trustManagers, sr);

	    factory = context.getServerSocketFactory();
	    cipherSuites = factory.getSupportedCipherSuites();
	    
            for(int i=0; i < cipherSuites.length; ++i) {
                if (_logger.isLoggable(Level.FINEST)) {
                    _logger.log(Level.FINEST,"Suite: " + cipherSuites[i]);
                }
	    }
            
	} catch(Exception e) {
	  _logger.log(Level.SEVERE,
                      "web_security.excep_sslsockfact", e.getMessage());
	}
    
Methods Summary
public java.net.ServerSocketcreateSocket(int port)
Create the socket at the specified port.

param
the port number.
return
the SSL server socket.

	SSLServerSocket socket = 
	    (SSLServerSocket) factory.createServerSocket(port);
	init(socket);
	return socket;
    
public java.net.ServerSocketcreateSocket(int port, int backlog)
Create the socket at the specified port.

param
the port number.
return
the SSL server socket.

	SSLServerSocket socket = (SSLServerSocket)
	    factory.createServerSocket(port, backlog);
	init(socket);
	return socket;
    
public java.net.ServerSocketcreateSocket(int port, int backlog, java.net.InetAddress ifAddress)
Create the socket at the specified port.

param
the port number.
return
the SSL server socket.

	SSLServerSocket socket = (SSLServerSocket)
	    factory.createServerSocket(port, backlog, ifAddress);
	init(socket);
	return socket;
    
private voidinit(javax.net.ssl.SSLServerSocket socket)
Specify whether the server will require client authentication.

param
the SSL server socket.

	// Some initialization goes here.....
	// socket.setEnabledCipherSuites(cipherSuites);
	socket.setNeedClientAuth(clientAuth);
    
public static voidsetManagers(javax.net.ssl.KeyManager[] kmgrs, javax.net.ssl.TrustManager[] tmgrs)

        keyManagers = kmgrs;
        trustManagers = tmgrs;