|
JSS 3.1.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.net.Socket | +--org.mozilla.jss.ssl.SSLSocket
SSL client socket.
Inner Class Summary | |
static class |
SSLSocket.CipherPolicy
|
Fields inherited from class java.net.Socket |
factory, impl |
Constructor Summary | |
(package private) |
SSLSocket()
For sockets that get created by accept(). |
|
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. |
private |
SSLSocket(java.net.InetAddress address,
java.lang.String hostname,
int port,
java.net.InetAddress localAddr,
int localPort,
SSLCertificateApprovalCallback certApprovalCallback,
SSLClientCertificateSelectionCallback clientCertSelectionCallback)
|
|
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. |
Method Summary | |
void |
addHandshakeCompletedListener(SSLHandshakeCompletedListener l)
Adds a listener to be notified when an SSL handshake completes. |
void |
close()
Closes this socket. |
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 v2 for all new sockets. |
protected void |
finalize()
|
void |
forceHandshake()
Force an already started SSL handshake to complete. |
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()
|
private int |
getLocalAddressNative()
|
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. |
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. |
private void |
notifyAllHandshakeListeners()
|
(package private) int |
read(byte[] b,
int off,
int len)
|
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 l)
Removes a previously registered listener for handshake completion. |
void |
requestClientAuth(boolean b)
Enables/disables the request of client authentication. |
void |
requireClientAuth(boolean require,
boolean onRedo)
Sets whether the socket requires client authentication from the remote peer. |
void |
requireClientAuthDefault(boolean require,
boolean onRedo)
Sets the default setting for requiring client authorization. |
void |
resetHandshake()
Resets the handshake state. |
private void |
resetHandshakeNative(boolean asClient)
|
static void |
setCipherPolicy(SSLSocket.CipherPolicy cp)
Sets the SSL cipher policy. |
private static void |
setCipherPolicyNative(int policyEnum)
|
static void |
setCipherPreference(int cipher,
boolean enable)
Enables/disables the given cipher on this socket. |
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. |
(package private) void |
setSockProxy(SocketProxy sp)
Should only be called by SSLServerSocket after a successful accept(). |
void |
setSoLinger(boolean on,
int linger)
Sets the SO_LINGER socket option. |
void |
setSoTimeout(int timeout)
Sets the SO_TIMEOUT socket option. |
private static void |
setSSLDefaultOption(int option,
boolean on)
|
private static void |
setSSLDefaultOption(int option,
int on)
|
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. |
private void |
shutdownNative(int how)
|
void |
shutdownOutput()
Shuts down the output side of the socket. |
(package private) int |
socketAvailable()
|
private void |
socketConnect(byte[] addr,
java.lang.String hostname,
int port)
|
private int |
socketRead(byte[] b,
int off,
int len,
int timeout)
|
private void |
socketWrite(byte[] b,
int off,
int len,
int timeout)
|
void |
useCache(boolean b)
Enables/disables the session cache. |
void |
useCacheDefault(boolean b)
Sets the default setting for use of the session cache. |
(package private) void |
write(byte[] b,
int off,
int len)
|
Methods inherited from class java.net.Socket |
setSocketImplFactory, toString |
Methods inherited from class java.lang.Object |
|
Field Detail |
private java.util.Vector handshakeCompletedListeners
private java.net.InetAddress inetAddress
private int port
private SocketProxy sockProxy
private boolean open
private boolean handshakeAsClient
private SocketBase base
public 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_DES_64_CBC_WITH_MD5
public static final int SSL2_DES_192_EDE3_CBC_WITH_MD5
public static final int SSL3_RSA_WITH_NULL_MD5
public static final int SSL3_RSA_EXPORT_WITH_RC4_40_MD5
public static final int SSL3_RSA_WITH_RC4_128_MD5
public static final int SSL3_RSA_WITH_RC4_128_SHA
public static final int SSL3_RSA_EXPORT_WITH_RC2_CBC_40_MD5
public static final int SSL3_RSA_WITH_DES_CBC_SHA
public static final int SSL3_RSA_WITH_3DES_EDE_CBC_SHA
public static final int SSL3_FORTEZZA_DMS_WITH_NULL_SHA
public static final int SSL3_FORTEZZA_DMS_WITH_FORTEZZA_CBC_SHA
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
Constructor Detail |
SSLSocket() throws java.io.IOException
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.public SSLSocket(java.net.InetAddress address, int port) throws java.io.IOException
address
- The IP address to connect to.port
- The port to connect to.public 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.public 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.public 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.public SSLSocket(java.net.InetAddress address, int port, java.net.InetAddress localAddr, int localPort, boolean stream, 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.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.public 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.private SSLSocket(java.net.InetAddress address, java.lang.String hostname, int port, java.net.InetAddress localAddr, int localPort, SSLCertificateApprovalCallback certApprovalCallback, SSLClientCertificateSelectionCallback clientCertSelectionCallback) throws java.io.IOException
Method Detail |
void setSockProxy(SocketProxy sp)
public java.net.InetAddress getInetAddress()
getInetAddress
in class java.net.Socket
public java.net.InetAddress getLocalAddress()
getLocalAddress
in class java.net.Socket
private int getLocalAddressNative() throws java.net.SocketException
public int getLocalPort()
getLocalPort
in class java.net.Socket
public int getPort()
getPort
in class java.net.Socket
public java.io.InputStream getInputStream() throws java.io.IOException
getInputStream
in class java.net.Socket
public java.io.OutputStream getOutputStream() throws java.io.IOException
getOutputStream
in class java.net.Socket
public void setTcpNoDelay(boolean on) throws java.net.SocketException
setTcpNoDelay
in class java.net.Socket
public boolean getTcpNoDelay() throws java.net.SocketException
getTcpNoDelay
in class java.net.Socket
public void setKeepAlive(boolean on) throws java.net.SocketException
setKeepAlive
in class java.net.Socket
public boolean getKeepAlive() throws java.net.SocketException
getKeepAlive
in class java.net.Socket
public void shutdownInput() throws java.io.IOException
shutdownInput
in class java.net.Socket
public void shutdownOutput() throws java.io.IOException
shutdownOutput
in class java.net.Socket
private void shutdownNative(int how) throws java.io.IOException
public void setSoLinger(boolean on, int linger) throws java.net.SocketException
setSoLinger
in class java.net.Socket
public int getSoLinger() throws java.net.SocketException
getSoLinger
in class java.net.Socket
public void setSoTimeout(int timeout) throws java.net.SocketException
setSoTimeout
in class java.net.Socket
public int getSoTimeout() throws java.net.SocketException
getSoTimeout
in class java.net.Socket
public void setSendBufferSize(int size) throws java.net.SocketException
setSendBufferSize
in class java.net.Socket
public int getSendBufferSize() throws java.net.SocketException
getSendBufferSize
in class java.net.Socket
public void setReceiveBufferSize(int size) throws java.net.SocketException
setReceiveBufferSize
in class java.net.Socket
public int getReceiveBufferSize() throws java.net.SocketException
getReceiveBufferSize
in class java.net.Socket
public void close() throws java.io.IOException
close
in class java.net.Socket
private void socketConnect(byte[] addr, java.lang.String hostname, int port) throws java.net.SocketException
public void addHandshakeCompletedListener(SSLHandshakeCompletedListener l)
public void removeHandshakeCompletedListener(SSLHandshakeCompletedListener l)
private void notifyAllHandshakeListeners()
public void enableSSL2(boolean enable) throws java.net.SocketException
enableSSL2Default
.public static void enableSSL2Default(boolean enable) throws java.net.SocketException
public void enableSSL3(boolean enable) throws java.net.SocketException
enableSSL3Default
.public static void enableSSL3Default(boolean enable) throws java.net.SocketException
public void requireClientAuth(boolean require, boolean onRedo) throws java.net.SocketException
public void requireClientAuthDefault(boolean require, boolean onRedo) throws java.net.SocketException
public void forceHandshake() throws java.net.SocketException
public 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
private void resetHandshakeNative(boolean asClient) throws java.net.SocketException
public SSLSecurityStatus getStatus() throws java.net.SocketException
public void setClientCertNickname(java.lang.String nick) throws java.net.SocketException
public void requestClientAuth(boolean b) throws java.net.SocketException
requireClientAuth(boolean, boolean)
public void setNeedClientAuth(boolean b) throws java.net.SocketException
requestClientAuth
instead.
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.
public void requestClientAuthNoExpiryCheck(boolean b)
throws SocketException
{
base.requestClientAuthNoExpiryCheck(b);
}
/**
public void useCache(boolean b) throws java.net.SocketException
public void useCacheDefault(boolean b) throws java.net.SocketException
private static void setSSLDefaultOption(int option, boolean on) throws java.net.SocketException
private static void setSSLDefaultOption(int option, int on) throws java.net.SocketException
public static void setCipherPreference(int cipher, boolean enable)
int socketAvailable() throws java.io.IOException
int read(byte[] b, int off, int len) throws java.io.IOException
void write(byte[] b, int off, int len) throws java.io.IOException
private int socketRead(byte[] b, int off, int len, int timeout) throws java.io.IOException
private void socketWrite(byte[] b, int off, int len, int timeout) throws java.io.IOException
public void invalidateSession() throws java.net.SocketException
public 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.
public 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.protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
public static void setCipherPolicy(SSLSocket.CipherPolicy cp) throws java.net.SocketException
private static void setCipherPolicyNative(int policyEnum) throws java.net.SocketException
|
JSS 3.1.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |