|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.net.ServerSocket | +--javax.net.ssl.SSLServerSocket | +--de.tu_darmstadt.sp.ssl.SSLeayServerSocket
Class SSLServerSocket is a implementation of the SSLSocket
abstract class. A SSLeayServerSocket
is used to create
SSLSocket
objects through its accept
method.
These sockets are the server side SSLSockets. The server side
SSL Sockets are usual SSLSockets
, except they have different
SSL protocol policies (i.e. they may not require client authentication).
Several SSLServerSocket
methods may be employed to control
the type and behavior of the server side sockets created by accept
.
These are:
The method setEnableAcceptHandshake
controls whether the
created server side sockets delivered by accept
are
already in the handshaking sequence or not.
The server side sockets are SSLSockets and thus need a
SSLeaySessionContext
for their sessions. Every
SSLeayServerSocket
uses a SSLeaySessionContext
for the server side sockets it creates.
The SSLeaySessionContext
can be specified only when constructing a
SSLeayServerSocket
.
Field Summary | |
protected SSLeaySessionContext |
context
|
protected java.lang.Class |
socketPrototypeClass
|
Constructor Summary | |
SSLeayServerSocket(int port,
int backlog,
java.net.InetAddress bindAddr,
SSLeaySessionContext ctx)
Create a TCP server socket on a port, using the default authentication context and a specified backlog of connections as well as a particular specified network interface. |
|
SSLeayServerSocket(int port,
int backlog,
SSLeaySessionContext ctx)
Create a TCP server socket on a port, using the default authentication context and a specified backlog of connections. |
|
SSLeayServerSocket(int port,
SSLeaySessionContext ctx)
Create a TCP server socket on a port, using the default authentication context. |
Method Summary | |
java.net.Socket |
accept()
Listens for a connection to be made to this socket and accepts it. |
boolean |
getEnabelAcceptHandshake()
|
java.lang.String[] |
getEnabledCipherSuites()
|
boolean |
getEnableSessionCreation()
Returns true if new SSL sessions may be established by the server side sockets created by this socket. |
boolean |
getNeedClientAuth()
Returns true if client authentication is required on newly accepted connection |
java.lang.Class |
getSocketPrototypeClass()
Return the class of the prototype this server socket uses to accept connections. |
java.lang.String[] |
getSupportedCipherSuites()
|
boolean |
getUseClientMode()
Returns true if accepted connections will be in SSL
client mode. |
void |
setEnableAcceptHandshake(boolean flag)
Controls whether the last action of the accept
method is the handshake initiation of the newly created server side sockets. |
void |
setEnabledCipherSuites(java.lang.String[] ciphers)
|
void |
setEnableSessionCreation(boolean flag)
Controls whether new SSL sessions may be established by the server side sockets created by this socket. |
void |
setNeedClientAuth(boolean flag)
Controls whether the connections which are accepted must include client authentication.By default, clients do not need to provide authentication information . |
protected void |
setSocketPrototype(SSLeaySocket proto)
Set the prototype of sockets the accept methods produces. |
void |
setUseClientMode(boolean mode)
Controls whether accepted connections are in the (default) SSL server mode, or the SSL client mode. |
Methods inherited from class java.net.ServerSocket |
close,
getInetAddress,
getLocalPort,
getSoTimeout,
implAccept,
setSocketFactory,
setSoTimeout,
toString |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected SSLeaySessionContext context
protected java.lang.Class socketPrototypeClass
Constructor Detail |
public SSLeayServerSocket(int port, SSLeaySessionContext ctx) throws java.io.IOException
port
- the port number, or 0
to use any free port.ctx
- the SSLeaySessionContext
for the server side sockets created
by this server socketctx
is null
.public SSLeayServerSocket(int port, int backlog, SSLeaySessionContext ctx) throws java.io.IOException
port
- the specified port, or 0
to use any free port.backlog
- the maximum length of the queue.ctx
- the SSLeaySessionContext
for the server side sockets created
by this server socketctx
is null
.public SSLeayServerSocket(int port, int backlog, java.net.InetAddress bindAddr, SSLeaySessionContext ctx) throws java.io.IOException
The handshake of the accepted connections will be performed by default
in server mode. Use the setUseClientMode
method
to change this behavior.
port
- the local TCP portbacklog
- the listen backlogbindAddr
- the local InetAddress the server will bind toctx
- the SSLeaySessionContext
for the server side sockets created
by this server socketctx
is null
.Method Detail |
public java.net.Socket accept() throws java.io.IOException
enableAcceptHandshake
) the created
socket will negotiate a SSL
connection. Depending
the value of useClientMode
the connection will
be negotiated in server mode (useClientMode=false
or
in client mode useClientMode=true
.
The type of returned socket depends on the prototype specified
in the setSocketPrototype
method.
public void setUseClientMode(boolean mode)
mode
- - true
if newly accepted connections
should use SSL client mode.public boolean getUseClientMode()
true
if accepted connections will be in SSL
client mode.true
if the connection should use SSL client mode.public void setNeedClientAuth(boolean flag)
flag
- - true if the clients must authenticate themselves.public boolean getNeedClientAuth()
public java.lang.String[] getSupportedCipherSuites()
public void setEnabledCipherSuites(java.lang.String[] ciphers)
public java.lang.String[] getEnabledCipherSuites()
public void setEnableSessionCreation(boolean flag)
flag
- true
the server side sockets are to
establish new connections.public boolean getEnableSessionCreation()
true
if the server side sockets are to
establish new connections.public void setEnableAcceptHandshake(boolean flag)
accept
method is the handshake initiation of the newly created server side sockets.flag
- if true
, the last action in accept is
startHandshake
for the new server side socketpublic boolean getEnabelAcceptHandshake()
protected void setSocketPrototype(SSLeaySocket proto)
accept
methods produces.
This is actually a template method, which enables further extensions
of SSLeayServerSocket
to accept connections using other
type of sockets than the default.
This method should be used in constructors.
proto
- an unconnected SSLeaySocket
proto
is null
public java.lang.Class getSocketPrototypeClass()
setSocketPrototype
method.accept
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |