|
For the latest news and information visit The GNU Crypto project |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gnu.crypto.sasl.ClientMechanism
A base class to facilitate implementing SASL client-side mechanisms.
Field Summary | |
---|---|
protected java.lang.String |
authorizationID
The authorisation identity. |
protected byte[] |
channelBinding
Channel binding data to use with this mechanism instance. |
protected boolean |
complete
Whether authentication phase is completed (true) or not (false). |
protected CallbackHandler |
handler
Callback handler to use with this mechanism instance. |
protected java.lang.String |
mechanism
Name of this mechanism. |
protected java.util.Map |
properties
Properties of qualities desired for this mechanism. |
protected java.lang.String |
protocol
Name of protocol using this mechanism. |
protected java.lang.String |
serverName
Name of server to authenticate to. |
protected int |
state
The state of the authentication automaton. |
Constructor Summary | |
---|---|
protected |
ClientMechanism(java.lang.String mechanism)
|
Method Summary | |
---|---|
void |
dispose()
Disposes of any system resources or security-sensitive information the SaslClient might be using. |
protected byte[] |
engineUnwrap(byte[] incoming,
int offset,
int len)
|
protected byte[] |
engineWrap(byte[] outgoing,
int offset,
int len)
|
abstract byte[] |
evaluateChallenge(byte[] challenge)
Evaluates the challenge data and generates a response. |
java.lang.String |
getAuthorizationID()
|
java.lang.String |
getMechanismName()
Returns the IANA-registered mechanism name of this SASL client. |
protected java.lang.String |
getNegotiatedMaxBuffer()
|
protected java.lang.String |
getNegotiatedPolicyForwardSecrecy()
|
protected java.lang.String |
getNegotiatedPolicyNoActive()
|
protected java.lang.String |
getNegotiatedPolicyNoAnonymous()
|
protected java.lang.String |
getNegotiatedPolicyNoDictionary()
|
protected java.lang.String |
getNegotiatedPolicyNoPlainText()
|
protected java.lang.String |
getNegotiatedPolicyPassCredentials()
|
java.lang.Object |
getNegotiatedProperty(java.lang.String propName)
Retrieves the negotiated property. |
protected java.lang.String |
getNegotiatedQOP()
|
protected java.lang.String |
getNegotiatedRawSendSize()
|
protected java.lang.String |
getNegotiatedServerAuth()
|
protected java.lang.String |
getNegotiatedStrength()
|
protected java.lang.String |
getReuse()
|
abstract boolean |
hasInitialResponse()
Determines if this mechanism has an optional initial response. |
void |
init(java.util.Map attributes)
Initialises the mechanism with designated attributes. |
protected abstract void |
initMechanism()
|
boolean |
isComplete()
Determines if the authentication exchange has completed. |
void |
reset()
Resets the mechanism instance for re-initialisation and use with other characteristics. |
protected abstract void |
resetMechanism()
|
byte[] |
unwrap(byte[] incoming,
int offset,
int len)
Unwraps a byte array received from the server. |
byte[] |
wrap(byte[] outgoing,
int offset,
int len)
Wraps a byte array to be sent to the server. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.lang.String mechanism
protected java.lang.String authorizationID
protected java.lang.String protocol
protected java.lang.String serverName
protected java.util.Map properties
protected CallbackHandler handler
protected byte[] channelBinding
protected boolean complete
protected int state
Constructor Detail |
protected ClientMechanism(java.lang.String mechanism)
Method Detail |
protected abstract void initMechanism() throws SaslException
SaslException
protected abstract void resetMechanism() throws SaslException
SaslException
public abstract byte[] evaluateChallenge(byte[] challenge) throws SaslException
SaslClient
evaluateChallenge
in interface SaslClient
challenge
- the non-null challenge sent from the server. The
challenge array may have zero length.
null
reponse to send to the server. It
is null
if the challenge accompanied a "SUCCESS" status and
the challenge only contains data for the client to update its state and no
response needs to be sent to the server. The response is a zero-length
byte array if the client is to send a response with no data.
SaslException
- if an error occurred while processing the challenge
or generating a response.public abstract boolean hasInitialResponse()
SaslClient
true
, caller should call SaslClient.evaluateChallenge(byte[])
with an empty array to get the initial response.
hasInitialResponse
in interface SaslClient
true
if this mechanism has an initial response.public boolean isComplete()
SaslClient
isComplete
in interface SaslClient
true
if the authentication exchange has completed;
false
otherwise.public byte[] unwrap(byte[] incoming, int offset, int len) throws SaslException
SaslClient
Unwraps a byte array received from the server. This method can be
called only after the authentication exchange has completed (i.e., when
SaslClient.isComplete()
returns true
) and only if the
authentication exchange has negotiated integrity and/or privacy as the
quality of protection; otherwise, an IllegalStateException
is
thrown.
incoming
is the contents of the SASL buffer as defined in
RFC 2222 without the leading four octet field that represents the length.
offset
and len
specify the portion of incoming
to use.
unwrap
in interface SaslClient
incoming
- a non-null byte array containing the encoded bytes from
the server.offset
- the starting position at incoming
of the bytes
to use.len
- the number of bytes from incoming
to use.
SaslException
- if incoming
cannot be successfully
unwrapped.public byte[] wrap(byte[] outgoing, int offset, int len) throws SaslException
SaslClient
Wraps a byte array to be sent to the server. This method can be called
only after the authentication exchange has completed (i.e., when
SaslClient.isComplete()
returns true
) and only if the
authentication exchange has negotiated integrity and/or privacy as the
quality of protection; otherwise, an IllegalStateException
is
thrown.
The result of this method will make up the contents of the SASL buffer
as defined in RFC 2222 without the leading four octet field that
represents the length. offset
and len
specify
the portion of outgoing
to use.
wrap
in interface SaslClient
outgoing
- a non-null byte array containing the bytes to encode.offset
- the starting position at outgoing
of the bytes
to use.len
- the number of bytes from outgoing
to use.
SaslException
- if outgoing
cannot be successfully
wrapped.public java.lang.String getMechanismName()
SaslClient
getMechanismName
in interface SaslClient
public java.lang.Object getNegotiatedProperty(java.lang.String propName) throws SaslException
SaslClient
SaslClient.isComplete()
returns true
); otherwise, an IllegalStateException
is
thrown.
getNegotiatedProperty
in interface SaslClient
propName
- the non-null property name.
null
, the
property was not negotiated or is not applicable to this mechanism.
SaslException
public void dispose() throws SaslException
SaslClient
SaslClient
might be using. Invoking this method invalidates
the SaslClient
instance. This method is idempotent.
dispose
in interface SaslClient
SaslException
- if a problem was encountered while disposing of the
resources.public java.lang.String getAuthorizationID()
protected java.lang.String getNegotiatedQOP()
protected java.lang.String getNegotiatedStrength()
protected java.lang.String getNegotiatedServerAuth()
protected java.lang.String getNegotiatedMaxBuffer()
protected java.lang.String getNegotiatedRawSendSize()
protected java.lang.String getNegotiatedPolicyNoPlainText()
protected java.lang.String getNegotiatedPolicyNoActive()
protected java.lang.String getNegotiatedPolicyNoDictionary()
protected java.lang.String getNegotiatedPolicyNoAnonymous()
protected java.lang.String getNegotiatedPolicyForwardSecrecy()
protected java.lang.String getNegotiatedPolicyPassCredentials()
protected java.lang.String getReuse()
protected byte[] engineUnwrap(byte[] incoming, int offset, int len) throws SaslException
SaslException
protected byte[] engineWrap(byte[] outgoing, int offset, int len) throws SaslException
SaslException
public void init(java.util.Map attributes) throws SaslException
Initialises the mechanism with designated attributes. Permissible names and values are mechanism specific.
attributes
- a set of name-value pairs that describes the desired
future behaviour of this instance.
IllegalMechanismStateException
- if the instance is already
initialised.
SaslException
- if an exception occurs during the process.public void reset() throws SaslException
Resets the mechanism instance for re-initialisation and use with other characteristics.
SaslException
- if an exception occurs during the process.
|
For the latest news and information visit The GNU Crypto project |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |