Package org.jivesoftware.openfire.net
Class TLSWrapper
java.lang.Object
org.jivesoftware.openfire.net.TLSWrapper
Creates and initializes the SSLContext instance to use to encrypt the plain connection. This
class is also responsible for encoding and decoding the encrypted data and place it into
the corresponding the
ByteBuffer
.- Author:
- Artur Hefczyc, Hao Chen
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Signals that no more outbound application data will be sent on this TLSHandler.void
enableLogging
(boolean logging) int
int
Returns the current status for this TLSHandler.protected SSLEngine
boolean
Returns whether unwrap(ByteBuffer, ByteBuffer) will accept any more inbound data messages and whether wrap(ByteBuffer, ByteBuffer) will produce any more outbound data messages.unwrap
(ByteBuffer net, ByteBuffer app) Attempts to decode TLS network data into a subsequence of plaintext application data buffers.void
wrap
(ByteBuffer app, ByteBuffer net) Attempts to encode a buffer of plaintext application data into TLS network data.
-
Constructor Details
-
TLSWrapper
-
-
Method Details
-
getNetBuffSize
public int getNetBuffSize() -
getAppBuffSize
public int getAppBuffSize() -
isEngineClosed
public boolean isEngineClosed()Returns whether unwrap(ByteBuffer, ByteBuffer) will accept any more inbound data messages and whether wrap(ByteBuffer, ByteBuffer) will produce any more outbound data messages.- Returns:
- true if the TLSHandler will not consume anymore network data and will not produce any anymore network data.
-
enableLogging
public void enableLogging(boolean logging) -
unwrap
Attempts to decode TLS network data into a subsequence of plaintext application data buffers. Depending on the state of the TLSWrapper, this method may consume network data without producing any application data (for example, it may consume handshake data.) If this TLSWrapper has not yet started its initial handshake, this method will automatically start the handshake.- Parameters:
net
- a ByteBuffer containing inbound network dataapp
- a ByteBuffer to hold inbound application data- Returns:
- a ByteBuffer containing inbound application data
- Throws:
SSLException
- A problem was encountered while processing the data that caused the TLSHandler to abort.
-
wrap
Attempts to encode a buffer of plaintext application data into TLS network data. Depending on the state of the TLSWrapper, this method may produce network data without consuming any application data (for example, it may generate handshake data). If this TLSWrapper has not yet started its initial handshake, this method will automatically start the handshake.- Parameters:
app
- a ByteBuffer containing outbound application datanet
- a ByteBuffer to hold outbound network data- Throws:
SSLException
- A problem was encountered while processing the data that caused the TLSWrapper to abort.
-
close
Signals that no more outbound application data will be sent on this TLSHandler.- Throws:
SSLException
- never
-
getStatus
Returns the current status for this TLSHandler.- Returns:
- the current TLSStatus
-
getTlsEngine
-