final class DigestMD5Client extends DigestMD5Base implements javax.security.sasl.SaslClient
DigestMD5Base.DigestIntegrity, DigestMD5Base.DigestPrivacy| Modifier and Type | Field and Description |
|---|---|
private static int |
ALGORITHM |
private byte[] |
authzidBytes |
private static int |
CHARSET |
private static int |
CIPHER |
private static java.lang.String |
CIPHER_PROPERTY |
private byte[] |
cnonce |
private java.lang.String |
digestUri |
private static java.lang.String[] |
DIRECTIVE_KEY |
private static org.jboss.logging.Logger |
log |
private static int |
MAXBUF |
private static java.lang.String |
MY_CLASS_NAME |
private static int |
NONCE |
private int |
nonceCount |
private char[] |
passwd |
private byte[] |
preDigested |
private boolean |
preDigestedPasswords
Should the impl request and use pre-digested passwords instead of generating the {username : realm : password} hash?
|
private static int |
QOP |
private static int |
REALM |
private static int |
RESPONSE_AUTH |
private java.lang.String |
specifiedCipher |
private static int |
STALE |
private java.lang.String |
username |
authzid, cbh, CIPHER_MASKS, CIPHER_TOKENS, DEFAULT_MAXBUF, DES, DES_3_STRENGTH, DES_STRENGTH, DES3, EMPTY_BYTE_ARRAY, encoding, H_A1, MAX_CHALLENGE_LENGTH, MAX_RESPONSE_LENGTH, negotiatedCipher, negotiatedQop, negotiatedRealm, negotiatedStrength, nonce, PRE_DIGESTED_PROPERTY, RC4, RC4_40, RC4_40_STRENGTH, RC4_56, RC4_56_STRENGTH, RC4_STRENGTH, secCtx, step, UNSET, useUTF8allQop, completed, HIGH_STRENGTH, integrity, INTEGRITY_ONLY_PROTECTION, LOW_STRENGTH, MAX_SEND_BUF, MEDIUM_STRENGTH, myClassName, NO_PROTECTION, privacy, PRIVACY_PROTECTION, qop, rawSendSize, recvMaxBufSize, sendMaxBufSize, strength| Constructor and Description |
|---|
DigestMD5Client(java.lang.String authzid,
java.lang.String protocol,
java.lang.String serverName,
java.util.Map props,
javax.security.auth.callback.CallbackHandler cbh)
Constructor for DIGEST-MD5 mechanism.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
checkQopSupport(byte[] qopInChallenge,
byte[] ciphersInChallenge)
Parses the 'qop' directive.
|
private void |
checkStrengthSupport(byte[] ciphersInChallenge)
Processes the 'cipher' digest-challenge directive.
|
private void |
clearPassword() |
byte[] |
evaluateChallenge(byte[] challengeData)
Process the challenge data.
|
private java.lang.String |
findCipherAndStrength(byte[] supportedCiphers,
java.lang.String[] tokens)
Steps through the ordered 'strength' array, and compares it with
the 'supportedCiphers' array.
|
private byte[] |
generateClientResponse(byte[] charset)
Returns digest-response suitable for an initial authentication.
|
private static int |
getNonceCount(byte[] nonceValue)
Returns the number of requests (including current request)
that the client has sent in response to nonceValue.
|
boolean |
hasInitialResponse()
DIGEST-MD5 has no initial response
|
private void |
processChallenge(byte[][] challengeVal,
java.util.List<byte[]> realmChoices)
Record information from the challengeVal array into variables/fields.
|
private void |
validateResponseValue(byte[] fromServer)
From RFC 2831, Section 2.1.3: Step Three
[Server] sends a message formatted as follows:
response-auth = "rspauth" "=" response-value
where response-value is calculated as above, using the values sent in
step two, except that if qop is "auth", then A2 is
A2 = { ":", digest-uri-value }
And if qop is "auth-int" or "auth-conf" then A2 is
A2 = { ":", digest-uri-value, ":00000000000000000000000000000000" }
|
binaryToHex, dispose, generateNonce, generateResponseValue, generateResponseValue, getMechanismName, getNegotiatedProperty, getPlatformCiphers, nonceCountToHex, parseDirectives, quotedStringValue, unwrap, wrap, writeQuotedStringValuecombineMasks, findPreferredMask, intToNetworkByteOrder, isComplete, networkByteOrderToInt, parseQopprivate static final java.lang.String MY_CLASS_NAME
private static final java.lang.String CIPHER_PROPERTY
private static final java.lang.String[] DIRECTIVE_KEY
private static final int REALM
private static final int QOP
private static final int ALGORITHM
private static final int NONCE
private static final int MAXBUF
private static final int CHARSET
private static final int CIPHER
private static final int RESPONSE_AUTH
private static final int STALE
private static final org.jboss.logging.Logger log
private int nonceCount
private java.lang.String specifiedCipher
private byte[] cnonce
private java.lang.String username
private char[] passwd
private byte[] preDigested
private byte[] authzidBytes
private boolean preDigestedPasswords
private final java.lang.String digestUri
DigestMD5Client(java.lang.String authzid,
java.lang.String protocol,
java.lang.String serverName,
java.util.Map props,
javax.security.auth.callback.CallbackHandler cbh)
throws javax.security.sasl.SaslException
authzid - A non-null String representing the principal
for which authorization is being granted..digestURI - A non-null String representing detailing the
combined protocol and host being used for authentication.props - The possibly null properties to be used by the SASL
mechanism to configure the authentication exchange.cbh - The non-null CallbackHanlder object for callbacksjavax.security.sasl.SaslException - if no authentication ID or password is suppliedpublic boolean hasInitialResponse()
hasInitialResponse in interface javax.security.sasl.SaslClientpublic byte[] evaluateChallenge(byte[] challengeData)
throws javax.security.sasl.SaslException
evaluateChallenge in interface javax.security.sasl.SaslClientchallengeData - A non-null byte array containing the challenge
data from the server.javax.security.sasl.SaslException - If the platform does not have MD5 digest support
or if the server sends an invalid challenge.private void processChallenge(byte[][] challengeVal,
java.util.List<byte[]> realmChoices)
throws javax.security.sasl.SaslException,
java.io.UnsupportedEncodingException
javax.security.sasl.SaslException - if a sasl is a the mechanism cannot
correcly handle a callbacks or if a violation in the
digest challenge format is detected.java.io.UnsupportedEncodingExceptionprivate void checkQopSupport(byte[] qopInChallenge,
byte[] ciphersInChallenge)
throws java.io.IOException
java.io.IOExceptionprivate void checkStrengthSupport(byte[] ciphersInChallenge)
throws java.io.IOException
javax.security.sasl.SaslException - If an error is encountered in processing
the cipher digest-challenge directive or if no client-side
support is found.java.io.IOExceptionprivate java.lang.String findCipherAndStrength(byte[] supportedCiphers,
java.lang.String[] tokens)
tokens - The array of cipher tokens sent by serverprivate byte[] generateClientResponse(byte[] charset)
throws java.io.IOException
javax.security.sasl.SaslException - if there is an error generating the
response value or the cnonce value.java.io.IOExceptionprivate void validateResponseValue(byte[] fromServer)
throws javax.security.sasl.SaslException
javax.security.sasl.SaslExceptionprivate static int getNonceCount(byte[] nonceValue)
private void clearPassword()