All Packages Class Hierarchy This Package Previous Next Index
Class iaik.security.ssl.SSLSocket
java.lang.Object
|
+----java.net.Socket
|
+----iaik.security.ssl.SSLSocket
- public class SSLSocket
- extends Socket
This class implements a socket to establish a secure connection
according to the SSL protocol specified by Netscape Communications
Corporation.
All properties of this SSLSocket can be defined in a SSLContext.
- See Also:
- SSLContext
-
SSLSocket(InetAddress, int, InetAddress, int, SSLContext)
- Creates a SSL socket and connects it to the specified remote address on
the specified remote port.
-
SSLSocket(InetAddress, int, SSLContext)
- Creates a SSL stream socket and connects it to the specified port
number at the specified IP address.
-
SSLSocket(String, int, InetAddress, int, SSLContext)
- Creates a SSL socket and connects it to the specified remote host on
the specified remote port.
-
SSLSocket(String, int, SSLContext)
- Creates a SSL stream socket and connects it to the specified port
number on the named host.
-
getActiveCipherSuite()
- Returns the active cipher suite.
-
getActiveCompressionMethod()
- Returns the active compression method.
-
getInputStream()
- Returns an input stream for this socket.
-
getOutputStream()
- Returns an output stream for this socket.
-
getPeerCertificateChain()
- Returns the certificate chain sent by the peer or null if the peer
has no certificate.
-
isServer()
- Returns true if this is the socket of a server.
-
setAutoHandshake(boolean)
- Can be used to switch off the automatic start of the handshake procedure.
-
setDebugStream(PrintStream)
- Enables debugging mode.
-
startHandshake()
- Start a handshake procedure manually if autoHandshake is switched off.
SSLSocket
public SSLSocket(String host,
int port,
SSLContext context) throws IOException, UnknownHostException
- Creates a SSL stream socket and connects it to the specified port
number on the named host.
All properties of this SSLSocket are defined in the SSLContext.
- Parameters:
- host - the host name.
- port - the port number.
- context - the SSLContext for the new socket
- Throws: IOException
- if an error occurs when creating the socket
SSLSocket
public SSLSocket(InetAddress address,
int port,
SSLContext context) throws IOException
- Creates a SSL stream socket and connects it to the specified port
number at the specified IP address.
All properties of this SSLSocket are defined in the SSLContext.
- Parameters:
- address - the IP address.
- port - the port number.
- context - the SSLContext for the new socket
- Throws: IOException
- if an error occurs when creating the socket
SSLSocket
public SSLSocket(String host,
int port,
InetAddress localAddr,
int localPort,
SSLContext context) throws IOException
- Creates a SSL socket and connects it to the specified remote host on
the specified remote port. The Socket will also bind() to the local
address and port supplied.
All properties of this SSLSocket are defined in the SSLContext.
- Parameters:
- host - the name of the remote host
- port - the remote port
- localAddr - the local address the socket is bound to
- localPort - the local port the socket is bound to
- context - the SSLContext for the new socket
- Throws: IOException
- if an error occurs when creating the socket
SSLSocket
public SSLSocket(InetAddress address,
int port,
InetAddress localAddr,
int localPort,
SSLContext context) throws IOException
- Creates a SSL socket and connects it to the specified remote address on
the specified remote port. The Socket will also bind() to the local
address and port supplied.
All properties of this SSLSocket are defined in the SSLContext.
- Parameters:
- address - the remote address
- port - the remote port
- localAddr - the local address the socket is bound to
- localPort - the local port the socket is bound to
- context - the SSLContext for the new socket
- Throws: IOException
- if an error occurs when creating the socket
isServer
public boolean isServer()
- Returns true if this is the socket of a server.
- Returns:
- true if this is the socket of a server
setAutoHandshake
public void setAutoHandshake(boolean on)
- Can be used to switch off the automatic start of the handshake procedure.
If auto handshake is switched off the application has to start the handshaking
process manually using the method startHandshake(). This kind of operation is
used when connecting over a proxy or firewall.
- Parameters:
- on - true if handshake should start automatically, false otherwise
- See Also:
- startHandshake
getPeerCertificateChain
public X509Certificate[] getPeerCertificateChain()
- Returns the certificate chain sent by the peer or null if the peer
has no certificate.
X509Certificate[0] contains the peers certificate.
X509Certificate[len-1] contains the top CA certificate.
- Returns:
- the certificate chain sent by the peer
getActiveCipherSuite
public CipherSuite getActiveCipherSuite()
- Returns the active cipher suite.
- Returns:
- the active cipher suite
- See Also:
- CipherSuite
getActiveCompressionMethod
public CompressionMethod getActiveCompressionMethod()
- Returns the active compression method.
- Returns:
- the active compression method
- See Also:
- CompressionMethod
startHandshake
public void startHandshake() throws IOException
- Start a handshake procedure manually if autoHandshake is switched off.
- Throws: IOException
- if an error occurs during the handshake procedure
- See Also:
- setAutoHandshake
getOutputStream
public OutputStream getOutputStream() throws IOException
- Returns an output stream for this socket.
- Returns:
- an output stream for writing bytes to this socket
- Throws: IOException
- if an error occurs when creating the output stream
- Overrides:
- getOutputStream in class Socket
getInputStream
public InputStream getInputStream() throws IOException
- Returns an input stream for this socket.
- Returns:
- an input stream for reading bytes from this socket.
- Throws: IOException
- if an error occurs when creating the input stream.
- Overrides:
- getInputStream in class Socket
setDebugStream
public void setDebugStream(PrintStream ps)
- Enables debugging mode.
- Parameters:
- ps - the PrintStream to which debug information shall be written
All Packages Class Hierarchy This Package Previous Next Index