BEA Systems, Inc.

WebLogic Server 8.1 API Reference

weblogic.security.SSL
Class SSLSocketFactory

java.lang.Object
  |
  +--javax.net.SocketFactory
        |
        +--weblogic.security.SSL.SSLSocketFactory

public class SSLSocketFactory
extends javax.net.SocketFactory

Delegates to SSLSocketFactory requests to create SSL sockets.

Note: This SSLSocketFactory cannot be plugged into JSSE because the getDefault() method used by JSSE returns an instance initialized to use the old Phaos SSL implementation, instead of the Certicom SSL implementation currently used by the server. The Phaos implementation does not allow you to configure the trusted certificates, while Certicom's would be configured according to the server SSL trust configuration. If you really need to access the Certicom implementation from JSSE, you can extend the javax.net.SocketFactory class and implement its getDefault() method to return an instance of your class that wraps the SocketFactory instance returned by the weblogic.security.SSL.SSLSocketFactory.getDefaultJSSE() method. The following code example shows how to extend the javax.net.SocketFactory class to access the Certicom implementation from JSSE:

 public class MySSLSocketFactory extends javax.net.SocketFactory {
  private static MySSLSocketFactory defFactory;
  private javax.net.SocketFactory factory;

  private MySSLSocketFactory() {
   factory = weblogic.security.SSL.SSLSocketFactory.getDefaultJSSE();
  }

  public static javax.net.SocketFactory getDefault() { 
  if (defFactory == null) defFactory = new MySSLSocketFactory(); 
  return defFactory; 
  }

  public Socket createSocket(InetAddress host, int port) throws IOException { 

  return factory.createSocket(host, port); 
  }

  // implement the other three abstract createSocket methods the same way 
  ... 
 }
 

Author:
Copyright © 2004 BEA Systems, Inc. All Rights Reserved.

Method Summary
 java.net.Socket createSocket(java.net.InetAddress address, int port)
          Returns a socket connected to a ServerSocket at the specified network address and port.
 java.net.Socket createSocket(java.net.InetAddress address, int port, java.net.InetAddress clientAddress, int clientPort)
          Returns a socket connected to a ServerSocket at the specified network address and port.
 java.net.Socket createSocket(java.net.Socket socket, java.lang.String host, int port, boolean autoClose)
          Returns a socket layered over an existing socket to a ServerSocket on the named host, at the given port.
 java.net.Socket createSocket(java.lang.String host, int port)
          Returns a socket connected to a ServerSocket on the named host, at the given port.
 java.net.Socket createSocket(java.lang.String host, int port, java.net.InetAddress clientAddress, int clientPort)
          Returns a socket connected to a ServerSocket on the named host, at the given port.
static javax.net.SocketFactory getDefault()
          Deprecated. Deprecated in WebLogic Server 7.0. This method returns the legacy SSLSocketFactory so use the getDefaultJSSE() method instead.
 java.lang.String[] getDefaultCipherSuites()
          Returns the list of cipher suites which are enabled by default.
static javax.net.SocketFactory getDefaultJSSE()
          Returns the default SSL socket factory.
 java.lang.String[] getSupportedCipherSuites()
          Returns the names of the cipher suites which could be enabled for use on an SSL connection.
 
Methods inherited from class javax.net.SocketFactory
createSocket
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getDefault

public static javax.net.SocketFactory getDefault()
Deprecated. Deprecated in WebLogic Server 7.0. This method returns the legacy SSLSocketFactory so use the getDefaultJSSE() method instead.

getDefaultJSSE

public static javax.net.SocketFactory getDefaultJSSE()
Returns the default SSL socket factory.

createSocket

public java.net.Socket createSocket(java.net.Socket socket,
                                    java.lang.String host,
                                    int port,
                                    boolean autoClose)
                             throws java.net.UnknownHostException,
                                    java.io.IOException
Returns a socket layered over an existing socket to a ServerSocket on the named host, at the given port. This constructor can be used when tunneling SSL through a proxy. The host and port refer to the logical destination server. This socket is configured using the socket options established for this factory.

Parameters:
socket - the existing socket
host - the server host
port - the server port
autoClose - close the underlying socket when this socket is closed
Throws:
java.io.IOException - if the connection can't be established
java.net.UnknownHostException - if the host is not known

createSocket

public java.net.Socket createSocket(java.lang.String host,
                                    int port)
                             throws java.net.UnknownHostException,
                                    java.io.IOException
Returns a socket connected to a ServerSocket on the named host, at the given port. This socket is configured using the socket options established for this factory.

Parameters:
host - the server host
port - the server port
Throws:
java.io.IOException - if the connection can't be established
java.net.UnknownHostException - if the host is not known
Overrides:
createSocket in class javax.net.SocketFactory

createSocket

public java.net.Socket createSocket(java.net.InetAddress address,
                                    int port)
                             throws java.net.UnknownHostException,
                                    java.io.IOException
Returns a socket connected to a ServerSocket at the specified network address and port. This socket is configured using the socket options established for this factory.

Parameters:
address - the server network address
port - the server port
Throws:
java.io.IOException - if the connection can't be established
java.net.UnknownHostException - if the host is not known
Overrides:
createSocket in class javax.net.SocketFactory

createSocket

public java.net.Socket createSocket(java.lang.String host,
                                    int port,
                                    java.net.InetAddress clientAddress,
                                    int clientPort)
                             throws java.net.UnknownHostException,
                                    java.io.IOException
Returns a socket connected to a ServerSocket on the named host, at the given port. The client is bound to the specified network address and port, and the socket is configured using the socket options established for this factory.

Parameters:
host - the server host
port - the server port
clientAddress - the client network address
clientPort - the client port
Throws:
java.io.IOException - if the connection can't be established
java.net.UnknownHostException - if the host is not known
Overrides:
createSocket in class javax.net.SocketFactory

createSocket

public java.net.Socket createSocket(java.net.InetAddress address,
                                    int port,
                                    java.net.InetAddress clientAddress,
                                    int clientPort)
                             throws java.net.UnknownHostException,
                                    java.io.IOException
Returns a socket connected to a ServerSocket at the specified network address and port. The client is bound to the specified network address and port, and the socket is configured using the socket options established for this factory.

Parameters:
address - the server network address
port - the server port
clientAddress - the client network address
clientPort - the client port
Throws:
java.io.IOException - if the connection can't be established
java.net.UnknownHostException - if the host is not known
Overrides:
createSocket in class javax.net.SocketFactory

getDefaultCipherSuites

public java.lang.String[] getDefaultCipherSuites()
Returns the list of cipher suites which are enabled by default. Unless a different list is enabled, handshaking on an SSL connection will use one of these cipher suites. The minimum quality of service for these defaults requires confidentiality protection and server authentication.

Returns:
array of the cipher suites enabled by default
See Also:
getSupportedCipherSuites()

getSupportedCipherSuites

public java.lang.String[] getSupportedCipherSuites()
Returns the names of the cipher suites which could be enabled for use on an SSL connection. Normally, only a subset of these will actually be enabled by default, since this list may include cipher suites which do not meet quality of service requirements for those defaults. Such cipher suites are useful in specialized applications.

Returns:
an array of cipher suite names

Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs81