javax.net.ssl
public abstract class SSLEngine extends Object
Since: 1.5
Constructor Summary | |
---|---|
protected | SSLEngine()
Creates a new SSLEngine with no peer host name or port number. |
protected | SSLEngine(String peerHost, int peerPort)
Creates a new SSLEngine with the specified peer host name and
port number.
|
Method Summary | |
---|---|
abstract void | beginHandshake()
Begin, or restart, the SSL handshake.
|
abstract void | closeInbound()
Close the inbound state.
|
abstract void | closeOutbound()
Close the outbound state. |
abstract Runnable | getDelegatedTask() |
abstract String[] | getEnabledCipherSuites()
Returns a list of SSL cipher suite names this SSLEngine is
configured to use.
|
abstract String[] | getEnabledProtocols()
Returns a list of SSL protocol version names this SSLEngine is
configured to use.
|
abstract boolean | getEnableSessionCreation()
Tells if sessions will be created by this engine, and therefore
may be resumed at a later time.
|
abstract SSLEngineResult.HandshakeStatus | getHandshakeStatus()
Return the current handshake status.
|
abstract boolean | getNeedClientAuth()
Tells if this SSLEngine is configured to require client
authentication when in server mode.
|
String | getPeerHost()
Returns the peer host name this SSL session is connected to, or
null if this value was not set.
|
int | getPeerPort()
Returns the peer IP port number this SSL session in communicating
on, or -1 if this value was not set.
|
abstract SSLSession | getSession()
Return the {@link SSLSession} object this connection represents.
|
abstract String[] | getSupportedCipherSuites()
Returns a list of SSL cipher suite names this SSLEngine
implementation supports.
|
abstract String[] | getSupportedProtocols()
Returns a list of SSL protocol version names this SSLEngine
implementation supports. |
abstract boolean | getUseClientMode()
Tells if this SSLEngine is a "client" session.
|
abstract boolean | getWantClientAuth()
Tells if client authentication is requested, but not required,
for sessions in server mode. |
abstract boolean | isInboundDone()
Tells if the incoming data stream is finished, and thus if no
more data will be available to be unwrapped.
|
abstract boolean | isOutboundDone()
Tells if the outgoing data stream is finished, and thus if no
more data may be wrapped.
|
abstract void | setEnabledCipherSuites(String[] suites)
Sets the list of enabled cipher suites. |
abstract void | setEnabledProtocols(String[] protocols)
Sets the list of enabled protocol versions. |
abstract void | setEnableSessionCreation(boolean create)
Enables or disables session creation. |
abstract void | setNeedClientAuth(boolean needAuth)
Enables or disables required client authentication. |
abstract void | setUseClientMode(boolean clientMode)
Enables client or server mode. |
abstract void | setWantClientAuth(boolean wantAuth)
Enables or disables requested client authentication. |
SSLEngineResult | unwrap(ByteBuffer source, ByteBuffer sink)
Unwraps a byte buffer recieved from the network, storing the
decrypted, unwrapped bytes into the given buffer.
|
SSLEngineResult | unwrap(ByteBuffer source, ByteBuffer[] sinks)
Unwraps a byte buffer recieved from the network, storing the
decrypted, unwrapped bytes into the given buffers.
|
abstract SSLEngineResult | unwrap(ByteBuffer source, ByteBuffer[] sinks, int offset, int length)
Unwraps a byte buffer received from the network, storing the
decrypted, unwrapped bytes into the given buffers. |
SSLEngineResult | wrap(ByteBuffer source, ByteBuffer sink)
Wraps a byte buffer into an SSL message, for preparation to send
it over the network.
|
SSLEngineResult | wrap(ByteBuffer[] sources, ByteBuffer sink)
Wraps byte buffers into an SSL message, for preparation to send
them over the network.
|
abstract SSLEngineResult | wrap(ByteBuffer[] sources, int offset, int length, ByteBuffer sink)
Wraps byte buffers into an SSL message, for preparation to send
them over the network. |
Parameters: peerHost The peer's host name. peerPort The peer's port number.
Throws: SSLException
Throws: SSLException
Returns: The list of enabled cipher suite names.
Returns: The list of enabled protocol names.
Returns: True if sessions will be created.
Returns: The current handshake status.
Returns: True iff client authentication is required.
null
if this value was not set.
Returns: The peer host's name.
Returns: The peer's port number.
Returns: The SSL session.
Returns: The list of cipher suite names supported by this implementation.
Returns: The list of SSL protocol names
Returns: True iff this session is configured for client mode.
Returns: True iff client authentication is requested.
Returns: True if no more data is to be unwrapped.
Returns: True if no more data may be wrapped.
Parameters: suites The cipher suites to enable.
Throws: IllegalArgumentException If any of the specified suite strings is not supported by this implementation, or if the argument is null.
Parameters: protocols The protocol versions to enable.
Throws: IllegalArgumentException If any of the specified protocols are not supported, or if the argument is null.
Parameters: create Whether or not to enable session creation.
This parameter is only used in server mode.
Parameters: needAuth Whether or not client authentication is required.
Parameters: clientMode Whether or not to use client mode.
This parameter is only used in server mode.
Parameters: wantAuth Whether or not client authentication will be requested, but not required.
This call is exactly equivalent to unwrap (source, new
ByteBuffer[] { sink }, 0, 1)
.
Parameters: source The source bytes, coming from the network. sink The buffer to hold the unwrapped message.
Returns: An engine result object for the operation.
Throws: SSLException If an SSL message parsing error occurs. java.nio.ReadOnlyBufferException If 'sink' is not writable. IllegalArgumentException If either 'source' or 'sink' is null. IllegalStateException If this engine has not been put into client or server mode.
This call is exactly equivalent to unwrap (source,
sinks, 0, sinks.length)
.
Parameters: source The source bytes, coming from the network. sinks The buffers to hold the unwrapped message.
Returns: An engine result object for the operation.
Throws: SSLException If an SSL message parsing error occurs. java.nio.ReadOnlyBufferException If any buffer in 'sinks' is not writable. IllegalArgumentException If either 'source' or 'sinks' is null. IllegalStateException If this engine has not been put into client or server mode.
This method may place no bytes in the destination buffer; for example, if this engine is still performing the SSL handshake, only handshake data will be consumed, and no application data.
It is stated that this method may modify the source buffer, and that it must not be passed to another SSLEngine (SSL connections are independent, so another SSLEngine will not have the parameters or state to handle messages meant for this engine).
Parameters: source The source bytes, coming from the network. sinks The buffers to hold the unwrapped message. offset The index of the first buffer in 'sinks' to use. length The number of buffers in 'sinks' to use.
Returns: An engine result object for the operation.
Throws: SSLException If an SSL message parsing error occurs. java.nio.ReadOnlyBufferException If any buffer in 'sinks' is not writable. IllegalArgumentException If either 'source' or 'sinks' is null. IllegalStateException If this engine has not been put into client or server mode. IndexOutOfBoundsException If 'offset' or 'length' is negative, or if 'length+offset' is greater than 'sinks.length'.
This method is exactly equivalent to wrap (new
ByteBuffer[] { source }, 0, 1, sink)
.
Parameters: source The source buffer with application data. sink The buffer to hold the wrapped data.
Returns: An engine result object for the operation.
Throws: SSLException If an SSL error occurs. java.nio.ReadOnlyBufferException If 'sink' is read-only. IllegalArgumentException If either 'source' or 'sink' is null. IllegalStateException If this engine has not been put into client or server mode.
This method is exactly equivalent to wrap (sources, 0,
1, sink)
.
Parameters: sources The source buffers with application data. sink The buffer to hold the wrapped data.
Returns: An engine result object for the operation.
Throws: SSLException If an SSL error occurs. java.nio.ReadOnlyBufferException If 'sink' is read-only. IllegalArgumentException If either 'sources' or 'sink' is null. IllegalStateException If this engine has not been put into client or server mode.
This method may consume no data from the source buffers, and yet still produce output that should be sent accross the wire; for example if this engine has not yet completed the SSL handshake, the sink buffer will be filled with handshake messages.
Parameters: sources The source buffers with application data. offset The offset into the source buffers to start reading application data. length The number of buffers to read from 'sources'. sink The buffer to hold the wrapped data.
Returns: An engine result object for the operation.
Throws: SSLException If an SSL error occurs. java.nio.ReadOnlyBufferException If 'sink' is read-only. IllegalArgumentException If either 'sources' or 'sink' is null. IllegalStateException If this engine has not been put into client or server mode. IndexOutOfBoundsException If 'offset' or 'length' is negative, or if 'length+offset' is greater than 'sources.length'.