public class SSLSocket
extends java.net.Socket
| Constructor and Description |
|---|
SSLSocket(java.net.InetAddress address,
int port)
Creates an SSL client socket and connects to the specified address and
port.
|
SSLSocket(java.net.InetAddress address,
int port,
java.net.InetAddress localAddr,
int localPort)
Creates an SSL client socket and connects to the specified address and
port.
|
SSLSocket(java.net.InetAddress address,
int port,
java.net.InetAddress localAddr,
int localPort,
boolean stream,
SSLCertificateApprovalCallback certApprovalCallback,
SSLClientCertificateSelectionCallback clientCertSelectionCallback)
Deprecated.
As of JSS 3.0. The stream parameter is ignored, because
only stream sockets are supported.
|
SSLSocket(java.net.InetAddress address,
int port,
java.net.InetAddress localAddr,
int localPort,
SSLCertificateApprovalCallback certApprovalCallback,
SSLClientCertificateSelectionCallback clientCertSelectionCallback)
Creates an SSL client socket and connects to the specified address and
port.
|
SSLSocket(java.net.Socket s,
java.lang.String host,
SSLCertificateApprovalCallback certApprovalCallback,
SSLClientCertificateSelectionCallback clientCertSelectionCallback)
Creates an SSL client socket using the given Java socket for underlying
I/O.
|
SSLSocket(java.lang.String host,
int port)
Creates an SSL client socket and connects to the specified host and
port.
|
SSLSocket(java.lang.String host,
int port,
java.net.InetAddress localAddr,
int localPort)
Creates an SSL client socket and connects to the specified host and
port.
|
SSLSocket(java.lang.String host,
int port,
java.net.InetAddress localAddr,
int localPort,
SSLCertificateApprovalCallback certApprovalCallback,
SSLClientCertificateSelectionCallback clientCertSelectionCallback)
Creates an SSL client socket and connects to the specified host and
port.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addHandshakeCompletedListener(SSLHandshakeCompletedListener listener)
Adds a listener to be notified when an SSL handshake completes.
|
void |
addSocketListener(SSLSocketListener listener) |
static SSLVersionRange |
boundSSLVersionRange(SSLProtocolVariant ssl_variant,
SSLVersionRange range) |
void |
close()
Closes this socket.
|
void |
enableFDX(boolean enable)
Enable simultaneous read/write by separate read and write threads
(full duplex) for this socket.
|
void |
enableRenegotiation(int mode)
Enables the mode of renegotiation that the peer must use on this
socket.
|
static void |
enableRenegotiationDefault(int mode)
Set the mode of renegotiation that the peer must use for all new
sockets.
|
void |
enableRequireSafeNegotiation(boolean enable)
For this socket require that the peer must send
Signaling Cipher Suite Value (SCSV) or Renegotiation Info (RI)
extension in ALL handshakes.
|
static void |
enableRequireSafeNegotiationDefault(boolean enable)
For this socket require that the peer must send
Signaling Cipher Suite Value (SCSV) or Renegotiation Info (RI)
extension in ALL handshakes.
|
void |
enableRollbackDetection(boolean enable)
Enable rollback detection for this socket.
|
void |
enableSessionTickets(boolean enable)
Enables Session tickets on this socket.
|
static void |
enableSessionTicketsDefault(boolean enable)
Sets the default for Session Tickets for all new sockets.
|
void |
enableSSL2(boolean enable)
Enables SSL v2 on this socket.
|
static void |
enableSSL2Default(boolean enable)
Sets the default for SSL v2 for all new sockets.
|
void |
enableSSL3(boolean enable)
Enables SSL v3 on this socket.
|
static void |
enableSSL3Default(boolean enable)
Sets the default for SSL v3 for all new sockets.
|
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.
|
static void |
enableTLSDefault(boolean enable)
Sets the default for TLS for all new sockets.
|
void |
enableV2CompatibleHello(boolean enable)
Enable sending v3 client hello in v2 format for this socket.
|
protected void |
finalize()
Deprecated.
finalize() in Object has been deprecated
|
void |
forceHandshake()
Force an already started SSL handshake to complete.
|
boolean |
getCipherPreference(int cipher)
Returns whether this cipher is enabled or disabled on this socket.
|
static boolean |
getCipherPreferenceDefault(int cipher)
Returns the default for whether this cipher is enabled or disabled.
|
static int[] |
getImplementedCipherSuites()
Returns a list of cipher suites that are implemented by NSS.
|
java.net.InetAddress |
getInetAddress() |
java.io.InputStream |
getInputStream()
Returns the input stream for reading from this socket.
|
boolean |
getKeepAlive()
Returns the current setting of the SO_KEEPALIVE socket option.
|
java.net.InetAddress |
getLocalAddress() |
int |
getLocalPort() |
java.io.OutputStream |
getOutputStream()
Returns the output stream for writing to this socket.
|
int |
getPort() |
int |
getReceiveBufferSize()
Returnst he size (in bytes) of the receive buffer.
|
int |
getSendBufferSize()
Returns the size (in bytes) of the send buffer.
|
int |
getSoLinger()
Returns the current value of the SO_LINGER socket option.
|
int |
getSoTimeout()
Returns the current value of the SO_TIMEOUT socket option.
|
static java.lang.String |
getSSLDefaultOptions() |
java.lang.String |
getSSLOptions() |
SSLSecurityStatus |
getStatus()
Returns the security status of this socket.
|
boolean |
getTcpNoDelay()
Returns the current setting of the TCP_NO_DELAY socket option.
|
boolean |
getUseClientMode() |
void |
invalidateSession()
Removes the current session from the session cache.
|
static boolean |
isFipsCipherSuite(int ciphersuite)
isFipsCipherSuite
|
void |
redoHandshake()
Causes SSL to begin a full, new SSL 3.0 handshake from scratch
on a connection that has already completed one handshake.
|
void |
redoHandshake(boolean flushCache)
Causes SSL to begin a full, new SSL 3.0 handshake from scratch
on a connection that has already completed one handshake.
|
void |
removeHandshakeCompletedListener(SSLHandshakeCompletedListener listener)
Removes a previously registered listener for handshake completion.
|
void |
removeSocketListener(SSLSocketListener listener) |
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 |
requireClientAuthDefault(boolean require,
boolean onRedo)
Deprecated.
use requireClientAuthDefault(int)
|
static void |
requireClientAuthDefault(int mode)
Sets the default setting for requiring client authorization.
|
void |
resetHandshake()
Resets the handshake state.
|
static void |
setCipherPolicy(CipherPolicy cp)
Sets the SSL cipher policy.
|
void |
setCipherPreference(int cipher,
boolean enable)
Enables/disables the cipher on this socket.
|
static void |
setCipherPreferenceDefault(int cipher,
boolean enable)
Sets the default for whether this cipher is enabled or disabled.
|
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 |
setKeepAlive(boolean on)
Enables or disables the SO_KEEPALIVE socket option.
|
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 |
setReceiveBufferSize(int size)
Sets the size (in bytes) of the receive buffer.
|
void |
setSendBufferSize(int size)
Sets the size (in bytes) of the send buffer.
|
void |
setSoLinger(boolean on,
int linger)
Sets the SO_LINGER socket option.
|
void |
setSoTimeout(int timeout)
Sets the SO_TIMEOUT socket option.
|
static void |
setSSLVersionRangeDefault(SSLProtocolVariant ssl_variant,
SSLVersionRange range) |
void |
setTcpNoDelay(boolean on)
Enables or disables the TCP_NO_DELAY 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.
|
void |
shutdownInput()
Shuts down the input side of the socket.
|
void |
shutdownOutput()
Shuts down the output side of the socket.
|
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.
|
void |
useCacheDefault(boolean b)
Sets the default setting for use of the session cache.
|
bind, connect, connect, getChannel, getLocalSocketAddress, getOOBInline, getRemoteSocketAddress, getReuseAddress, getTrafficClass, isBound, isClosed, isConnected, isInputShutdown, isOutputShutdown, sendUrgentData, setOOBInline, setPerformancePreferences, setReuseAddress, setSocketImplFactory, setTrafficClasspublic static final int SSL2_RC4_128_WITH_MD5
public static final int SSL2_RC4_128_EXPORT40_WITH_MD5
public static final int SSL2_RC2_128_CBC_WITH_MD5
public static final int SSL2_RC2_128_CBC_EXPORT40_WITH_MD5
public static final int SSL2_IDEA_128_CBC_WITH_MD5
public static final int SSL2_DES_64_CBC_WITH_MD5
public static final int SSL2_DES_192_EDE3_CBC_WITH_MD5
public static final int TLS_NULL_WITH_NULL_NULL
@Deprecated public static final int SSL3_RSA_WITH_NULL_MD5
public static final int TLS_RSA_WITH_NULL_MD5
@Deprecated public static final int SSL3_RSA_WITH_NULL_SHA
public static final int TLS_RSA_WITH_NULL_SHA
public static final int SSL3_RSA_EXPORT_WITH_RC4_40_MD5
public static final int TLS_RSA_EXPORT_WITH_RC4_40_MD5
@Deprecated public static final int SSL3_RSA_WITH_RC4_128_MD5
public static final int TLS_RSA_WITH_RC4_128_MD5
@Deprecated public static final int SSL3_RSA_WITH_RC4_128_SHA
public static final int TLS_RSA_WITH_RC4_128_SHA
public static final int SSL3_RSA_EXPORT_WITH_RC2_CBC_40_MD5
public static final int TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5
@Deprecated public static final int SSL3_RSA_WITH_IDEA_CBC_SHA
public static final int TLS_RSA_WITH_IDEA_CBC_SHA
public static final int SSL3_RSA_EXPORT_WITH_DES40_CBC_SHA
public static final int TLS_RSA_EXPORT_WITH_DES40_CBC_SHA
@Deprecated public static final int SSL3_RSA_WITH_DES_CBC_SHA
public static final int TLS_RSA_WITH_DES_CBC_SHA
@Deprecated public static final int SSL3_RSA_WITH_3DES_EDE_CBC_SHA
public static final int TLS_RSA_WITH_3DES_EDE_CBC_SHA
public static final int SSL3_DH_DSS_EXPORT_WITH_DES40_CBC_SHA
public static final int TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA
@Deprecated public static final int SSL3_DH_DSS_WITH_DES_CBC_SHA
public static final int TLS_DH_DSS_WITH_DES_CBC_SHA
@Deprecated public static final int SSL3_DH_DSS_WITH_3DES_EDE_CBC_SHA
public static final int TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA
public static final int SSL3_DH_RSA_EXPORT_WITH_DES40_CBC_SHA
public static final int TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA
@Deprecated public static final int SSL3_DH_RSA_WITH_DES_CBC_SHA
public static final int TLS_DH_RSA_WITH_DES_CBC_SHA
@Deprecated public static final int SSL3_DH_RSA_WITH_3DES_EDE_CBC_SHA
public static final int TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA
public static final int SSL3_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA
public static final int TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA
@Deprecated public static final int SSL3_DHE_DSS_WITH_DES_CBC_SHA
public static final int TLS_DHE_DSS_WITH_DES_CBC_SHA
@Deprecated public static final int SSL3_DHE_DSS_WITH_3DES_EDE_CBC_SHA
public static final int TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA
public static final int SSL3_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA
public static final int TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA
@Deprecated public static final int SSL3_DHE_RSA_WITH_DES_CBC_SHA
public static final int TLS_DHE_RSA_WITH_DES_CBC_SHA
@Deprecated public static final int SSL3_DHE_RSA_WITH_3DES_EDE_CBC_SHA
public static final int TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA
public static final int SSL3_DH_ANON_EXPORT_WITH_RC4_40_MD5
public static final int TLS_DH_anon_EXPORT_WITH_RC4_40_MD5
@Deprecated public static final int SSL3_DH_ANON_WITH_RC4_128_MD5
public static final int TLS_DH_anon_WITH_RC4_128_MD5
public static final int SSL3_DH_ANON_EXPORT_WITH_DES40_CBC_SHA
public static final int TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA
@Deprecated public static final int SSL3_DH_ANON_WITH_DES_CBC_SHA
public static final int TLS_DH_anon_WITH_DES_CBC_SHA
@Deprecated public static final int SSL3_DH_ANON_WITH_3DES_EDE_CBC_SHA
public static final int TLS_DH_anon_WITH_3DES_EDE_CBC_SHA
@Deprecated public static final int SSL3_FORTEZZA_DMS_WITH_NULL_SHA
@Deprecated public static final int SSL3_FORTEZZA_DMS_WITH_FORTEZZA_CBC_SHA
@Deprecated public static final int SSL3_FORTEZZA_DMS_WITH_RC4_128_SHA
public static final int SSL_RSA_FIPS_WITH_3DES_EDE_CBC_SHA
public static final int SSL_RSA_FIPS_WITH_DES_CBC_SHA
public static final int TLS_RSA_EXPORT1024_WITH_DES_CBC_SHA
public static final int TLS_RSA_EXPORT1024_WITH_RC4_56_SHA
public static final int TLS_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA
public static final int TLS_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA
public static final int TLS_DHE_DSS_WITH_RC4_128_SHA
public static final int TLS_DHE_RSA_WITH_AES_128_CBC_SHA256
public static final int TLS_DHE_DSS_WITH_AES_256_CBC_SHA256
public static final int TLS_DHE_RSA_WITH_AES_256_CBC_SHA256
public static final int TLS_RSA_WITH_AES_128_CBC_SHA
public static final int TLS_DH_DSS_WITH_AES_128_CBC_SHA
public static final int TLS_DH_RSA_WITH_AES_128_CBC_SHA
public static final int TLS_DHE_DSS_WITH_AES_128_CBC_SHA
public static final int TLS_DHE_RSA_WITH_AES_128_CBC_SHA
@Deprecated public static final int TLS_DH_ANON_WITH_AES_128_CBC_SHA
public static final int TLS_DH_anon_WITH_AES_128_CBC_SHA
public static final int TLS_RSA_WITH_AES_256_CBC_SHA
public static final int TLS_DH_DSS_WITH_AES_256_CBC_SHA
public static final int TLS_DH_RSA_WITH_AES_256_CBC_SHA
public static final int TLS_DHE_DSS_WITH_AES_256_CBC_SHA
public static final int TLS_DHE_RSA_WITH_AES_256_CBC_SHA
@Deprecated public static final int TLS_DH_ANON_WITH_AES_256_CBC_SHA
public static final int TLS_DH_anon_WITH_AES_256_CBC_SHA
public static final int TLS_RSA_WITH_NULL_SHA256
public static final int TLS_RSA_WITH_AES_128_CBC_SHA256
public static final int TLS_RSA_WITH_AES_256_CBC_SHA256
public static final int TLS_DHE_DSS_WITH_AES_128_CBC_SHA256
public static final int TLS_RSA_WITH_CAMELLIA_128_CBC_SHA
public static final int TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA
public static final int TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA
public static final int TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA
public static final int TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA
@Deprecated public static final int TLS_DH_ANON_WITH_CAMELLIA_128_CBC_SHA
public static final int TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA
public static final int TLS_RSA_WITH_CAMELLIA_256_CBC_SHA
public static final int TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA
public static final int TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA
public static final int TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA
public static final int TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA
@Deprecated public static final int TLS_DH_ANON_WITH_CAMELLIA_256_CBC_SHA
public static final int TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA
public static final int TLS_RSA_WITH_SEED_CBC_SHA
public static final int TLS_RSA_WITH_AES_128_GCM_SHA256
public static final int TLS_RSA_WITH_AES_256_GCM_SHA384
public static final int TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
public static final int TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
public static final int TLS_DHE_DSS_WITH_AES_128_GCM_SHA256
public static final int TLS_DHE_DSS_WITH_AES_256_GCM_SHA384
public static final int TLS_DHE_PSK_WITH_AES_128_GCM_SHA256
public static final int TLS_DHE_PSK_WITH_AES_256_GCM_SHA384
public static final int TLS_EMPTY_RENEGOTIATION_INFO_SCSV
public static final int TLS_FALLBACK_SCSV
public static final int TLS_ECDH_ECDSA_WITH_NULL_SHA
public static final int TLS_ECDH_ECDSA_WITH_RC4_128_SHA
public static final int TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA
public static final int TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA
public static final int TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA
public static final int TLS_ECDHE_ECDSA_WITH_NULL_SHA
public static final int TLS_ECDHE_ECDSA_WITH_RC4_128_SHA
public static final int TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA
public static final int TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
public static final int TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
public static final int TLS_ECDH_RSA_WITH_NULL_SHA
public static final int TLS_ECDH_RSA_WITH_RC4_128_SHA
public static final int TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA
public static final int TLS_ECDH_RSA_WITH_AES_128_CBC_SHA
public static final int TLS_ECDH_RSA_WITH_AES_256_CBC_SHA
public static final int TLS_ECDHE_RSA_WITH_NULL_SHA
public static final int TLS_ECDHE_RSA_WITH_RC4_128_SHA
public static final int TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA
public static final int TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
public static final int TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
public static final int TLS_ECDH_anon_WITH_NULL_SHA
public static final int TLS_ECDH_anon_WITH_RC4_128_SHA
public static final int TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA
public static final int TLS_ECDH_anon_WITH_AES_128_CBC_SHA
public static final int TLS_ECDH_anon_WITH_AES_256_CBC_SHA
public static final int TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
public static final int TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
public static final int TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
public static final int TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
public static final int TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
public static final int TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
public static final int TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256
public static final int TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
public static final int TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
public static final int TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256
public static final int TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
public static final int TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
public static final int TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256
public static final int TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256
public static final int TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256
public static final int TLS_ECDHE_PSK_WITH_AES_128_GCM_SHA256
public static final int TLS_ECDHE_PSK_WITH_AES_256_GCM_SHA384
public static final int TLS_AES_128_GCM_SHA256
public static final int TLS_AES_256_GCM_SHA384
public static final int TLS_CHACHA20_POLY1305_SHA256
public static final int SSL_REQUIRE_NEVER
public static final int SSL_REQUIRE_ALWAYS
public static final int SSL_REQUIRE_FIRST_HANDSHAKE
public static final int SSL_REQUIRE_NO_ERROR
public static final int SSL_RENEGOTIATE_NEVER
public static final int SSL_RENEGOTIATE_REQUIRES_XTN
public static final int SSL_RENEGOTIATE_UNRESTRICTED
public static final int SSL_RENEGOTIATE_TRANSITIONAL
public SSLSocket(java.lang.String host,
int port)
throws java.net.UnknownHostException,
java.io.IOException
host - The hostname to connect to.port - The port to connect to.java.net.UnknownHostExceptionjava.io.IOExceptionpublic SSLSocket(java.net.InetAddress address,
int port)
throws java.io.IOException
address - The IP address to connect to.port - The port to connect to.java.io.IOExceptionpublic SSLSocket(java.lang.String host,
int port,
java.net.InetAddress localAddr,
int localPort)
throws java.io.IOException
host - The hostname to connect to.port - The port to connect to.localAddr - The local address to bind to. It can be null, in which
case an unspecified local address will be chosen.localPort - The local port to bind to. If 0, a random port will be
assigned to the socket.java.io.IOExceptionpublic SSLSocket(java.net.InetAddress address,
int port,
java.net.InetAddress localAddr,
int localPort)
throws java.io.IOException
address - The IP address to connect to.port - The port to connect to.localAddr - The local address to bind to. It can be null, in which
case an unspecified local address will be chosen.localPort - The local port to bind to. If 0, a random port will be
assigned to the socket.java.io.IOExceptionpublic SSLSocket(java.lang.String host,
int port,
java.net.InetAddress localAddr,
int localPort,
SSLCertificateApprovalCallback certApprovalCallback,
SSLClientCertificateSelectionCallback clientCertSelectionCallback)
throws java.io.IOException
host - The hostname to connect to.port - The port to connect to.localAddr - The local address to bind to. It can be null, in which
case an unspecified local address will be chosen.localPort - The local port to bind to. If 0, a random port will be
assigned to the socket.certApprovalCallback - A callback that can be used to override
approval of the peer's certificate.clientCertSelectionCallback - A callback to select the client
certificate to present to the peer.java.io.IOException@Deprecated
public SSLSocket(java.net.InetAddress address,
int port,
java.net.InetAddress localAddr,
int localPort,
boolean stream,
SSLCertificateApprovalCallback certApprovalCallback,
SSLClientCertificateSelectionCallback clientCertSelectionCallback)
throws java.io.IOException
address - The IP address to connect to.port - The port to connect to.localAddr - The local address to bind to. It can be null, in which
case an unspecified local address will be chosen.localPort - The local port to bind to. If 0, a random port will be
assigned to the socket.stream - This parameter is ignored. All SSLSockets are stream
sockets.certApprovalCallback - A callback that can be used to override
approval of the peer's certificate.clientCertSelectionCallback - A callback to select the client
certificate to present to the peer.java.io.IOExceptionpublic SSLSocket(java.net.InetAddress address,
int port,
java.net.InetAddress localAddr,
int localPort,
SSLCertificateApprovalCallback certApprovalCallback,
SSLClientCertificateSelectionCallback clientCertSelectionCallback)
throws java.io.IOException
address - The IP address to connect to.port - The port to connect to.localAddr - The local address to bind to. It can be null, in which
case an unspecified local address will be chosen.localPort - The local port to bind to. If 0, a random port will be
assigned to the socket.certApprovalCallback - A callback that can be used to override
approval of the peer's certificate.clientCertSelectionCallback - A callback to select the client
certificate to present to the peer.java.io.IOExceptionpublic SSLSocket(java.net.Socket s,
java.lang.String host,
SSLCertificateApprovalCallback certApprovalCallback,
SSLClientCertificateSelectionCallback clientCertSelectionCallback)
throws java.io.IOException
s - The Java socket to use for underlying I/O.host - The hostname of the remote side of the connection.
This name is used to verify the server's certificate.certApprovalCallback - A callback that can be used to override
approval of the peer's certificate.clientCertSelectionCallback - A callback to select the client
certificate to present to the peer.java.io.IOExceptionpublic java.net.InetAddress getInetAddress()
getInetAddress in class java.net.Socketpublic java.net.InetAddress getLocalAddress()
getLocalAddress in class java.net.Socketpublic int getLocalPort()
getLocalPort in class java.net.Socketpublic int getPort()
getPort in class java.net.Socketpublic java.io.InputStream getInputStream()
throws java.io.IOException
getInputStream in class java.net.Socketjava.io.IOExceptionpublic java.io.OutputStream getOutputStream()
throws java.io.IOException
getOutputStream in class java.net.Socketjava.io.IOExceptionpublic void setTcpNoDelay(boolean on)
throws java.net.SocketException
setTcpNoDelay in class java.net.Socketjava.net.SocketExceptionpublic boolean getTcpNoDelay()
throws java.net.SocketException
getTcpNoDelay in class java.net.Socketjava.net.SocketExceptionpublic void setKeepAlive(boolean on)
throws java.net.SocketException
setKeepAlive in class java.net.Socketjava.net.SocketExceptionpublic boolean getKeepAlive()
throws java.net.SocketException
getKeepAlive in class java.net.Socketjava.net.SocketExceptionpublic void shutdownInput()
throws java.io.IOException
shutdownInput in class java.net.Socketjava.io.IOExceptionpublic void shutdownOutput()
throws java.io.IOException
shutdownOutput in class java.net.Socketjava.io.IOExceptionpublic void setSoLinger(boolean on,
int linger)
throws java.net.SocketException
setSoLinger in class java.net.Socketjava.net.SocketExceptionpublic int getSoLinger()
throws java.net.SocketException
getSoLinger in class java.net.Socketjava.net.SocketExceptionpublic void setSoTimeout(int timeout)
throws java.net.SocketException
setSoTimeout in class java.net.Sockettimeout - The timeout time in milliseconds.java.net.SocketExceptionpublic int getSoTimeout()
throws java.net.SocketException
getSoTimeout in class java.net.Socketjava.net.SocketExceptionpublic void setSendBufferSize(int size)
throws java.net.SocketException
setSendBufferSize in class java.net.Socketjava.net.SocketExceptionpublic int getSendBufferSize()
throws java.net.SocketException
getSendBufferSize in class java.net.Socketjava.net.SocketExceptionpublic void setReceiveBufferSize(int size)
throws java.net.SocketException
setReceiveBufferSize in class java.net.Socketjava.net.SocketExceptionpublic int getReceiveBufferSize()
throws java.net.SocketException
getReceiveBufferSize in class java.net.Socketjava.net.SocketExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.net.Socketjava.io.IOExceptionpublic void addSocketListener(SSLSocketListener listener)
public void removeSocketListener(SSLSocketListener listener)
public void addHandshakeCompletedListener(SSLHandshakeCompletedListener listener)
public void removeHandshakeCompletedListener(SSLHandshakeCompletedListener listener)
public void enableSSL2(boolean enable)
throws java.net.SocketException
enableSSL2Default.java.net.SocketExceptionpublic static void enableSSL2Default(boolean enable)
throws java.net.SocketException
java.net.SocketExceptionpublic void enableSSL3(boolean enable)
throws java.net.SocketException
enableSSL3Default.java.net.SocketExceptionpublic static void enableSSL3Default(boolean enable)
throws java.net.SocketException
java.net.SocketExceptionpublic void enableTLS(boolean enable)
throws java.net.SocketException
enableTLSDefault.java.net.SocketExceptionpublic static void enableTLSDefault(boolean enable)
throws java.net.SocketException
java.net.SocketExceptionpublic void enableSessionTickets(boolean enable)
throws java.net.SocketException
enableSessionTicketsDefault.java.net.SocketExceptionpublic static void enableSessionTicketsDefault(boolean enable)
throws java.net.SocketException
java.net.SocketExceptionpublic void enableRenegotiation(int mode)
throws java.net.SocketException
SSLSocket.enableRenegotiationDefault.mode - One of:
SSLSocket.SSL_RENEGOTIATE_NEVER - Never renegotiate at all.
SSLSocket.SSL_RENEGOTIATE_UNRESTRICTED - Renegotiate without
restriction, whether or not the peer's hello bears the TLS
renegotiation info extension. Vulnerable, as in the past.
SSLSocket.SSL_RENEGOTIATE_REQUIRES_XTN - Only renegotiate if the
peer's hello bears the TLS renegotiation_info extension. This is
safe renegotiation.
SSLSocket.SSL_RENEGOTIATE_TRANSITIONAL - Disallow unsafe
renegotiation in server sockets only, but allow clients
to continue to renegotiate with vulnerable servers.
This value should only be used during the transition period
when few servers have been upgraded.java.net.SocketExceptionpublic static void enableRenegotiationDefault(int mode)
throws java.net.SocketException
mode - One of:
SSLSocket.SSL_RENEGOTIATE_NEVER - Never renegotiate at all.
SSLSocket.SSL_RENEGOTIATE_UNRESTRICTED - Renegotiate without
restriction, whether or not the peer's hello bears the TLS
renegotiation info extension. Vulnerable, as in the past.
SSLSocket.SSL_RENEGOTIATE_REQUIRES_XTN - Only renegotiate if the
peer's hello bears the TLS renegotiation_info extension. This is
safe renegotiation.
SSLSocket.SSL_RENEGOTIATE_TRANSITIONAL - Disallow unsafe
renegotiation in server sockets only, but allow clients
to continue to renegotiate with vulnerable servers.
This value should only be used during the transition period
when few servers have been upgraded.java.net.SocketExceptionpublic void enableRequireSafeNegotiation(boolean enable)
throws java.net.SocketException
SSLSocket.enableRequireSafeNegotiationDefault.java.net.SocketExceptionpublic static void enableRequireSafeNegotiationDefault(boolean enable)
throws java.net.SocketException
java.net.SocketExceptionpublic void enableRollbackDetection(boolean enable)
throws java.net.SocketException
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
enableFDXDefault.java.net.SocketExceptionpublic void enableV2CompatibleHello(boolean enable)
throws java.net.SocketException
enableV2CompatibleHelloDefault.java.net.SocketExceptionpublic java.lang.String getSSLOptions()
public static java.lang.String getSSLDefaultOptions()
@Deprecated
public 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.SocketException@Deprecated
public void requireClientAuthDefault(boolean require,
boolean onRedo)
throws java.net.SocketException
java.net.SocketExceptionpublic static void requireClientAuthDefault(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 forceHandshake()
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 boolean getUseClientMode()
public void resetHandshake()
throws java.net.SocketException
java.net.SocketExceptionpublic SSLSecurityStatus getStatus() throws java.net.SocketException
java.net.SocketExceptionpublic void setClientCertNickname(java.lang.String nick)
throws java.net.SocketException
java.net.SocketExceptionSSLClientCertificateSelectionCallbackpublic void setClientCert(X509Certificate cert) throws java.net.SocketException
java.net.SocketExceptionSSLClientCertificateSelectionCallbackpublic void requestClientAuth(boolean b)
throws java.net.SocketException
java.net.SocketExceptionrequireClientAuth(boolean, boolean)@Deprecated
public void setNeedClientAuth(boolean b)
throws java.net.SocketException
requestClientAuth instead.java.net.SocketException@Deprecated
public 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 useCache(boolean b)
throws java.net.SocketException
java.net.SocketExceptionpublic void useCacheDefault(boolean b)
throws java.net.SocketException
java.net.SocketExceptionpublic static void setSSLVersionRangeDefault(SSLProtocolVariant ssl_variant, SSLVersionRange range) throws java.net.SocketException
java.net.SocketExceptionpublic static SSLVersionRange boundSSLVersionRange(SSLProtocolVariant ssl_variant, SSLVersionRange range) throws java.net.SocketException
java.net.SocketExceptionpublic void setCipherPreference(int cipher,
boolean enable)
throws java.net.SocketException
java.net.SocketExceptionpublic boolean getCipherPreference(int cipher)
throws java.net.SocketException
java.net.SocketExceptionpublic static void setCipherPreferenceDefault(int cipher,
boolean enable)
throws java.net.SocketException
java.net.SocketExceptionpublic static boolean getCipherPreferenceDefault(int cipher)
throws java.net.SocketException
java.net.SocketExceptionpublic void invalidateSession()
throws java.net.SocketException
java.net.SocketExceptionpublic void redoHandshake()
throws java.net.SocketException
Does not flush the SSL3 cache entry first, so a full handshake will not take place. Instead only the symmetric session keys will be regenerated.
java.net.SocketExceptionpublic void redoHandshake(boolean flushCache)
throws java.net.SocketException
flushCache - If true, this session will be flushed from the cache.
This will force a complete SSL handshake with a private key operation.
If false, only the session key will be regenerated.java.net.SocketException@Deprecated
protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwablepublic static void setCipherPolicy(CipherPolicy cp) throws java.net.SocketException
java.net.SocketExceptionpublic java.lang.String toString()
toString in class java.net.Socketpublic static boolean isFipsCipherSuite(int ciphersuite)
throws java.net.SocketException
java.net.SocketExceptionpublic static int[] getImplementedCipherSuites()
TLS_RSA_WITH_AES_128_CBC_SHA).