public class SSLServerSocket
extends java.net.ServerSocket
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BACKLOG
The default size of the listen queue.
|
| Constructor and Description |
|---|
SSLServerSocket(int port)
Creates a server socket listening on the given port.
|
SSLServerSocket(int port,
int backlog)
Creates a server socket listening on the given port.
|
SSLServerSocket(int port,
int backlog,
java.net.InetAddress bindAddr)
Creates a server socket listening on the given port.
|
SSLServerSocket(int port,
int backlog,
java.net.InetAddress bindAddr,
SSLCertificateApprovalCallback certApprovalCallback)
Creates a server socket listening on the given port.
|
SSLServerSocket(int port,
int backlog,
java.net.InetAddress bindAddr,
SSLCertificateApprovalCallback certApprovalCallback,
boolean reuseAddr)
Creates a server socket listening on the given port.
|
| Modifier and Type | Method and Description |
|---|---|
java.net.Socket |
accept()
Accepts a connection.
|
void |
bypassPKCS11(boolean enable)
Enables the bypass of PKCS11 for performance on this socket.
|
static void |
clearSessionCache()
Empties the SSL client session ID cache.
|
void |
close()
Closes this socket.
|
static void |
configServerSessionIDCache(int maxSidEntries,
int ssl2EntryTimeout,
int ssl3EntryTimeout,
java.lang.String cacheFileDirectory)
Configures the session ID cache.
|
void |
enableFDX(boolean enable)
Enable simultaneous read/write by separate read and write threads
(full duplex) for this socket.
|
void |
enableRollbackDetection(boolean enable)
Enable rollback detection for this socket.
|
void |
enableSSL2(boolean enable)
Enables SSL v2 on this socket.
|
void |
enableSSL3(boolean enable)
Enables SSL v3 on this socket.
|
void |
enableStepDown(boolean enable)
This option, enableStepDown, is concerned with the generation
of step-down keys which are used with export suites.
|
void |
enableTLS(boolean enable)
Enables TLS on this socket.
|
void |
enableV2CompatibleHello(boolean enable)
Enable sending v3 client hello in v2 format for this socket.
|
protected void |
finalize() |
java.net.InetAddress |
getInetAddress() |
int |
getLocalPort() |
boolean |
getReuseAddress() |
int |
getSoTimeout()
Returns the current value of the SO_TIMEOUT socket option.
|
java.lang.String |
getSSLOptions() |
void |
requestClientAuth(boolean b)
Enables/disables the request of client authentication.
|
void |
requireClientAuth(boolean require,
boolean onRedo)
Deprecated.
use requireClientAuth(int)
|
void |
requireClientAuth(int mode)
Sets whether the socket requires client authentication from the remote
peer.
|
void |
setClientCert(X509Certificate cert)
Sets the certificate to use for client authentication.
|
void |
setClientCertNickname(java.lang.String nick)
Sets the nickname of the certificate to use for client authentication.
|
void |
setNeedClientAuth(boolean b)
Deprecated.
As of JSS 3.0. This method is misnamed. Use
requestClientAuth instead. |
void |
setNeedClientAuthNoExpiryCheck(boolean b)
Deprecated.
As of JSS 3.0. This method is misnamed. Use
requestClientAuthNoExpiryCheck instead. |
void |
setReuseAddress(boolean reuse) |
void |
setServerCert(X509Certificate certnickname)
Sets the certificate to use for server authentication.
|
void |
setServerCertNickname(java.lang.String nick)
Sets the certificate to use for server authentication.
|
void |
setSoTimeout(int timeout)
Sets the SO_TIMEOUT socket option.
|
void |
setUseClientMode(boolean b)
Determines whether this end of the socket is the client or the server
for purposes of the SSL protocol.
|
java.lang.String |
toString()
Returns the addresses and ports of this socket
or an error message if the socket is not in a valid state.
|
void |
useCache(boolean b)
Enables/disables the session cache.
|
public static final int DEFAULT_BACKLOG
public SSLServerSocket(int port)
throws java.io.IOException
java.io.IOExceptionpublic SSLServerSocket(int port,
int backlog)
throws java.io.IOException
backlog - The size of the socket's listen queue.java.io.IOExceptionpublic SSLServerSocket(int port,
int backlog,
java.net.InetAddress bindAddr)
throws java.io.IOException
backlog - The size of the socket's listen queue.bindAddr - The local address to which to bind. If null, an
unspecified local address will be bound to.java.io.IOExceptionpublic SSLServerSocket(int port,
int backlog,
java.net.InetAddress bindAddr,
SSLCertificateApprovalCallback certApprovalCallback)
throws java.io.IOException
backlog - The size of the socket's listen queue.bindAddr - The local address to which to bind. If null, an
unspecified local address will be bound to.certApprovalCallback - Will get called to approve any certificate
presented by the client.java.io.IOExceptionpublic SSLServerSocket(int port,
int backlog,
java.net.InetAddress bindAddr,
SSLCertificateApprovalCallback certApprovalCallback,
boolean reuseAddr)
throws java.io.IOException
backlog - The size of the socket's listen queue.bindAddr - The local address to which to bind. If null, an
unspecified local address will be bound to.certApprovalCallback - Will get called to approve any certificate
presented by the client.reuseAddr - Reuse the local bind port; this parameter sets
the SO_REUSEADDR option on the socket before calling
bind(). The default is false for backward
compatibility.java.io.IOExceptionpublic java.net.Socket accept()
throws java.io.IOException
accept in class java.net.ServerSocketjava.io.IOException - If an input or output exception occurredjava.net.SocketTimeoutException - If the socket timesout trying to connectInterruptedIOException - If an input or output is interruptedSSLSocketException - JSS subclass of java.net.SocketExceptionpublic void setSoTimeout(int timeout)
setSoTimeout in class java.net.ServerSockettimeout - The timeout time in milliseconds.public int getSoTimeout()
getSoTimeout in class java.net.ServerSocketpublic void setReuseAddress(boolean reuse)
throws java.net.SocketException
setReuseAddress in class java.net.ServerSocketjava.net.SocketExceptionpublic boolean getReuseAddress()
throws java.net.SocketException
getReuseAddress in class java.net.ServerSocketjava.net.SocketExceptionpublic static void clearSessionCache()
protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwablepublic int getLocalPort()
getLocalPort in class java.net.ServerSocketpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.net.ServerSocketjava.io.IOExceptionpublic static void configServerSessionIDCache(int maxSidEntries,
int ssl2EntryTimeout,
int ssl3EntryTimeout,
java.lang.String cacheFileDirectory)
throws java.net.SocketException
maxSidEntries - The maximum number of entries in the cache. If
0 is passed, the default of 10,000 is used.ssl2EntryTimeout - The lifetime in seconds of an SSL2 session.
The minimum timeout value is 5 seconds and the maximum is 24 hours.
Values outside this range are replaced by the server default value
of 100 seconds.ssl3EntryTimeout - The lifetime in seconds of an SSL3 session.
The minimum timeout value is 5 seconds and the maximum is 24 hours.
Values outside this range are replaced by the server default value
of 100 seconds.cacheFileDirectory - The pathname of the directory that
will contain the session cache. If null is passed, the server default
is used: /tmp on Unix and \\temp on Windows.java.net.SocketExceptionpublic void setServerCertNickname(java.lang.String nick)
throws java.net.SocketException
java.net.SocketExceptionpublic void setServerCert(X509Certificate certnickname) throws java.net.SocketException
java.net.SocketExceptionpublic void requestClientAuth(boolean b)
throws java.net.SocketException
java.net.SocketExceptionrequireClientAuth(boolean, boolean)public void setNeedClientAuth(boolean b)
throws java.net.SocketException
requestClientAuth instead.java.net.SocketExceptionpublic void setNeedClientAuthNoExpiryCheck(boolean b)
throws java.net.SocketException
requestClientAuthNoExpiryCheck instead.In addition, the client certificate's expiration will not prevent it from being accepted.
java.net.SocketExceptionpublic void requestClientAuthNoExpiryCheck(boolean b)
throws SocketException
{
base.requestClientAuthNoExpiryCheck(b);
}
/**public void enableSSL2(boolean enable)
throws java.net.SocketException
SSLSocket.enableSSL2Default.java.net.SocketExceptionpublic void enableSSL3(boolean enable)
throws java.net.SocketException
SSLSocket.enableSSL3Default.java.net.SocketExceptionpublic void enableTLS(boolean enable)
throws java.net.SocketException
SSLSocket.enableTLSDefault.java.net.SocketExceptionpublic void bypassPKCS11(boolean enable)
throws java.net.SocketException
SSLSocket.bypassPKCS11Default.java.net.SocketExceptionpublic void enableRollbackDetection(boolean enable)
throws java.net.SocketException
SSLSocket.enableRollbackDetectionDefault.java.net.SocketExceptionpublic void enableStepDown(boolean enable)
throws java.net.SocketException
SSLSocket.enableStepDownDefault.java.net.SocketExceptionpublic void enableFDX(boolean enable)
throws java.net.SocketException
SSLSocket.enableFDXDefault.java.net.SocketExceptionpublic void enableV2CompatibleHello(boolean enable)
throws java.net.SocketException
SSLSocket.enableV2CompatibleHelloDefault.java.net.SocketExceptionpublic java.lang.String getSSLOptions()
public java.net.InetAddress getInetAddress()
getInetAddress in class java.net.ServerSocketpublic void requireClientAuth(boolean require,
boolean onRedo)
throws java.net.SocketException
java.net.SocketExceptionpublic void requireClientAuth(int mode)
throws java.net.SocketException
mode - One of: SSLSocket.SSL_REQUIRE_NEVER,
SSLSocket.SSL_REQUIRE_ALWAYS,
SSLSocket.SSL_REQUIRE_FIRST_HANDSHAKE,
SSLSocket.SSL_REQUIRE_NO_ERRORjava.net.SocketExceptionpublic void setClientCertNickname(java.lang.String nick)
throws java.net.SocketException
java.net.SocketExceptionpublic void setClientCert(X509Certificate cert) throws java.net.SocketException
java.net.SocketExceptionpublic void setUseClientMode(boolean b)
b - true if this end of the socket is the SSL slient, false
if it is the SSL server.public void useCache(boolean b)
throws java.net.SocketException
java.net.SocketExceptionpublic java.lang.String toString()
toString in class java.net.ServerSocket