/*
* @(#)file SslRMIClientSocketFactory.java
* @(#)author Sun Microsystems, Inc.
* @(#)version 1.17
* @(#)date 05/11/17
*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package javax.rmi.ssl;
import java.io.IOException;
import java.io.Serializable;
import java.net.Socket;
import java.rmi.server.RMIClientSocketFactory;
import java.util.StringTokenizer;
import javax.net.SocketFactory;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
/**
* <p>An <code>SslRMIClientSocketFactory</code> instance is used by the RMI
* runtime in order to obtain client sockets for RMI calls via SSL.</p>
*
* <p>This class implements <code>RMIClientSocketFactory</code> over
* the Secure Sockets Layer (SSL) or Transport Layer Security (TLS)
* protocols.</p>
*
* <p>This class creates SSL sockets using the default
* <code>SSLSocketFactory</code> (see {@link
* SSLSocketFactory#getDefault}). All instances of this class are
* functionally equivalent. In particular, they all share the same
* truststore, and the same keystore when client authentication is
* required by the server. This behavior can be modified in
* subclasses by overriding the {@link #createSocket(String,int)}
* method; in that case, {@link #equals(Object) equals} and {@link
* #hashCode() hashCode} may also need to be overridden.</p>
*
* <p>If the system property
* <code>javax.rmi.ssl.client.enabledCipherSuites</code> is specified,
* the {@link #createSocket(String,int)} method will call {@link
* SSLSocket#setEnabledCipherSuites(String[])} before returning the
* socket. The value of this system property is a string that is a
* comma-separated list of SSL/TLS cipher suites to enable.</p>
*
* <p>If the system property
* <code>javax.rmi.ssl.client.enabledProtocols</code> is specified,
* the {@link #createSocket(String,int)} method will call {@link
* SSLSocket#setEnabledProtocols(String[])} before returning the
* socket. The value of this system property is a string that is a
* comma-separated list of SSL/TLS protocol versions to enable.</p>
*
* @see javax.net.ssl.SSLSocketFactory
* @see javax.rmi.ssl.SslRMIServerSocketFactory
* @since 1.5
*/
public class SslRMIClientSocketFactory
implements RMIClientSocketFactory, Serializable {
/**
* <p>Creates a new <code>SslRMIClientSocketFactory</code>.</p>
*/
public SslRMIClientSocketFactory() {
// We don't force the initialization of the default SSLSocketFactory
// at construction time - because the RMI client socket factory is
// created on the server side, where that initialization is a priori
// meaningless, unless both server and client run in the same JVM.
// We could possibly override readObject() to force this initialization,
// but it might not be a good idea to actually mix this with possible
// deserialization problems.
// So contrarily to what we do for the server side, the initialization
// of the SSLSocketFactory will be delayed until the first time
// createSocket() is called - note that the default SSLSocketFactory
// might already have been initialized anyway if someone in the JVM
// already called SSLSocketFactory.getDefault().
//
}
/**
* <p>Creates an SSL socket.</p>
*
* <p>If the system property
* <code>javax.rmi.ssl.client.enabledCipherSuites</code> is
* specified, this method will call {@link
* SSLSocket#setEnabledCipherSuites(String[])} before returning
* the socket. The value of this system property is a string that
* is a comma-separated list of SSL/TLS cipher suites to
* enable.</p>
*
* <p>If the system property
* <code>javax.rmi.ssl.client.enabledProtocols</code> is
* specified, this method will call {@link
* SSLSocket#setEnabledProtocols(String[])} before returning the
* socket. The value of this system property is a string that is a
* comma-separated list of SSL/TLS protocol versions to
* enable.</p>
*/
public Socket createSocket(String host, int port) throws IOException {
// Retrieve the SSLSocketFactory
=1= |