public class SSLSocket extends java.net.Socket implements SSLSocketXInt
CLIENT, SERVER| Constructor and Description |
|---|
SSLSocket() |
SSLSocket(SSLContext ctx,
java.net.InetAddress addr,
int port)
Creates a stream socket and connects it to the specified port number at the specified IP address performing the SSL Handshake
|
SSLSocket(SSLContext ctx,
java.net.InetAddress addr,
int port,
java.net.InetAddress localAddr,
int localPort)
Creates a stream socket and connects it to the specified port number at the specified IP address performing the SSL Handshake
|
SSLSocket(SSLContext ctx,
java.io.InputStream input,
java.io.OutputStream output,
java.lang.String host,
int port,
int how)
Create an SSLSocket and connect it to the server on the
using the specified input stream and output stream
|
SSLSocket(SSLContext ctx,
java.net.Socket sock,
java.lang.String host,
int port,
int how)
Create an SSLSocket around the specified socket.
|
SSLSocket(SSLContext ctx,
java.lang.String remote_addr,
int port)
Create an SSLSocket and connect it to the server on the
specified host and port, doing the SSLHandshake
|
SSLSocket(SSLContext ctx,
java.lang.String remote_addr,
java.lang.Integer remote_port)
Create an SSLSocket and connect it to the server on the
specified host and port, doing the SSLHandshake.
|
SSLSocket(SSLContext ctx,
java.lang.String host,
int port,
java.net.InetAddress localAddr,
int localPort)
Creates a stream socket and connects it to the specified port number at the specified host, performing the SSL Handshake
|
| Modifier and Type | Method and Description |
|---|---|
void |
_stompOutputStream(java.io.OutputStream out) |
void |
close()
close the connection.
|
java.util.Vector |
getCertificateChain()
get the certificate chain presented by the peer.
|
int |
getCipherSuite()
Get the cipherSuite in use on this socket, as an
integer
|
java.io.InputStream |
getInputStream()
Get the input stream associated with this socket.
|
java.io.OutputStream |
getOutputStream()
Get the input stream associated with this socket.
|
SSLPolicyInt |
getPolicy()
Get the policy associated with this socket
|
byte[] |
getSessionID()
Get the SessionID associated with this socket
|
int |
getVersion()
Get the version of SSL negotiated.
|
void |
handshake()
Handshake.
|
void |
hardClose()
Hard close.
|
static void |
main(java.lang.String[] args)
Test code
|
void |
renegotiate()
Renegotiate the SSL connection using the same policy
|
void |
renegotiate(SSLPolicyInt policy)
Renegotiate the SSL connection using the given policy
|
void |
sendClose()
Send our half of the SSL close_notify handshake
|
java.lang.String |
toString()
Converts this socket to a string
|
void |
waitForClose(boolean enforceFinished)
Wait to receive a close_notify from the other side.
|
bind, connect, connect, getChannel, getInetAddress, getKeepAlive, getLocalAddress, getLocalPort, getLocalSocketAddress, getOOBInline, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoLinger, getSoTimeout, getTcpNoDelay, getTrafficClass, isBound, isClosed, isConnected, isInputShutdown, isOutputShutdown, sendUrgentData, setKeepAlive, setOOBInline, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSocketImplFactory, setSoLinger, setSoTimeout, setTcpNoDelay, setTrafficClass, shutdownInput, shutdownOutputpublic SSLSocket(SSLContext ctx, java.lang.String remote_addr, java.lang.Integer remote_port) throws java.net.UnknownHostException, java.io.IOException
ctx - the SSLContext to use to create this socketremote_addr - the hostname of the remote machine to connect toremote_port - the port to connect tojava.io.IOException - if something goes wrong in the handshake or making the connectionjava.net.UnknownHostExceptionpublic SSLSocket(SSLContext ctx, java.lang.String remote_addr, int port) throws java.net.UnknownHostException, java.io.IOException
ctx - the SSLContext to use to create this socketremote_addr - the hostname of the remote machine to connect toport - the port to connect tojava.io.IOException - if something goes wrong in the handshake or making the connectionjava.net.UnknownHostExceptionpublic SSLSocket(SSLContext ctx, java.net.InetAddress addr, int port) throws java.io.IOException
ctx - the SSLContext to use to create this socketaddr - the address to connect toport - the port to connect tojava.io.IOException - if something goes wrong in the handshake or making the connection performing the SSL Handshakepublic SSLSocket(SSLContext ctx, java.net.InetAddress addr, int port, java.net.InetAddress localAddr, int localPort) throws java.io.IOException
ctx - the SSLContext to use to create this socketaddr - the address to connect toport - the port to connect tolocalAddr - the local address to bind tolocalPort - the local port to bind tojava.io.IOException - if something goes wrong in the handshake or making the connectionpublic SSLSocket(SSLContext ctx, java.lang.String host, int port, java.net.InetAddress localAddr, int localPort) throws java.io.IOException
ctx - the SSLContext to use to create this sockethost - the address to connect toport - the port to connect tolocalAddr - the local address to bind tolocalPort - the local port to bind tojava.io.IOException - if something goes wrong in the handshake or making the connectionpublic SSLSocket(SSLContext ctx, java.io.InputStream input, java.io.OutputStream output, java.lang.String host, int port, int how) throws java.lang.IllegalArgumentException, java.io.IOException
ctx - the SSLContext to use to create this socketinput - where data is read fromoutput - where data is written toremote_addr - the hostname of the remote machine (used for session resumption)port - the port to connect to (used for session resumption: the host/port pair should be unique)how - which role to take in handshake SSLSocket.CLIENT or SSLSocket.SERVERjava.io.IOException - if something goes wrong in the handshake or making the connectionjava.lang.IllegalArgumentExceptionpublic SSLSocket(SSLContext ctx, java.net.Socket sock, java.lang.String host, int port, int how) throws java.lang.IllegalArgumentException, java.io.IOException
ctx - the SSLContext to use to create this socketsocket - the underlying socket to wrap aroundremote_addr - the hostname of the remote machine (used for session resumption)port - the port to connect to (used for session resumption: the host/port pair should be unique)how - which role to take in handshake SSLSocket.CLIENT or SSLSocket.SERVERjava.io.IOException - if something goes wrong in the handshakejava.lang.IllegalArgumentExceptionpublic SSLSocket()
public void hardClose()
throws java.io.IOException
java.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.net.Socketjava.io.IOException - if there is a problem with the close_notifypublic java.io.InputStream getInputStream()
getInputStream in class java.net.Socketpublic java.io.OutputStream getOutputStream()
getOutputStream in class java.net.Socketpublic java.lang.String toString()
toString in class java.net.Socketpublic int getCipherSuite()
throws java.io.IOException
getCipherSuite in interface SSLSocketXIntjava.io.IOExceptionpublic java.util.Vector getCertificateChain()
throws java.io.IOException
getCertificateChain in interface SSLSocketXIntjava.io.IOExceptionpublic byte[] getSessionID()
throws java.io.IOException
getSessionID in interface SSLSocketXIntjava.io.IOExceptionpublic SSLPolicyInt getPolicy()
getPolicy in interface SSLSocketXIntpublic int getVersion()
throws java.io.IOException
getVersion in interface SSLSocketXIntjava.io.IOExceptionpublic void handshake()
throws java.io.IOException
java.io.IOExceptionpublic void renegotiate(SSLPolicyInt policy) throws java.io.IOException
This is useful (for instance) for a server to renegotiate using client authentication
renegotiate in interface SSLSocketXIntpolicy - the policy to usejava.io.IOException - if something goes wrong in renegotiationpublic void renegotiate()
throws java.io.IOException
This is mainly useful when a client is responding to a server's request for renegotiation
java.io.IOExceptionpublic void sendClose()
throws java.io.IOException
sendClose in interface SSLSocketXIntjava.io.IOException - if the close_notify alert can't be sentpublic void waitForClose(boolean enforceFinished)
throws java.io.IOException
waitForClose in interface SSLSocketXIntenforceFinished - insist that no more data be present on the connection before the close_notify is received. This ensures that the application has read all the data that the peer sentjava.io.IOException - if the close_notify couldn't be read or if enforceFinished is true and more data was present.public void _stompOutputStream(java.io.OutputStream out)
public static void main(java.lang.String[] args)
throws java.net.UnknownHostException,
java.io.IOException
java.net.UnknownHostExceptionjava.io.IOExceptionCopyright (c) 1999-2001 Claymore Systems, Inc., All Rights Reserved.