|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.net.ssl.SSLEngine
public abstract class SSLEngine
A class for low-level message wrapping and unwrapping of SSL messages.
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 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[] 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. |
SSLEngineResult |
wrap(ByteBuffer source,
ByteBuffer sink)
Wraps a byte buffer into an SSL message, for preparation to send it over the network. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected SSLEngine()
protected SSLEngine(String peerHost, int peerPort)
peerHost
- The peer's host name.peerPort
- The peer's port number.Method Detail |
---|
public abstract void beginHandshake() throws SSLException
SSLException
public abstract void closeInbound() throws SSLException
SSLException
public abstract void closeOutbound()
public abstract Runnable getDelegatedTask()
public String getPeerHost()
null
if this value was not set.
public int getPeerPort()
public abstract String[] getEnabledCipherSuites()
public abstract String[] getEnabledProtocols()
public abstract boolean getEnableSessionCreation()
public abstract SSLEngineResult.HandshakeStatus getHandshakeStatus()
public abstract boolean getNeedClientAuth()
public abstract SSLSession getSession()
SSLSession
object this connection represents.
public abstract String[] getSupportedCipherSuites()
public abstract String[] getSupportedProtocols()
public abstract boolean getUseClientMode()
public abstract boolean getWantClientAuth()
public abstract boolean isInboundDone()
public abstract boolean isOutboundDone()
public abstract void setEnabledCipherSuites(String[] suites)
suites
- The cipher suites to enable.
IllegalArgumentException
- If any of the specified suite
strings is not supported by this implementation, or if the
argument is null.public abstract void setEnabledProtocols(String[] protocols)
protocols
- The protocol versions to enable.
IllegalArgumentException
- If any of the specified
protocols are not supported, or if the argument is null.public abstract void setEnableSessionCreation(boolean create)
create
- Whether or not to enable session creation.public abstract void setUseClientMode(boolean clientMode)
clientMode
- Whether or not to use client mode.public abstract void setNeedClientAuth(boolean needAuth)
This parameter is only used in server mode.
needAuth
- Whether or not client authentication is required.public abstract void setWantClientAuth(boolean wantAuth)
This parameter is only used in server mode.
wantAuth
- Whether or not client authentication will be
requested, but not required.public SSLEngineResult unwrap(ByteBuffer source, ByteBuffer sink) throws SSLException
This call is exactly equivalent to unwrap (source, new
ByteBuffer[] { sink }, 0, 1)
.
source
- The source bytes, coming from the network.sink
- The buffer to hold the unwrapped message.
SSLException
- If an SSL message parsing error occurs.
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.public SSLEngineResult unwrap(ByteBuffer source, ByteBuffer[] sinks) throws SSLException
This call is exactly equivalent to unwrap (source,
sinks, 0, sinks.length)
.
source
- The source bytes, coming from the network.sinks
- The buffers to hold the unwrapped message.
SSLException
- If an SSL message parsing error occurs.
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.public abstract SSLEngineResult unwrap(ByteBuffer source, ByteBuffer[] sinks, int offset, int length) throws SSLException
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).
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.
SSLException
- If an SSL message parsing error occurs.
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'.public SSLEngineResult wrap(ByteBuffer source, ByteBuffer sink) throws SSLException
This method is exactly equivalent to wrap (new
ByteBuffer[] { source }, 0, 1, sink)
.
source
- The source buffer with application data.sink
- The buffer to hold the wrapped data.
SSLException
- If an SSL error occurs.
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.public SSLEngineResult wrap(ByteBuffer[] sources, ByteBuffer sink) throws SSLException
This method is exactly equivalent to wrap (sources, 0,
1, sink)
.
sources
- The source buffers with application data.sink
- The buffer to hold the wrapped data.
SSLException
- If an SSL error occurs.
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.public abstract SSLEngineResult wrap(ByteBuffer[] sources, int offset, int length, ByteBuffer sink) throws SSLException
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.
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.
SSLException
- If an SSL error occurs.
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'.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |