org.apache.tomcat.util.net.jsse
Class JSSESocketFactory

java.lang.Object
  extended byorg.apache.tomcat.util.net.ServerSocketFactory
      extended byorg.apache.tomcat.util.net.jsse.JSSESocketFactory
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
JSSE14SocketFactory

public abstract class JSSESocketFactory
extends ServerSocketFactory

SSL server socket factory. It _requires_ a valid RSA key and JSSE.

Author:
Harish Prabandham, Costin Manolache, Stefan Freyr Stefansson, EKR -- renamed to JSSESocketFactory

Field Summary
protected  boolean allowUnsafeLegacyRenegotiation
           
protected  java.lang.String clientAuth
           
protected  java.lang.String[] enabledCiphers
           
protected  boolean initialized
           
protected static boolean RFC_5746_SUPPORTED
           
protected  javax.net.ssl.SSLServerSocketFactory sslProxy
           
 
Fields inherited from class org.apache.tomcat.util.net.ServerSocketFactory
attributes
 
Constructor Summary
JSSESocketFactory()
           
 
Method Summary
 java.net.Socket acceptSocket(java.net.ServerSocket socket)
          Wrapper function for accept().
protected  void checkConfig()
          Checks that the certificate is compatible with the enabled cipher suites.
protected abstract  void configureClientAuth(javax.net.ssl.SSLServerSocket socket)
          Configure Client authentication for this version of JSSE.
protected abstract  void configureClientAuth(javax.net.ssl.SSLSocket socket)
          Configure Client authentication for this version of JSSE.
 java.net.ServerSocket createSocket(int port)
          Returns a server socket which uses all network interfaces on the host, and is bound to a the specified port.
 java.net.ServerSocket createSocket(int port, int backlog)
          Returns a server socket which uses all network interfaces on the host, is bound to a the specified port, and uses the specified connection backlog.
 java.net.ServerSocket createSocket(int port, int backlog, java.net.InetAddress ifAddress)
          Returns a server socket which uses only the specified network interface on the local host, is bound to a the specified port, and uses the specified connection backlog.
protected  java.lang.String[] getEnabledCiphers(java.lang.String requestedCiphers, java.lang.String[] supportedCiphers)
           
protected abstract  java.lang.String[] getEnabledProtocols(javax.net.ssl.SSLServerSocket socket, java.lang.String requestedProtocols)
           
protected  java.security.KeyStore getKeystore(java.lang.String type, java.lang.String pass)
           
protected  java.lang.String getKeystorePassword()
           
protected  java.security.KeyStore getTrustStore(java.lang.String keystoreType)
           
 void handshake(java.net.Socket sock)
          Extra function to initiate the handshake.
protected abstract  void setEnabledProtocols(javax.net.ssl.SSLServerSocket socket, java.lang.String[] protocols)
          Set the SSL protocol variants to be enabled.
 
Methods inherited from class org.apache.tomcat.util.net.ServerSocketFactory
getDefault, initSocket, setAttribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

initialized

protected boolean initialized

clientAuth

protected java.lang.String clientAuth

sslProxy

protected javax.net.ssl.SSLServerSocketFactory sslProxy

enabledCiphers

protected java.lang.String[] enabledCiphers

allowUnsafeLegacyRenegotiation

protected boolean allowUnsafeLegacyRenegotiation

RFC_5746_SUPPORTED

protected static final boolean RFC_5746_SUPPORTED
Constructor Detail

JSSESocketFactory

public JSSESocketFactory()
Method Detail

createSocket

public java.net.ServerSocket createSocket(int port)
                                   throws java.io.IOException
Description copied from class: ServerSocketFactory
Returns a server socket which uses all network interfaces on the host, and is bound to a the specified port. The socket is configured with the socket options (such as accept timeout) given to this factory.

Specified by:
createSocket in class ServerSocketFactory
Parameters:
port - the port to listen to
Throws:
java.io.IOException - for networking errors

createSocket

public java.net.ServerSocket createSocket(int port,
                                          int backlog)
                                   throws java.io.IOException
Description copied from class: ServerSocketFactory
Returns a server socket which uses all network interfaces on the host, is bound to a the specified port, and uses the specified connection backlog. The socket is configured with the socket options (such as accept timeout) given to this factory.

Specified by:
createSocket in class ServerSocketFactory
Parameters:
port - the port to listen to
backlog - how many connections are queued
Throws:
java.io.IOException - for networking errors

createSocket

public java.net.ServerSocket createSocket(int port,
                                          int backlog,
                                          java.net.InetAddress ifAddress)
                                   throws java.io.IOException
Description copied from class: ServerSocketFactory
Returns a server socket which uses only the specified network interface on the local host, is bound to a the specified port, and uses the specified connection backlog. The socket is configured with the socket options (such as accept timeout) given to this factory.

Specified by:
createSocket in class ServerSocketFactory
Parameters:
port - the port to listen to
backlog - how many connections are queued
ifAddress - the network interface address to use
Throws:
java.io.IOException - for networking errors

acceptSocket

public java.net.Socket acceptSocket(java.net.ServerSocket socket)
                             throws java.io.IOException
Description copied from class: ServerSocketFactory
Wrapper function for accept(). This allows us to trap and translate exceptions if necessary

Specified by:
acceptSocket in class ServerSocketFactory
Throws:
java.io.IOException

handshake

public void handshake(java.net.Socket sock)
               throws java.io.IOException
Description copied from class: ServerSocketFactory
Extra function to initiate the handshake. Sometimes necessary for SSL

Specified by:
handshake in class ServerSocketFactory
Throws:
java.io.IOException

getEnabledCiphers

protected java.lang.String[] getEnabledCiphers(java.lang.String requestedCiphers,
                                               java.lang.String[] supportedCiphers)

getKeystorePassword

protected java.lang.String getKeystorePassword()

getKeystore

protected java.security.KeyStore getKeystore(java.lang.String type,
                                             java.lang.String pass)
                                      throws java.io.IOException
Throws:
java.io.IOException

getTrustStore

protected java.security.KeyStore getTrustStore(java.lang.String keystoreType)
                                        throws java.io.IOException
Throws:
java.io.IOException

getEnabledProtocols

protected abstract java.lang.String[] getEnabledProtocols(javax.net.ssl.SSLServerSocket socket,
                                                          java.lang.String requestedProtocols)

setEnabledProtocols

protected abstract void setEnabledProtocols(javax.net.ssl.SSLServerSocket socket,
                                            java.lang.String[] protocols)
Set the SSL protocol variants to be enabled.

Parameters:
socket - the SSLServerSocket.
protocols - the protocols to use.

configureClientAuth

protected abstract void configureClientAuth(javax.net.ssl.SSLServerSocket socket)
Configure Client authentication for this version of JSSE. The JSSE included in Java 1.4 supports the 'want' value. Prior versions of JSSE will treat 'want' as 'false'.

Parameters:
socket - the SSLServerSocket

configureClientAuth

protected abstract void configureClientAuth(javax.net.ssl.SSLSocket socket)
Configure Client authentication for this version of JSSE. The JSSE included in Java 1.4 supports the 'want' value. Prior versions of JSSE will treat 'want' as 'false'.

Parameters:
socket - the SSLSocket

checkConfig

protected void checkConfig()
                    throws java.io.IOException
Checks that the certificate is compatible with the enabled cipher suites. If we don't check now, the JIoEndpoint can enter a nasty logging loop. See bug 45528.

Throws:
java.io.IOException


Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.