Package org.xnio.sasl
Class SaslWrapper
java.lang.Object
org.xnio.sasl.SaslWrapper
A wrapper delegation class for SASL that presents the same wrap/unwrap API regardless of whether it is
dealing with a SASL client or server.
- Author:
- David M. Lloyd
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SaslWrapper
create
(SaslClient saslClient) Create a SASL wrapper for a SASL client.static SaslWrapper
create
(SaslServer saslServer) Create a SASL wrapper for a SASL server.final byte[]
unwrap
(byte[] bytes) Unwrap a message.abstract byte[]
unwrap
(byte[] bytes, int off, int len) Unwrap a message.abstract byte[]
unwrap
(ByteBuffer source) Unwrap a message.final void
unwrap
(ByteBuffer destination, ByteBuffer source) Unwrap a message.final byte[]
wrap
(byte[] bytes) Wrap a message.abstract byte[]
wrap
(byte[] bytes, int off, int len) Wrap a message.abstract byte[]
wrap
(ByteBuffer source) Wrap a message.final void
wrap
(ByteBuffer destination, ByteBuffer source) Wrap a message.
-
Constructor Details
-
SaslWrapper
public SaslWrapper()
-
-
Method Details
-
wrap
Wrap a message.- Parameters:
bytes
- the incoming messageoff
- the offset into the byte arraylen
- the length of the byte array to wrap- Returns:
- the wrap result
- Throws:
SaslException
- if a problem occurs
-
wrap
Wrap a message.- Parameters:
bytes
- the incoming message- Returns:
- the wrap result
- Throws:
SaslException
- if a problem occurs
-
wrap
Wrap a message.- Parameters:
source
- the buffer from which bytes should be read- Returns:
- the wrap result
- Throws:
SaslException
- if a problem occurs
-
unwrap
Unwrap a message.- Parameters:
bytes
- the incoming messageoff
- the offset into the byte arraylen
- the length of the byte array to wrap- Returns:
- the unwrap result
- Throws:
SaslException
- if a problem occurs
-
unwrap
Unwrap a message.- Parameters:
bytes
- the incoming message- Returns:
- the unwrap result
- Throws:
SaslException
- if a problem occurs
-
unwrap
Unwrap a message.- Parameters:
source
- the buffer from which bytes should be read- Returns:
- the unwrap result
- Throws:
SaslException
- if a problem occurs
-
wrap
Wrap a message. Wrapping occurs from the source buffer to the destination idea. Thesource
buffer should have its position and remaining length set to encompass exactly one SASL message (without the length field). The SASL message itself does not encode any length information so it is up to the protocol implementer to ensure that the message is properly framed.- Parameters:
destination
- the buffer into which bytes should be writtensource
- the buffers from which bytes should be read- Throws:
SaslException
- if a SASL error occurs- See Also:
-
unwrap
Unwrap a message. Unwrapping occurs from the source buffer to the destination idea.The
source
buffer should have its position and remaining length set to encompass exactly one SASL message (without the length field). The SASL message itself does not encode any length information so it is up to the protocol implementer to ensure that the message is properly framed.- Parameters:
destination
- the buffer into which bytes should be writtensource
- the buffers from which bytes should be read- Throws:
SaslException
- if a SASL error occurs- See Also:
-
create
Create a SASL wrapper for a SASL client.- Parameters:
saslClient
- the SASL client- Returns:
- the wrapper
-
create
Create a SASL wrapper for a SASL server.- Parameters:
saslServer
- the SASL server- Returns:
- the wrapper
-