public abstract class SSLFactory
extends java.lang.Object
The getInstance()
method is used to get an implementation of this class.
This exists primarily to allow use to use various SSL providers that are accessed via introspection. This allows us to not require that a. the classes be present even when not used, and b. to use Java 2 classes without impacting the requirement that DirXML run under Java 1.1.7B on Netware 5.
Modifier and Type | Field and Description |
---|---|
protected static int |
DEFAULT
Used with
useClientMode and needClientAuth |
protected static int |
FALSE
Used with
useClientMode and needClientAuth |
protected int |
needClientAuth
Specifies if sockets performing server handshake need to authenticate
the other side.
|
protected static int |
TRUE
Used with
useClientMode and needClientAuth |
protected int |
useClientMode
Specifies handshake mode for sockets created by this factory.
|
Constructor and Description |
---|
SSLFactory() |
Modifier and Type | Method and Description |
---|---|
abstract java.net.ServerSocket |
createServerSocket(int port)
Returns a server socket which uses all network interfaces on
the host, and is bound to the specified port.
|
abstract java.net.ServerSocket |
createServerSocket(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.
|
abstract java.net.ServerSocket |
createServerSocket(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.
|
abstract java.net.Socket |
createSocket(java.net.InetAddress host,
int port)
Returns a socket connected to a ServerSocket at the specified
network address and port.
|
abstract java.net.Socket |
createSocket(java.net.InetAddress host,
int port,
java.net.InetAddress clientAddress,
int clientPort)
Returns a socket connected to a ServerSocket at the specified
network address and port.
|
abstract java.net.Socket |
createSocket(java.lang.String host,
int port)
Returns a socket connected to a ServerSocket at the specified
network address and port.
|
abstract java.net.Socket |
createSocket(java.lang.String host,
int port,
java.net.InetAddress clientAddress,
int clientPort)
Returns a socket connected to a ServerSocket at the specified
network address and port.
|
static SSLFactory |
getInstance(java.lang.String type)
Return an instance of SSLFactory based on the passed type
String . |
abstract java.lang.String |
getSSLDescription(java.net.Socket socket)
Returns a String describing basic SSL connections parameters where available.
|
abstract java.lang.String |
getSSLVerboseDescription(java.net.Socket socket)
Returns a String describing verbose SSL connections parameters where available.
|
void |
setNeedClientAuth(boolean needClientAuth)
Specify if a socket performing the server mode handshake will require
the client to authenticate.
|
void |
setUseClientMode(boolean useClientMode)
Specify whether to use client or server mode for the initial SSL
handshake.
|
protected int useClientMode
DEFAULT
, TRUE
, or FALSE
.protected int needClientAuth
DEFAULT
, TRUE
, or FALSE
.protected static final int FALSE
useClientMode
and needClientAuth
protected static final int TRUE
useClientMode
and needClientAuth
protected static final int DEFAULT
useClientMode
and needClientAuth
public static SSLFactory getInstance(java.lang.String type) throws java.lang.IllegalArgumentException, SSLInitializationException
String
.
Valid values for type
are:
"kmo" - returns a factory that implements KmoSSLFactory
and returns
sockets that use Novell's SAS SSL implementation. Certificates and keys
are used from eDirectory Key Material Objects.
"keystore" - returns a factory that implements KeyStoreSSLFactory
and
returns sockets that use Sun's JSSE SSL implementation. Certificates and
keys are used from a Java KeyStore object, stored as a file.
type
- "kmo" or "keystore"java.lang.IllegalArgumentException
- if type
value is invalid.SSLInitializationException
- thrown if an error occurs creating the factorypublic void setUseClientMode(boolean useClientMode)
useClientMode
- true
if sockets from this factory should use
client mode handshakes.public void setNeedClientAuth(boolean needClientAuth)
needClientAuth
- true
if client authentication is to be required.public abstract java.net.ServerSocket createServerSocket(int port) throws java.io.IOException
port
- the port to listen tojava.io.IOException
- for networking errorspublic abstract java.net.ServerSocket createServerSocket(int port, int backlog) throws java.io.IOException
port
- the port to listen tobacklog
- how many connections are queuedjava.io.IOException
- for networking errorspublic abstract java.net.ServerSocket createServerSocket(int port, int backlog, java.net.InetAddress ifAddress) throws java.io.IOException
port
- the port to listen tobacklog
- how many connections are queuedifAddress
- the network interface address to usejava.io.IOException
- for networking errorspublic abstract java.net.Socket createSocket(java.net.InetAddress host, int port) throws java.io.IOException
host
- the server hostport
- the server portjava.io.IOException
- if the connection can't be establishedpublic abstract java.net.Socket createSocket(java.net.InetAddress host, int port, java.net.InetAddress clientAddress, int clientPort) throws java.io.IOException
host
- the server hostport
- the server portclientAddress
- the client network interface addressclientPort
- the client portjava.io.IOException
- if the connection can't be establishedpublic abstract java.net.Socket createSocket(java.lang.String host, int port) throws java.io.IOException, java.net.UnknownHostException
host
- the server hostport
- the server portjava.io.IOException
- if the connection can't be establishedjava.net.UnknownHostException
- if the host name can't be resolvedpublic abstract java.net.Socket createSocket(java.lang.String host, int port, java.net.InetAddress clientAddress, int clientPort) throws java.io.IOException, java.net.UnknownHostException
host
- the server hostport
- the server portclientAddress
- the client network interface addressclientPort
- the client portjava.io.IOException
- if the connection can't be establishedjava.net.UnknownHostException
- if the host name can't be resolvedpublic abstract java.lang.String getSSLDescription(java.net.Socket socket) throws java.lang.ClassCastException
socket
- a Socket returned by this SSLFactory instance's createSocket(),
or by ServerSocket.accept() where the ServerSocket was returned by this SSLFactory
instance's createServerSocket().java.lang.ClassCastException
- thrown if the passed Socket is not of a type supported
by this SSLFactory.public abstract java.lang.String getSSLVerboseDescription(java.net.Socket socket) throws java.lang.ClassCastException
socket
- a Socket returned by this SSLFactory instance's createSocket(),
or by ServerSocket.accept() where the ServerSocket was returned by this SSLFactory
instance's createServerSocket().java.lang.ClassCastException
- thrown if the passed Socket is not of a type supported
by this SSLFactory.