Package org.mozilla.jss.ssl
Class SSLSocket
- java.lang.Object
-
- java.net.Socket
-
- org.mozilla.jss.ssl.SSLSocket
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class SSLSocket extends java.net.SocketSSL client socket.
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description 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.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.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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddHandshakeCompletedListener(SSLHandshakeCompletedListener listener)Adds a listener to be notified when an SSL handshake completes.voidaddSocketListener(SSLSocketListener listener)static SSLVersionRangeboundSSLVersionRange(SSLProtocolVariant ssl_variant, SSLVersionRange range)voidclose()Closes this socket.voidenableFDX(boolean enable)Enable simultaneous read/write by separate read and write threads (full duplex) for this socket.voidenableRenegotiation(int mode)Enables the mode of renegotiation that the peer must use on this socket.static voidenableRenegotiationDefault(int mode)Set the mode of renegotiation that the peer must use for all new sockets.voidenableRequireSafeNegotiation(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 voidenableRequireSafeNegotiationDefault(boolean enable)For this socket require that the peer must send Signaling Cipher Suite Value (SCSV) or Renegotiation Info (RI) extension in ALL handshakes.voidenableRollbackDetection(boolean enable)Enable rollback detection for this socket.voidenableSessionTickets(boolean enable)Enables Session tickets on this socket.static voidenableSessionTicketsDefault(boolean enable)Sets the default for Session Tickets for all new sockets.voidenableSSL2(boolean enable)Enables SSL v2 on this socket.static voidenableSSL2Default(boolean enable)Sets the default for SSL v2 for all new sockets.voidenableSSL3(boolean enable)Enables SSL v3 on this socket.static voidenableSSL3Default(boolean enable)Sets the default for SSL v3 for all new sockets.voidenableStepDown(boolean enable)This option, enableStepDown, is concerned with the generation of step-down keys which are used with export suites.voidenableTLS(boolean enable)Enables TLS on this socket.static voidenableTLSDefault(boolean enable)Sets the default for TLS for all new sockets.voidenableV2CompatibleHello(boolean enable)Enable sending v3 client hello in v2 format for this socket.protected voidfinalize()Deprecated.finalize() in Object has been deprecatedvoidforceHandshake()Force an already started SSL handshake to complete.booleangetCipherPreference(int cipher)Returns whether this cipher is enabled or disabled on this socket.static booleangetCipherPreferenceDefault(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.InetAddressgetInetAddress()java.io.InputStreamgetInputStream()Returns the input stream for reading from this socket.booleangetKeepAlive()Returns the current setting of the SO_KEEPALIVE socket option.java.net.InetAddressgetLocalAddress()intgetLocalPort()java.io.OutputStreamgetOutputStream()Returns the output stream for writing to this socket.intgetPort()intgetReceiveBufferSize()Returnst he size (in bytes) of the receive buffer.intgetSendBufferSize()Returns the size (in bytes) of the send buffer.intgetSoLinger()Returns the current value of the SO_LINGER socket option.intgetSoTimeout()Returns the current value of the SO_TIMEOUT socket option.static java.lang.StringgetSSLDefaultOptions()java.lang.StringgetSSLOptions()SSLSecurityStatusgetStatus()Returns the security status of this socket.booleangetTcpNoDelay()Returns the current setting of the TCP_NO_DELAY socket option.booleangetUseClientMode()voidinvalidateSession()Removes the current session from the session cache.static booleanisFipsCipherSuite(int ciphersuite)isFipsCipherSuitevoidredoHandshake()Causes SSL to begin a full, new SSL 3.0 handshake from scratch on a connection that has already completed one handshake.voidredoHandshake(boolean flushCache)Causes SSL to begin a full, new SSL 3.0 handshake from scratch on a connection that has already completed one handshake.voidremoveHandshakeCompletedListener(SSLHandshakeCompletedListener listener)Removes a previously registered listener for handshake completion.voidremoveSocketListener(SSLSocketListener listener)voidrequestClientAuth(boolean b)Enables/disables the request of client authentication.voidrequireClientAuth(boolean require, boolean onRedo)Deprecated.use requireClientAuth(int)voidrequireClientAuth(int mode)Sets whether the socket requires client authentication from the remote peer.voidrequireClientAuthDefault(boolean require, boolean onRedo)Deprecated.use requireClientAuthDefault(int)static voidrequireClientAuthDefault(int mode)Sets the default setting for requiring client authorization.voidresetHandshake()Resets the handshake state.static voidsetCipherPolicy(CipherPolicy cp)Sets the SSL cipher policy.voidsetCipherPreference(int cipher, boolean enable)Enables/disables the cipher on this socket.static voidsetCipherPreferenceDefault(int cipher, boolean enable)Sets the default for whether this cipher is enabled or disabled.voidsetClientCert(X509Certificate cert)Sets the certificate to use for client authentication.voidsetClientCertNickname(java.lang.String nick)Sets the nickname of the certificate to use for client authentication.voidsetKeepAlive(boolean on)Enables or disables the SO_KEEPALIVE socket option.voidsetNeedClientAuth(boolean b)Deprecated.As of JSS 3.0.voidsetNeedClientAuthNoExpiryCheck(boolean b)Deprecated.As of JSS 3.0.voidsetReceiveBufferSize(int size)Sets the size (in bytes) of the receive buffer.voidsetSendBufferSize(int size)Sets the size (in bytes) of the send buffer.voidsetSoLinger(boolean on, int linger)Sets the SO_LINGER socket option.voidsetSoTimeout(int timeout)Sets the SO_TIMEOUT socket option.static voidsetSSLVersionRangeDefault(SSLProtocolVariant ssl_variant, SSLVersionRange range)voidsetTcpNoDelay(boolean on)Enables or disables the TCP_NO_DELAY socket option.voidsetUseClientMode(boolean b)Determines whether this end of the socket is the client or the server for purposes of the SSL protocol.voidshutdownInput()Shuts down the input side of the socket.voidshutdownOutput()Shuts down the output side of the socket.java.lang.StringtoString()Returns the addresses and ports of this socket or an error message if the socket is not in a valid state.voiduseCache(boolean b)Enables/disables the session cache.voiduseCacheDefault(boolean b)Sets the default setting for use of the session cache.-
Methods inherited from class java.net.Socket
bind, connect, connect, getChannel, getLocalSocketAddress, getOOBInline, getOption, getRemoteSocketAddress, getReuseAddress, getTrafficClass, isBound, isClosed, isConnected, isInputShutdown, isOutputShutdown, sendUrgentData, setOOBInline, setOption, setPerformancePreferences, setReuseAddress, setSocketImplFactory, setTrafficClass, supportedOptions
-
-
-
-
Field Detail
-
SSL2_RC4_128_WITH_MD5
public static final int SSL2_RC4_128_WITH_MD5
Note the following cipher-suites constants are not all implemented. You need to call getImplementedCiphersuites.- See Also:
- Constant Field Values
-
SSL2_RC4_128_EXPORT40_WITH_MD5
public static final int SSL2_RC4_128_EXPORT40_WITH_MD5
- See Also:
- Constant Field Values
-
SSL2_RC2_128_CBC_WITH_MD5
public static final int SSL2_RC2_128_CBC_WITH_MD5
- See Also:
- Constant Field Values
-
SSL2_RC2_128_CBC_EXPORT40_WITH_MD5
public static final int SSL2_RC2_128_CBC_EXPORT40_WITH_MD5
- See Also:
- Constant Field Values
-
SSL2_IDEA_128_CBC_WITH_MD5
public static final int SSL2_IDEA_128_CBC_WITH_MD5
- See Also:
- Constant Field Values
-
SSL2_DES_64_CBC_WITH_MD5
public static final int SSL2_DES_64_CBC_WITH_MD5
- See Also:
- Constant Field Values
-
SSL2_DES_192_EDE3_CBC_WITH_MD5
public static final int SSL2_DES_192_EDE3_CBC_WITH_MD5
- See Also:
- Constant Field Values
-
TLS_NULL_WITH_NULL_NULL
public static final int TLS_NULL_WITH_NULL_NULL
- See Also:
- Constant Field Values
-
SSL3_RSA_WITH_NULL_MD5
@Deprecated public static final int SSL3_RSA_WITH_NULL_MD5
Deprecated.Replaced with TLS_RSA_WITH_NULL_MD5.- See Also:
- Constant Field Values
-
TLS_RSA_WITH_NULL_MD5
public static final int TLS_RSA_WITH_NULL_MD5
- See Also:
- Constant Field Values
-
SSL3_RSA_WITH_NULL_SHA
@Deprecated public static final int SSL3_RSA_WITH_NULL_SHA
Deprecated.Replaced with TLS_RSA_WITH_NULL_SHA.- See Also:
- Constant Field Values
-
TLS_RSA_WITH_NULL_SHA
public static final int TLS_RSA_WITH_NULL_SHA
- See Also:
- Constant Field Values
-
SSL3_RSA_EXPORT_WITH_RC4_40_MD5
public static final int SSL3_RSA_EXPORT_WITH_RC4_40_MD5
- See Also:
- Constant Field Values
-
TLS_RSA_EXPORT_WITH_RC4_40_MD5
public static final int TLS_RSA_EXPORT_WITH_RC4_40_MD5
- See Also:
- Constant Field Values
-
SSL3_RSA_WITH_RC4_128_MD5
@Deprecated public static final int SSL3_RSA_WITH_RC4_128_MD5
Deprecated.Replaced with TLS_RSA_WITH_RC4_128_MD5.- See Also:
- Constant Field Values
-
TLS_RSA_WITH_RC4_128_MD5
public static final int TLS_RSA_WITH_RC4_128_MD5
- See Also:
- Constant Field Values
-
SSL3_RSA_WITH_RC4_128_SHA
@Deprecated public static final int SSL3_RSA_WITH_RC4_128_SHA
Deprecated.Replaced with TLS_RSA_WITH_RC4_128_SHA.- See Also:
- Constant Field Values
-
TLS_RSA_WITH_RC4_128_SHA
public static final int TLS_RSA_WITH_RC4_128_SHA
- See Also:
- Constant Field Values
-
SSL3_RSA_EXPORT_WITH_RC2_CBC_40_MD5
public static final int SSL3_RSA_EXPORT_WITH_RC2_CBC_40_MD5
- See Also:
- Constant Field Values
-
TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5
public static final int TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5
- See Also:
- Constant Field Values
-
SSL3_RSA_WITH_IDEA_CBC_SHA
@Deprecated public static final int SSL3_RSA_WITH_IDEA_CBC_SHA
Deprecated.Replaced with TLS_RSA_WITH_IDEA_CBC_SHA.- See Also:
- Constant Field Values
-
TLS_RSA_WITH_IDEA_CBC_SHA
public static final int TLS_RSA_WITH_IDEA_CBC_SHA
- See Also:
- Constant Field Values
-
SSL3_RSA_EXPORT_WITH_DES40_CBC_SHA
public static final int SSL3_RSA_EXPORT_WITH_DES40_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_RSA_EXPORT_WITH_DES40_CBC_SHA
public static final int TLS_RSA_EXPORT_WITH_DES40_CBC_SHA
- See Also:
- Constant Field Values
-
SSL3_RSA_WITH_DES_CBC_SHA
@Deprecated public static final int SSL3_RSA_WITH_DES_CBC_SHA
Deprecated.Replaced with TLS_RSA_WITH_DES_CBC_SHA.- See Also:
- Constant Field Values
-
TLS_RSA_WITH_DES_CBC_SHA
public static final int TLS_RSA_WITH_DES_CBC_SHA
- See Also:
- Constant Field Values
-
SSL3_RSA_WITH_3DES_EDE_CBC_SHA
@Deprecated public static final int SSL3_RSA_WITH_3DES_EDE_CBC_SHA
Deprecated.Replaced with TLS_RSA_WITH_3DES_EDE_CBC_SHA.- See Also:
- Constant Field Values
-
TLS_RSA_WITH_3DES_EDE_CBC_SHA
public static final int TLS_RSA_WITH_3DES_EDE_CBC_SHA
- See Also:
- Constant Field Values
-
SSL3_DH_DSS_EXPORT_WITH_DES40_CBC_SHA
public static final int SSL3_DH_DSS_EXPORT_WITH_DES40_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA
public static final int TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA
- See Also:
- Constant Field Values
-
SSL3_DH_DSS_WITH_DES_CBC_SHA
@Deprecated public static final int SSL3_DH_DSS_WITH_DES_CBC_SHA
Deprecated.Replaced with TLS_DH_DSS_WITH_DES_CBC_SHA.- See Also:
- Constant Field Values
-
TLS_DH_DSS_WITH_DES_CBC_SHA
public static final int TLS_DH_DSS_WITH_DES_CBC_SHA
- See Also:
- Constant Field Values
-
SSL3_DH_DSS_WITH_3DES_EDE_CBC_SHA
@Deprecated public static final int SSL3_DH_DSS_WITH_3DES_EDE_CBC_SHA
Deprecated.Replaced with TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA.- See Also:
- Constant Field Values
-
TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA
public static final int TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA
- See Also:
- Constant Field Values
-
SSL3_DH_RSA_EXPORT_WITH_DES40_CBC_SHA
public static final int SSL3_DH_RSA_EXPORT_WITH_DES40_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA
public static final int TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA
- See Also:
- Constant Field Values
-
SSL3_DH_RSA_WITH_DES_CBC_SHA
@Deprecated public static final int SSL3_DH_RSA_WITH_DES_CBC_SHA
Deprecated.Replaced with TLS_DH_RSA_WITH_DES_CBC_SHA.- See Also:
- Constant Field Values
-
TLS_DH_RSA_WITH_DES_CBC_SHA
public static final int TLS_DH_RSA_WITH_DES_CBC_SHA
- See Also:
- Constant Field Values
-
SSL3_DH_RSA_WITH_3DES_EDE_CBC_SHA
@Deprecated public static final int SSL3_DH_RSA_WITH_3DES_EDE_CBC_SHA
Deprecated.Replaced with TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA.- See Also:
- Constant Field Values
-
TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA
public static final int TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA
- See Also:
- Constant Field Values
-
SSL3_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA
public static final int SSL3_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA
public static final int TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA
- See Also:
- Constant Field Values
-
SSL3_DHE_DSS_WITH_DES_CBC_SHA
@Deprecated public static final int SSL3_DHE_DSS_WITH_DES_CBC_SHA
Deprecated.Replaced with TLS_DHE_DSS_WITH_DES_CBC_SHA.- See Also:
- Constant Field Values
-
TLS_DHE_DSS_WITH_DES_CBC_SHA
public static final int TLS_DHE_DSS_WITH_DES_CBC_SHA
- See Also:
- Constant Field Values
-
SSL3_DHE_DSS_WITH_3DES_EDE_CBC_SHA
@Deprecated public static final int SSL3_DHE_DSS_WITH_3DES_EDE_CBC_SHA
Deprecated.Replaced with TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA.- See Also:
- Constant Field Values
-
TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA
public static final int TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA
- See Also:
- Constant Field Values
-
SSL3_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA
public static final int SSL3_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA
public static final int TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA
- See Also:
- Constant Field Values
-
SSL3_DHE_RSA_WITH_DES_CBC_SHA
@Deprecated public static final int SSL3_DHE_RSA_WITH_DES_CBC_SHA
Deprecated.Replaced with TLS_DHE_RSA_WITH_DES_CBC_SHA.- See Also:
- Constant Field Values
-
TLS_DHE_RSA_WITH_DES_CBC_SHA
public static final int TLS_DHE_RSA_WITH_DES_CBC_SHA
- See Also:
- Constant Field Values
-
SSL3_DHE_RSA_WITH_3DES_EDE_CBC_SHA
@Deprecated public static final int SSL3_DHE_RSA_WITH_3DES_EDE_CBC_SHA
Deprecated.Replaced with TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA.- See Also:
- Constant Field Values
-
TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA
public static final int TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA
- See Also:
- Constant Field Values
-
SSL3_DH_ANON_EXPORT_WITH_RC4_40_MD5
public static final int SSL3_DH_ANON_EXPORT_WITH_RC4_40_MD5
- See Also:
- Constant Field Values
-
TLS_DH_anon_EXPORT_WITH_RC4_40_MD5
public static final int TLS_DH_anon_EXPORT_WITH_RC4_40_MD5
- See Also:
- Constant Field Values
-
SSL3_DH_ANON_WITH_RC4_128_MD5
@Deprecated public static final int SSL3_DH_ANON_WITH_RC4_128_MD5
Deprecated.Replaced with TLS_DH_anon_WITH_RC4_128_MD5.- See Also:
- Constant Field Values
-
TLS_DH_anon_WITH_RC4_128_MD5
public static final int TLS_DH_anon_WITH_RC4_128_MD5
- See Also:
- Constant Field Values
-
SSL3_DH_ANON_EXPORT_WITH_DES40_CBC_SHA
public static final int SSL3_DH_ANON_EXPORT_WITH_DES40_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA
public static final int TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA
- See Also:
- Constant Field Values
-
SSL3_DH_ANON_WITH_DES_CBC_SHA
@Deprecated public static final int SSL3_DH_ANON_WITH_DES_CBC_SHA
Deprecated.Replaced with TLS_DH_anon_WITH_DES_CBC_SHA.- See Also:
- Constant Field Values
-
TLS_DH_anon_WITH_DES_CBC_SHA
public static final int TLS_DH_anon_WITH_DES_CBC_SHA
- See Also:
- Constant Field Values
-
SSL3_DH_ANON_WITH_3DES_EDE_CBC_SHA
@Deprecated public static final int SSL3_DH_ANON_WITH_3DES_EDE_CBC_SHA
Deprecated.Replaced with TLS_DH_anon_WITH_3DES_EDE_CBC_SHA.- See Also:
- Constant Field Values
-
TLS_DH_anon_WITH_3DES_EDE_CBC_SHA
public static final int TLS_DH_anon_WITH_3DES_EDE_CBC_SHA
- See Also:
- Constant Field Values
-
SSL3_FORTEZZA_DMS_WITH_NULL_SHA
@Deprecated public static final int SSL3_FORTEZZA_DMS_WITH_NULL_SHA
Deprecated.As of NSS 3.11, FORTEZZA is no longer supported.- See Also:
- Constant Field Values
-
SSL3_FORTEZZA_DMS_WITH_FORTEZZA_CBC_SHA
@Deprecated public static final int SSL3_FORTEZZA_DMS_WITH_FORTEZZA_CBC_SHA
Deprecated.As of NSS 3.11, FORTEZZA is no longer supported.- See Also:
- Constant Field Values
-
SSL3_FORTEZZA_DMS_WITH_RC4_128_SHA
@Deprecated public static final int SSL3_FORTEZZA_DMS_WITH_RC4_128_SHA
Deprecated.As of NSS 3.11, FORTEZZA is no longer supported.- See Also:
- Constant Field Values
-
SSL_RSA_FIPS_WITH_3DES_EDE_CBC_SHA
public static final int SSL_RSA_FIPS_WITH_3DES_EDE_CBC_SHA
- See Also:
- Constant Field Values
-
SSL_RSA_FIPS_WITH_DES_CBC_SHA
public static final int SSL_RSA_FIPS_WITH_DES_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_RSA_EXPORT1024_WITH_DES_CBC_SHA
public static final int TLS_RSA_EXPORT1024_WITH_DES_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_RSA_EXPORT1024_WITH_RC4_56_SHA
public static final int TLS_RSA_EXPORT1024_WITH_RC4_56_SHA
- See Also:
- Constant Field Values
-
TLS_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA
public static final int TLS_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA
public static final int TLS_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA
- See Also:
- Constant Field Values
-
TLS_DHE_DSS_WITH_RC4_128_SHA
public static final int TLS_DHE_DSS_WITH_RC4_128_SHA
- See Also:
- Constant Field Values
-
TLS_DHE_RSA_WITH_AES_128_CBC_SHA256
public static final int TLS_DHE_RSA_WITH_AES_128_CBC_SHA256
- See Also:
- Constant Field Values
-
TLS_DHE_DSS_WITH_AES_256_CBC_SHA256
public static final int TLS_DHE_DSS_WITH_AES_256_CBC_SHA256
- See Also:
- Constant Field Values
-
TLS_DHE_RSA_WITH_AES_256_CBC_SHA256
public static final int TLS_DHE_RSA_WITH_AES_256_CBC_SHA256
- See Also:
- Constant Field Values
-
TLS_RSA_WITH_AES_128_CBC_SHA
public static final int TLS_RSA_WITH_AES_128_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_DH_DSS_WITH_AES_128_CBC_SHA
public static final int TLS_DH_DSS_WITH_AES_128_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_DH_RSA_WITH_AES_128_CBC_SHA
public static final int TLS_DH_RSA_WITH_AES_128_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_DHE_DSS_WITH_AES_128_CBC_SHA
public static final int TLS_DHE_DSS_WITH_AES_128_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_DHE_RSA_WITH_AES_128_CBC_SHA
public static final int TLS_DHE_RSA_WITH_AES_128_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_DH_ANON_WITH_AES_128_CBC_SHA
@Deprecated public static final int TLS_DH_ANON_WITH_AES_128_CBC_SHA
Deprecated.Replaced with TLS_DH_anon_WITH_AES_128_CBC_SHA.- See Also:
- Constant Field Values
-
TLS_DH_anon_WITH_AES_128_CBC_SHA
public static final int TLS_DH_anon_WITH_AES_128_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_RSA_WITH_AES_256_CBC_SHA
public static final int TLS_RSA_WITH_AES_256_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_DH_DSS_WITH_AES_256_CBC_SHA
public static final int TLS_DH_DSS_WITH_AES_256_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_DH_RSA_WITH_AES_256_CBC_SHA
public static final int TLS_DH_RSA_WITH_AES_256_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_DHE_DSS_WITH_AES_256_CBC_SHA
public static final int TLS_DHE_DSS_WITH_AES_256_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_DHE_RSA_WITH_AES_256_CBC_SHA
public static final int TLS_DHE_RSA_WITH_AES_256_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_DH_ANON_WITH_AES_256_CBC_SHA
@Deprecated public static final int TLS_DH_ANON_WITH_AES_256_CBC_SHA
Deprecated.Replaced with TLS_DH_anon_WITH_AES_256_CBC_SHA.- See Also:
- Constant Field Values
-
TLS_DH_anon_WITH_AES_256_CBC_SHA
public static final int TLS_DH_anon_WITH_AES_256_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_RSA_WITH_NULL_SHA256
public static final int TLS_RSA_WITH_NULL_SHA256
- See Also:
- Constant Field Values
-
TLS_RSA_WITH_AES_128_CBC_SHA256
public static final int TLS_RSA_WITH_AES_128_CBC_SHA256
- See Also:
- Constant Field Values
-
TLS_RSA_WITH_AES_256_CBC_SHA256
public static final int TLS_RSA_WITH_AES_256_CBC_SHA256
- See Also:
- Constant Field Values
-
TLS_DHE_DSS_WITH_AES_128_CBC_SHA256
public static final int TLS_DHE_DSS_WITH_AES_128_CBC_SHA256
- See Also:
- Constant Field Values
-
TLS_RSA_WITH_CAMELLIA_128_CBC_SHA
public static final int TLS_RSA_WITH_CAMELLIA_128_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA
public static final int TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA
public static final int TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA
public static final int TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA
public static final int TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_DH_ANON_WITH_CAMELLIA_128_CBC_SHA
@Deprecated public static final int TLS_DH_ANON_WITH_CAMELLIA_128_CBC_SHA
Deprecated.Replaced with TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA.- See Also:
- Constant Field Values
-
TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA
public static final int TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_RSA_WITH_CAMELLIA_256_CBC_SHA
public static final int TLS_RSA_WITH_CAMELLIA_256_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA
public static final int TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA
public static final int TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA
public static final int TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA
public static final int TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_DH_ANON_WITH_CAMELLIA_256_CBC_SHA
@Deprecated public static final int TLS_DH_ANON_WITH_CAMELLIA_256_CBC_SHA
Deprecated.Replaced with TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA.- See Also:
- Constant Field Values
-
TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA
public static final int TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_RSA_WITH_SEED_CBC_SHA
public static final int TLS_RSA_WITH_SEED_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_RSA_WITH_AES_128_GCM_SHA256
public static final int TLS_RSA_WITH_AES_128_GCM_SHA256
- See Also:
- Constant Field Values
-
TLS_RSA_WITH_AES_256_GCM_SHA384
public static final int TLS_RSA_WITH_AES_256_GCM_SHA384
- See Also:
- Constant Field Values
-
TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
public static final int TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
- See Also:
- Constant Field Values
-
TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
public static final int TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
- See Also:
- Constant Field Values
-
TLS_DHE_DSS_WITH_AES_128_GCM_SHA256
public static final int TLS_DHE_DSS_WITH_AES_128_GCM_SHA256
- See Also:
- Constant Field Values
-
TLS_DHE_DSS_WITH_AES_256_GCM_SHA384
public static final int TLS_DHE_DSS_WITH_AES_256_GCM_SHA384
- See Also:
- Constant Field Values
-
TLS_DHE_PSK_WITH_AES_128_GCM_SHA256
public static final int TLS_DHE_PSK_WITH_AES_128_GCM_SHA256
- See Also:
- Constant Field Values
-
TLS_DHE_PSK_WITH_AES_256_GCM_SHA384
public static final int TLS_DHE_PSK_WITH_AES_256_GCM_SHA384
- See Also:
- Constant Field Values
-
TLS_EMPTY_RENEGOTIATION_INFO_SCSV
public static final int TLS_EMPTY_RENEGOTIATION_INFO_SCSV
- See Also:
- Constant Field Values
-
TLS_FALLBACK_SCSV
public static final int TLS_FALLBACK_SCSV
- See Also:
- Constant Field Values
-
TLS_ECDH_ECDSA_WITH_NULL_SHA
public static final int TLS_ECDH_ECDSA_WITH_NULL_SHA
- See Also:
- Constant Field Values
-
TLS_ECDH_ECDSA_WITH_RC4_128_SHA
public static final int TLS_ECDH_ECDSA_WITH_RC4_128_SHA
- See Also:
- Constant Field Values
-
TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA
public static final int TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA
public static final int TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA
public static final int TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_ECDHE_ECDSA_WITH_NULL_SHA
public static final int TLS_ECDHE_ECDSA_WITH_NULL_SHA
- See Also:
- Constant Field Values
-
TLS_ECDHE_ECDSA_WITH_RC4_128_SHA
public static final int TLS_ECDHE_ECDSA_WITH_RC4_128_SHA
- See Also:
- Constant Field Values
-
TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA
public static final int TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
public static final int TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
public static final int TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_ECDH_RSA_WITH_NULL_SHA
public static final int TLS_ECDH_RSA_WITH_NULL_SHA
- See Also:
- Constant Field Values
-
TLS_ECDH_RSA_WITH_RC4_128_SHA
public static final int TLS_ECDH_RSA_WITH_RC4_128_SHA
- See Also:
- Constant Field Values
-
TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA
public static final int TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_ECDH_RSA_WITH_AES_128_CBC_SHA
public static final int TLS_ECDH_RSA_WITH_AES_128_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_ECDH_RSA_WITH_AES_256_CBC_SHA
public static final int TLS_ECDH_RSA_WITH_AES_256_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_ECDHE_RSA_WITH_NULL_SHA
public static final int TLS_ECDHE_RSA_WITH_NULL_SHA
- See Also:
- Constant Field Values
-
TLS_ECDHE_RSA_WITH_RC4_128_SHA
public static final int TLS_ECDHE_RSA_WITH_RC4_128_SHA
- See Also:
- Constant Field Values
-
TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA
public static final int TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
public static final int TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
public static final int TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_ECDH_anon_WITH_NULL_SHA
public static final int TLS_ECDH_anon_WITH_NULL_SHA
- See Also:
- Constant Field Values
-
TLS_ECDH_anon_WITH_RC4_128_SHA
public static final int TLS_ECDH_anon_WITH_RC4_128_SHA
- See Also:
- Constant Field Values
-
TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA
public static final int TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_ECDH_anon_WITH_AES_128_CBC_SHA
public static final int TLS_ECDH_anon_WITH_AES_128_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_ECDH_anon_WITH_AES_256_CBC_SHA
public static final int TLS_ECDH_anon_WITH_AES_256_CBC_SHA
- See Also:
- Constant Field Values
-
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
public static final int TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
- See Also:
- Constant Field Values
-
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
public static final int TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
- See Also:
- Constant Field Values
-
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
public static final int TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
- See Also:
- Constant Field Values
-
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
public static final int TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
- See Also:
- Constant Field Values
-
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
public static final int TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
- See Also:
- Constant Field Values
-
TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
public static final int TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
- See Also:
- Constant Field Values
-
TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256
public static final int TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256
- See Also:
- Constant Field Values
-
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
public static final int TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
- See Also:
- Constant Field Values
-
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
public static final int TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
- See Also:
- Constant Field Values
-
TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256
public static final int TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256
- See Also:
- Constant Field Values
-
TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
public static final int TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
- See Also:
- Constant Field Values
-
TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
public static final int TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
- See Also:
- Constant Field Values
-
TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256
public static final int TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256
- See Also:
- Constant Field Values
-
TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256
public static final int TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256
- See Also:
- Constant Field Values
-
TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256
public static final int TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256
- See Also:
- Constant Field Values
-
TLS_ECDHE_PSK_WITH_AES_128_GCM_SHA256
public static final int TLS_ECDHE_PSK_WITH_AES_128_GCM_SHA256
- See Also:
- Constant Field Values
-
TLS_ECDHE_PSK_WITH_AES_256_GCM_SHA384
public static final int TLS_ECDHE_PSK_WITH_AES_256_GCM_SHA384
- See Also:
- Constant Field Values
-
TLS_AES_128_GCM_SHA256
public static final int TLS_AES_128_GCM_SHA256
- See Also:
- Constant Field Values
-
TLS_AES_256_GCM_SHA384
public static final int TLS_AES_256_GCM_SHA384
- See Also:
- Constant Field Values
-
TLS_CHACHA20_POLY1305_SHA256
public static final int TLS_CHACHA20_POLY1305_SHA256
- See Also:
- Constant Field Values
-
SSL_REQUIRE_NEVER
public static final int SSL_REQUIRE_NEVER
- See Also:
- Constant Field Values
-
SSL_REQUIRE_ALWAYS
public static final int SSL_REQUIRE_ALWAYS
- See Also:
- Constant Field Values
-
SSL_REQUIRE_FIRST_HANDSHAKE
public static final int SSL_REQUIRE_FIRST_HANDSHAKE
- See Also:
- Constant Field Values
-
SSL_REQUIRE_NO_ERROR
public static final int SSL_REQUIRE_NO_ERROR
- See Also:
- Constant Field Values
-
SSL_RENEGOTIATE_NEVER
public static final int SSL_RENEGOTIATE_NEVER
- See Also:
- Constant Field Values
-
SSL_RENEGOTIATE_REQUIRES_XTN
public static final int SSL_RENEGOTIATE_REQUIRES_XTN
- See Also:
- Constant Field Values
-
SSL_RENEGOTIATE_UNRESTRICTED
public static final int SSL_RENEGOTIATE_UNRESTRICTED
- See Also:
- Constant Field Values
-
SSL_RENEGOTIATE_TRANSITIONAL
public static final int SSL_RENEGOTIATE_TRANSITIONAL
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SSLSocket
public SSLSocket(java.lang.String host, int port) throws java.net.UnknownHostException, java.io.IOExceptionCreates an SSL client socket and connects to the specified host and port.- Parameters:
host- The hostname to connect to.port- The port to connect to.- Throws:
java.net.UnknownHostExceptionjava.io.IOException
-
SSLSocket
public SSLSocket(java.net.InetAddress address, int port) throws java.io.IOExceptionCreates an SSL client socket and connects to the specified address and port.- Parameters:
address- The IP address to connect to.port- The port to connect to.- Throws:
java.io.IOException
-
SSLSocket
public SSLSocket(java.lang.String host, int port, java.net.InetAddress localAddr, int localPort) throws java.io.IOExceptionCreates an SSL client socket and connects to the specified host and port. Binds to the given local address and port.- Parameters:
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.- Throws:
java.io.IOException
-
SSLSocket
public SSLSocket(java.net.InetAddress address, int port, java.net.InetAddress localAddr, int localPort) throws java.io.IOExceptionCreates an SSL client socket and connects to the specified address and port. Binds to the given local address and port.- Parameters:
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.- Throws:
java.io.IOException
-
SSLSocket
public SSLSocket(java.lang.String host, int port, java.net.InetAddress localAddr, int localPort, SSLCertificateApprovalCallback certApprovalCallback, SSLClientCertificateSelectionCallback clientCertSelectionCallback) throws java.io.IOExceptionCreates an SSL client socket and connects to the specified host and port. Binds to the given local address and port. Installs the given callbacks for certificate approval and client certificate selection.- Parameters:
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.- Throws:
java.io.IOException
-
SSLSocket
@Deprecated public SSLSocket(java.net.InetAddress address, int port, java.net.InetAddress localAddr, int localPort, boolean stream, SSLCertificateApprovalCallback certApprovalCallback, SSLClientCertificateSelectionCallback clientCertSelectionCallback) throws java.io.IOExceptionDeprecated.As of JSS 3.0. The stream parameter is ignored, because only stream sockets are supported.Creates an SSL client socket and connects to the specified address and port. Binds to the given local address and port. Installs the given callbacks for certificate approval and client certificate selection.- Parameters:
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.- Throws:
java.io.IOException
-
SSLSocket
public SSLSocket(java.net.InetAddress address, int port, java.net.InetAddress localAddr, int localPort, SSLCertificateApprovalCallback certApprovalCallback, SSLClientCertificateSelectionCallback clientCertSelectionCallback) throws java.io.IOExceptionCreates an SSL client socket and connects to the specified address and port. Binds to the given local address and port. Installs the given callbacks for certificate approval and client certificate selection.- Parameters:
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.- Throws:
java.io.IOException
-
SSLSocket
public SSLSocket(java.net.Socket s, java.lang.String host, SSLCertificateApprovalCallback certApprovalCallback, SSLClientCertificateSelectionCallback clientCertSelectionCallback) throws java.io.IOExceptionCreates an SSL client socket using the given Java socket for underlying I/O. Installs the given callbacks for certificate approval and client certificate selection.- Parameters:
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.- Throws:
java.io.IOException
-
-
Method Detail
-
getInetAddress
public java.net.InetAddress getInetAddress()
- Overrides:
getInetAddressin classjava.net.Socket- Returns:
- The remote peer's IP address or null if the SSLSocket is closed.
-
getLocalAddress
public java.net.InetAddress getLocalAddress()
- Overrides:
getLocalAddressin classjava.net.Socket- Returns:
- The local IP address or null if the SSLSocket is closed.
-
getLocalPort
public int getLocalPort()
- Overrides:
getLocalPortin classjava.net.Socket- Returns:
- The local port or -1 if the SSLSocket is closed.
-
getPort
public int getPort()
- Overrides:
getPortin classjava.net.Socket- Returns:
- The remote port.
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOExceptionReturns the input stream for reading from this socket.- Overrides:
getInputStreamin classjava.net.Socket- Throws:
java.io.IOException
-
getOutputStream
public java.io.OutputStream getOutputStream() throws java.io.IOExceptionReturns the output stream for writing to this socket.- Overrides:
getOutputStreamin classjava.net.Socket- Throws:
java.io.IOException
-
setTcpNoDelay
public void setTcpNoDelay(boolean on) throws java.net.SocketExceptionEnables or disables the TCP_NO_DELAY socket option. Enabling this option will disable the Nagle algorithm.- Overrides:
setTcpNoDelayin classjava.net.Socket- Throws:
java.net.SocketException
-
getTcpNoDelay
public boolean getTcpNoDelay() throws java.net.SocketExceptionReturns the current setting of the TCP_NO_DELAY socket option.- Overrides:
getTcpNoDelayin classjava.net.Socket- Throws:
java.net.SocketException
-
setKeepAlive
public void setKeepAlive(boolean on) throws java.net.SocketExceptionEnables or disables the SO_KEEPALIVE socket option.- Overrides:
setKeepAlivein classjava.net.Socket- Throws:
java.net.SocketException
-
getKeepAlive
public boolean getKeepAlive() throws java.net.SocketExceptionReturns the current setting of the SO_KEEPALIVE socket option.- Overrides:
getKeepAlivein classjava.net.Socket- Throws:
java.net.SocketException
-
shutdownInput
public void shutdownInput() throws java.io.IOExceptionShuts down the input side of the socket.- Overrides:
shutdownInputin classjava.net.Socket- Throws:
java.io.IOException
-
shutdownOutput
public void shutdownOutput() throws java.io.IOExceptionShuts down the output side of the socket.- Overrides:
shutdownOutputin classjava.net.Socket- Throws:
java.io.IOException
-
setSoLinger
public void setSoLinger(boolean on, int linger) throws java.net.SocketExceptionSets the SO_LINGER socket option. param linger The time (in seconds) to linger for.- Overrides:
setSoLingerin classjava.net.Socket- Throws:
java.net.SocketException
-
getSoLinger
public int getSoLinger() throws java.net.SocketExceptionReturns the current value of the SO_LINGER socket option.- Overrides:
getSoLingerin classjava.net.Socket- Throws:
java.net.SocketException
-
setSoTimeout
public void setSoTimeout(int timeout) throws java.net.SocketExceptionSets the SO_TIMEOUT socket option.- Overrides:
setSoTimeoutin classjava.net.Socket- Parameters:
timeout- The timeout time in milliseconds.- Throws:
java.net.SocketException
-
getSoTimeout
public int getSoTimeout() throws java.net.SocketExceptionReturns the current value of the SO_TIMEOUT socket option.- Overrides:
getSoTimeoutin classjava.net.Socket- Returns:
- The timeout time in milliseconds.
- Throws:
java.net.SocketException
-
setSendBufferSize
public void setSendBufferSize(int size) throws java.net.SocketExceptionSets the size (in bytes) of the send buffer.- Overrides:
setSendBufferSizein classjava.net.Socket- Throws:
java.net.SocketException
-
getSendBufferSize
public int getSendBufferSize() throws java.net.SocketExceptionReturns the size (in bytes) of the send buffer.- Overrides:
getSendBufferSizein classjava.net.Socket- Throws:
java.net.SocketException
-
setReceiveBufferSize
public void setReceiveBufferSize(int size) throws java.net.SocketExceptionSets the size (in bytes) of the receive buffer.- Overrides:
setReceiveBufferSizein classjava.net.Socket- Throws:
java.net.SocketException
-
getReceiveBufferSize
public int getReceiveBufferSize() throws java.net.SocketExceptionReturnst he size (in bytes) of the receive buffer.- Overrides:
getReceiveBufferSizein classjava.net.Socket- Throws:
java.net.SocketException
-
close
public void close() throws java.io.IOExceptionCloses this socket.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.net.Socket- Throws:
java.io.IOException
-
addSocketListener
public void addSocketListener(SSLSocketListener listener)
-
removeSocketListener
public void removeSocketListener(SSLSocketListener listener)
-
addHandshakeCompletedListener
public void addHandshakeCompletedListener(SSLHandshakeCompletedListener listener)
Adds a listener to be notified when an SSL handshake completes.
-
removeHandshakeCompletedListener
public void removeHandshakeCompletedListener(SSLHandshakeCompletedListener listener)
Removes a previously registered listener for handshake completion.
-
enableSSL2
public void enableSSL2(boolean enable) throws java.net.SocketExceptionEnables SSL v2 on this socket. It is enabled by default, unless the default has been changed withenableSSL2Default.- Throws:
java.net.SocketException
-
enableSSL2Default
public static void enableSSL2Default(boolean enable) throws java.net.SocketExceptionSets the default for SSL v2 for all new sockets.- Throws:
java.net.SocketException
-
enableSSL3
public void enableSSL3(boolean enable) throws java.net.SocketExceptionEnables SSL v3 on this socket. It is enabled by default, unless the default has been changed withenableSSL3Default.- Throws:
java.net.SocketException
-
enableSSL3Default
public static void enableSSL3Default(boolean enable) throws java.net.SocketExceptionSets the default for SSL v3 for all new sockets.- Throws:
java.net.SocketException
-
enableTLS
public void enableTLS(boolean enable) throws java.net.SocketExceptionEnables TLS on this socket. It is enabled by default, unless the default has been changed withenableTLSDefault.- Throws:
java.net.SocketException
-
enableTLSDefault
public static void enableTLSDefault(boolean enable) throws java.net.SocketExceptionSets the default for TLS for all new sockets.- Throws:
java.net.SocketException
-
enableSessionTickets
public void enableSessionTickets(boolean enable) throws java.net.SocketExceptionEnables Session tickets on this socket. It is disabled by default, unless the default has been changed withenableSessionTicketsDefault.- Throws:
java.net.SocketException
-
enableSessionTicketsDefault
public static void enableSessionTicketsDefault(boolean enable) throws java.net.SocketExceptionSets the default for Session Tickets for all new sockets.- Throws:
java.net.SocketException
-
enableRenegotiation
public void enableRenegotiation(int mode) throws java.net.SocketExceptionEnables the mode of renegotiation that the peer must use on this socket. Default is never renegotiate at all. Unless the default has been changed withSSLSocket.enableRenegotiationDefault.- Parameters:
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.- Throws:
java.net.SocketException
-
enableRenegotiationDefault
public static void enableRenegotiationDefault(int mode) throws java.net.SocketExceptionSet the mode of renegotiation that the peer must use for all new sockets. The default is never renegotiate at all.- Parameters:
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.- Throws:
java.net.SocketException
-
enableRequireSafeNegotiation
public void enableRequireSafeNegotiation(boolean enable) throws java.net.SocketExceptionFor this socket require that the peer must send Signaling Cipher Suite Value (SCSV) or Renegotiation Info (RI) extension in ALL handshakes. It is disabled by default, unless the default has been changed withSSLSocket.enableRequireSafeNegotiationDefault.- Throws:
java.net.SocketException
-
enableRequireSafeNegotiationDefault
public static void enableRequireSafeNegotiationDefault(boolean enable) throws java.net.SocketExceptionFor this socket require that the peer must send Signaling Cipher Suite Value (SCSV) or Renegotiation Info (RI) extension in ALL handshakes. It is disabled by default.- Throws:
java.net.SocketException
-
enableRollbackDetection
public void enableRollbackDetection(boolean enable) throws java.net.SocketExceptionEnable rollback detection for this socket. It is enabled by default, unless the default has been changed withenableRollbackDetectionDefault.- Throws:
java.net.SocketException
-
enableStepDown
public void enableStepDown(boolean enable) throws java.net.SocketExceptionThis option, enableStepDown, is concerned with the generation of step-down keys which are used with export suites. If the server cert's public key is 512 bits or less this option is ignored because step-down keys don't need to be generated. If the server cert's public key is more than 512 bits, this option has the following effect: enable=true: generate step-down keys enable=false: don't generate step-down keys; disable export cipher suites This option is enabled by default; unless the default has been changed withSSLSocket.enableStepDownDefault.- Throws:
java.net.SocketException
-
enableFDX
public void enableFDX(boolean enable) throws java.net.SocketExceptionEnable simultaneous read/write by separate read and write threads (full duplex) for this socket. It is disabled by default, unless the default has been changed withenableFDXDefault.- Throws:
java.net.SocketException
-
enableV2CompatibleHello
public void enableV2CompatibleHello(boolean enable) throws java.net.SocketExceptionEnable sending v3 client hello in v2 format for this socket. It is enabled by default, unless the default has been changed withenableV2CompatibleHelloDefault.- Throws:
java.net.SocketException
-
getSSLOptions
public java.lang.String getSSLOptions()
- Returns:
- a String listing the current SSLOptions for this SSLSocket.
-
getSSLDefaultOptions
public static java.lang.String getSSLDefaultOptions()
- Returns:
- a String listing the Default SSLOptions for all SSLSockets.
-
requireClientAuth
@Deprecated public void requireClientAuth(boolean require, boolean onRedo) throws java.net.SocketExceptionDeprecated.use requireClientAuth(int)Sets whether the socket requires client authentication from the remote peer. If requestClientAuth() has not already been called, this method will tell the socket to request client auth as well as requiring it.- Throws:
java.net.SocketException
-
requireClientAuth
public void requireClientAuth(int mode) throws java.net.SocketExceptionSets whether the socket requires client authentication from the remote peer. If requestClientAuth() has not already been called, this method will tell the socket to request client auth as well as requiring it. This is only meaningful for the server end of the SSL connection. During the next handshake, the remote peer will be asked to authenticate itself with the requirement that was set.- Parameters:
mode- One of: SSLSocket.SSL_REQUIRE_NEVER, SSLSocket.SSL_REQUIRE_ALWAYS, SSLSocket.SSL_REQUIRE_FIRST_HANDSHAKE, SSLSocket.SSL_REQUIRE_NO_ERROR- Throws:
java.net.SocketException
-
requireClientAuthDefault
@Deprecated public void requireClientAuthDefault(boolean require, boolean onRedo) throws java.net.SocketExceptionDeprecated.use requireClientAuthDefault(int)Sets the default setting for requiring client authorization. All subsequently created sockets will use this default setting.- Throws:
java.net.SocketException
-
requireClientAuthDefault
public static void requireClientAuthDefault(int mode) throws java.net.SocketExceptionSets the default setting for requiring client authorization. All subsequently created sockets will use this default setting This is only meaningful for the server end of the SSL connection.- Parameters:
mode- One of: SSLSocket.SSL_REQUIRE_NEVER, SSLSocket.SSL_REQUIRE_ALWAYS, SSLSocket.SSL_REQUIRE_FIRST_HANDSHAKE, SSLSocket.SSL_REQUIRE_NO_ERROR- Throws:
java.net.SocketException
-
forceHandshake
public void forceHandshake() throws java.net.SocketExceptionForce an already started SSL handshake to complete. This method should block until the handshake has completed.- Throws:
java.net.SocketException
-
setUseClientMode
public void setUseClientMode(boolean b)
Determines whether this end of the socket is the client or the server for purposes of the SSL protocol. By default, it is the client.- Parameters:
b- true if this end of the socket is the SSL slient, false if it is the SSL server.
-
getUseClientMode
public boolean getUseClientMode()
- Returns:
- true if this end of the socket is the SSL client, false if it is the SSL server.
-
resetHandshake
public void resetHandshake() throws java.net.SocketExceptionResets the handshake state.- Throws:
java.net.SocketException
-
getStatus
public SSLSecurityStatus getStatus() throws java.net.SocketException
Returns the security status of this socket.- Throws:
java.net.SocketException
-
setClientCertNickname
public void setClientCertNickname(java.lang.String nick) throws java.net.SocketExceptionSets the nickname of the certificate to use for client authentication. Alternately, you can specify an SSLClientCertificateSelectionCallback, which will receive a list of certificates that are valid for client authentication.- Throws:
java.net.SocketException- See Also:
SSLClientCertificateSelectionCallback
-
setClientCert
public void setClientCert(X509Certificate cert) throws java.net.SocketException
Sets the certificate to use for client authentication. Alternately, you can specify an SSLClientCertificateSelectionCallback, which will receive a list of certificates that are valid for client authentication.- Throws:
java.net.SocketException- See Also:
SSLClientCertificateSelectionCallback
-
requestClientAuth
public void requestClientAuth(boolean b) throws java.net.SocketExceptionEnables/disables the request of client authentication. This is only meaningful for the server end of the SSL connection. During the next handshake, the remote peer will be asked to authenticate itself.- Throws:
java.net.SocketException- See Also:
requireClientAuth(boolean, boolean)
-
setNeedClientAuth
@Deprecated public void setNeedClientAuth(boolean b) throws java.net.SocketExceptionDeprecated.As of JSS 3.0. This method is misnamed. UserequestClientAuthinstead.- Throws:
java.net.SocketException
-
setNeedClientAuthNoExpiryCheck
@Deprecated public void setNeedClientAuthNoExpiryCheck(boolean b) throws java.net.SocketExceptionDeprecated.As of JSS 3.0. This method is misnamed. UserequestClientAuthNoExpiryCheckinstead.Enables/disables the request of client authentication. This is only meaningful for the server end of the SSL connection. During the next handshake, the remote peer will be asked to authenticate itself.In addition, the client certificate's expiration will not prevent it from being accepted.
- Throws:
java.net.SocketException- See Also:
public void requestClientAuthNoExpiryCheck(boolean b) throws SocketException { base.requestClientAuthNoExpiryCheck(b); } /**
-
useCache
public void useCache(boolean b) throws java.net.SocketExceptionEnables/disables the session cache. By default, the session cache is enabled.- Throws:
java.net.SocketException
-
useCacheDefault
public void useCacheDefault(boolean b) throws java.net.SocketExceptionSets the default setting for use of the session cache.- Throws:
java.net.SocketException
-
setSSLVersionRangeDefault
public static void setSSLVersionRangeDefault(SSLProtocolVariant ssl_variant, SSLVersionRange range) throws java.net.SocketException
- Throws:
java.net.SocketException
-
boundSSLVersionRange
public static SSLVersionRange boundSSLVersionRange(SSLProtocolVariant ssl_variant, SSLVersionRange range) throws java.net.SocketException
- Throws:
java.net.SocketException
-
setCipherPreference
public void setCipherPreference(int cipher, boolean enable) throws java.net.SocketExceptionEnables/disables the cipher on this socket.- Throws:
java.net.SocketException
-
getCipherPreference
public boolean getCipherPreference(int cipher) throws java.net.SocketExceptionReturns whether this cipher is enabled or disabled on this socket.- Throws:
java.net.SocketException
-
setCipherPreferenceDefault
public static void setCipherPreferenceDefault(int cipher, boolean enable) throws java.net.SocketExceptionSets the default for whether this cipher is enabled or disabled.- Throws:
java.net.SocketException
-
getCipherPreferenceDefault
public static boolean getCipherPreferenceDefault(int cipher) throws java.net.SocketExceptionReturns the default for whether this cipher is enabled or disabled.- Throws:
java.net.SocketException
-
invalidateSession
public void invalidateSession() throws java.net.SocketExceptionRemoves the current session from the session cache.- Throws:
java.net.SocketException
-
redoHandshake
public void redoHandshake() throws java.net.SocketExceptionCauses SSL to begin a full, new SSL 3.0 handshake from scratch on a connection that has already completed one handshake.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.
- Throws:
java.net.SocketException
-
redoHandshake
public void redoHandshake(boolean flushCache) throws java.net.SocketExceptionCauses SSL to begin a full, new SSL 3.0 handshake from scratch on a connection that has already completed one handshake.- Parameters:
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.- Throws:
java.net.SocketException
-
finalize
@Deprecated protected void finalize() throws java.lang.ThrowableDeprecated.finalize() in Object has been deprecated- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable
-
setCipherPolicy
public static void setCipherPolicy(CipherPolicy cp) throws java.net.SocketException
Sets the SSL cipher policy. This must be called before creating any SSL sockets.- Throws:
java.net.SocketException
-
toString
public 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.- Overrides:
toStringin classjava.net.Socket
-
isFipsCipherSuite
public static boolean isFipsCipherSuite(int ciphersuite) throws java.net.SocketExceptionisFipsCipherSuite- Returns:
- true if the ciphersuite isFIPS, false otherwise
- Throws:
java.net.SocketException
-
getImplementedCipherSuites
public static int[] getImplementedCipherSuites()
Returns a list of cipher suites that are implemented by NSS. Each element in the array will be one of the cipher suite constants defined in this class (for example,TLS_RSA_WITH_AES_128_CBC_SHA).
-
-