abstract class DigestMD5Base extends AbstractSaslImpl
| Modifier and Type | Class and Description |
|---|---|
(package private) class |
DigestMD5Base.DigestIntegrity
Implementation of the SecurityCtx interface allowing for messages
between the client and server to be integrity checked.
|
(package private) class |
DigestMD5Base.DigestPrivacy
Implementation of the SecurityCtx interface allowing for messages
between the client and server to be integrity checked and encrypted.
|
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
authzid |
protected javax.security.auth.callback.CallbackHandler |
cbh |
protected static byte[] |
CIPHER_MASKS |
protected static java.lang.String[] |
CIPHER_TOKENS |
protected static int |
DEFAULT_MAXBUF |
protected static int |
DES |
protected static byte |
DES_3_STRENGTH |
protected static byte |
DES_STRENGTH |
protected static int |
DES3 |
private static java.lang.String |
DI_CLASS_NAME |
private static java.lang.String |
DP_CLASS_NAME |
protected static byte[] |
EMPTY_BYTE_ARRAY |
private static int |
ENCODED_NONCE_SIZE |
protected java.lang.String |
encoding |
protected byte[] |
H_A1 |
private static java.lang.String[] |
JCE_CIPHER_NAME |
private static org.jboss.logging.Logger |
log |
private static java.math.BigInteger |
MASK |
protected static int |
MAX_CHALLENGE_LENGTH |
protected static int |
MAX_RESPONSE_LENGTH |
protected java.lang.String |
negotiatedCipher |
protected java.lang.String |
negotiatedQop |
protected java.lang.String |
negotiatedRealm |
protected java.lang.String |
negotiatedStrength |
protected byte[] |
nonce |
private static char[] |
pem_array
This array maps the characters to their 6 bit values
|
protected static java.lang.String |
PRE_DIGESTED_PROPERTY |
private static int |
RAW_NONCE_SIZE |
protected static int |
RC4 |
protected static int |
RC4_40 |
protected static byte |
RC4_40_STRENGTH |
protected static int |
RC4_56 |
protected static byte |
RC4_56_STRENGTH |
protected static byte |
RC4_STRENGTH |
protected SecurityCtx |
secCtx |
private static java.lang.String |
SECURITY_LAYER_MARKER |
protected int |
step |
protected static byte |
UNSET |
protected boolean |
useUTF8 |
allQop, 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| Modifier | Constructor and Description |
|---|---|
protected |
DigestMD5Base(java.util.Map<java.lang.String,?> props,
java.lang.String className,
int firstStep,
javax.security.auth.callback.CallbackHandler cbh)
Constucts an instance of DigestMD5Base.
|
| Modifier and Type | Method and Description |
|---|---|
private static byte[] |
addDesParity(byte[] input,
int offset,
int len)
Expands a 7-byte array into an 8-byte array that contains parity bits
The binary format of a cryptographic key is:
(B1,B2,...,B7,P1,B8,...B14,P2,B15,...,B49,P7,B50,...,B56,P8)
where (B1,B2,...,B56) are the independent bits of a DES key and
(PI,P2,...,P8) are reserved for parity bits computed on the preceding
seven independent bits and set so that the parity of the octet is odd,
i.e., there is an odd number of "1" bits in the octet.
|
protected byte[] |
binaryToHex(byte[] digest)
Convert a byte array to hexadecimal string.
|
void |
dispose() |
private static void |
extractDirective(java.lang.String key,
byte[] value,
java.lang.String[] keyTable,
byte[][] valueTable,
java.util.List<byte[]> realmChoices,
int realmIndex)
Processes directive/value pairs from the digest-challenge and
fill out the challengeVal array.
|
protected static byte[] |
generateNonce() |
protected byte[] |
generateResponseValue(java.lang.String authMethod,
java.lang.String digestUriValue,
java.lang.String qopValue,
byte[] urpHash,
byte[] nonceValue,
byte[] cNonceValue,
int nonceCount,
byte[] authzidValue)
Assembles response-value for digest-response.
|
protected byte[] |
generateResponseValue(java.lang.String authMethod,
java.lang.String digestUriValue,
java.lang.String qopValue,
java.lang.String usernameValue,
java.lang.String realmValue,
char[] passwdValue,
byte[] nonceValue,
byte[] cNonceValue,
int nonceCount,
byte[] authzidValue)
Assembles response-value for digest-response.
|
java.lang.String |
getMechanismName()
Retrieves the SASL mechanism IANA name.
|
java.lang.Object |
getNegotiatedProperty(java.lang.String propName)
Retrieves the negotiated property.
|
protected static byte[] |
getPlatformCiphers() |
private static boolean |
isLws(byte b) |
private static javax.crypto.SecretKey |
makeDesKeys(byte[] input,
java.lang.String desStrength)
Create parity-adjusted keys suitable for DES / DESede encryption.
|
private static boolean |
needEscape(char ch) |
private static boolean |
needEscape(java.lang.String str) |
protected static java.lang.String |
nonceCountToHex(int count)
Takes 'nonceCount' value and returns HEX value of the value.
|
protected static byte[][] |
parseDirectives(byte[] buf,
java.lang.String[] keyTable,
java.util.List<byte[]> realmChoices,
int realmIndex)
Parses digest-challenge string, extracting each token
and value(s)
|
protected static java.lang.String |
quotedStringValue(java.lang.String str) |
private static void |
setParityBit(byte[] key)
Sets the parity bit (0th bit) in each byte so that each byte
contains an odd number of 1's.
|
private static int |
skipLws(byte[] buf,
int start) |
byte[] |
unwrap(byte[] incoming,
int start,
int len)
Unwrap the incoming message using the wrap method of the secCtx object
instance.
|
byte[] |
wrap(byte[] outgoing,
int start,
int len)
Wrap outgoing bytes using the wrap method of the secCtx object
instance.
|
protected static void |
writeQuotedStringValue(java.io.ByteArrayOutputStream out,
byte[] buf)
Checks if a byte[] contains characters that must be quoted
and write the resulting, possibly escaped, characters to out.
|
combineMasks, findPreferredMask, intToNetworkByteOrder, isComplete, networkByteOrderToInt, parseQopprivate static final org.jboss.logging.Logger log
private static final java.lang.String DI_CLASS_NAME
private static final java.lang.String DP_CLASS_NAME
protected static final int MAX_CHALLENGE_LENGTH
protected static final int MAX_RESPONSE_LENGTH
protected static final int DEFAULT_MAXBUF
protected static final int DES3
protected static final int RC4
protected static final int DES
protected static final int RC4_56
protected static final int RC4_40
protected static final java.lang.String[] CIPHER_TOKENS
private static final java.lang.String[] JCE_CIPHER_NAME
protected static final byte DES_3_STRENGTH
protected static final byte RC4_STRENGTH
protected static final byte DES_STRENGTH
protected static final byte RC4_56_STRENGTH
protected static final byte RC4_40_STRENGTH
protected static final byte UNSET
protected static final byte[] CIPHER_MASKS
private static final java.lang.String SECURITY_LAYER_MARKER
protected static final byte[] EMPTY_BYTE_ARRAY
protected static final java.lang.String PRE_DIGESTED_PROPERTY
protected int step
protected javax.security.auth.callback.CallbackHandler cbh
protected SecurityCtx secCtx
protected byte[] H_A1
protected byte[] nonce
protected java.lang.String negotiatedStrength
protected java.lang.String negotiatedCipher
protected java.lang.String negotiatedQop
protected java.lang.String negotiatedRealm
protected boolean useUTF8
protected java.lang.String encoding
protected java.lang.String authzid
private static final char[] pem_array
private static final int RAW_NONCE_SIZE
private static final int ENCODED_NONCE_SIZE
private static final java.math.BigInteger MASK
protected DigestMD5Base(java.util.Map<java.lang.String,?> props,
java.lang.String className,
int firstStep,
javax.security.auth.callback.CallbackHandler cbh)
throws javax.security.sasl.SaslException
props - A map of property/value pairsclassName - name of class to use for loggingfirstStep - number of first step in authentication state machinedigestUri - digestUri used in authenticationcbh - callback handler used to get info required for authjavax.security.sasl.SaslException - If invalid value found in props.public java.lang.String getMechanismName()
public byte[] unwrap(byte[] incoming,
int start,
int len)
throws javax.security.sasl.SaslException
incoming - The byte array containing the incoming bytes.start - The offset from which to read the byte array.len - The number of bytes to read from the offset.javax.security.sasl.SaslException - if an error occurs when unwrapping the incoming
messagepublic byte[] wrap(byte[] outgoing,
int start,
int len)
throws javax.security.sasl.SaslException
outgoing - The byte array containing the outgoing bytes.start - The offset from which to read the byte array.len - The number of bytes to read from the offset.javax.security.sasl.SaslException - if an error occurs when wrapping the outgoing
messagepublic void dispose()
throws javax.security.sasl.SaslException
javax.security.sasl.SaslExceptionpublic java.lang.Object getNegotiatedProperty(java.lang.String propName)
AbstractSaslImplgetNegotiatedProperty in class AbstractSaslImplprotected static byte[] generateNonce()
protected static void writeQuotedStringValue(java.io.ByteArrayOutputStream out,
byte[] buf)
private static boolean needEscape(java.lang.String str)
private static boolean needEscape(char ch)
protected static java.lang.String quotedStringValue(java.lang.String str)
protected byte[] binaryToHex(byte[] digest)
throws java.io.UnsupportedEncodingException
digest - a non-null byte arrayjava.io.UnsupportedEncodingExceptionprotected static byte[] getPlatformCiphers()
protected byte[] generateResponseValue(java.lang.String authMethod,
java.lang.String digestUriValue,
java.lang.String qopValue,
java.lang.String usernameValue,
java.lang.String realmValue,
char[] passwdValue,
byte[] nonceValue,
byte[] cNonceValue,
int nonceCount,
byte[] authzidValue)
throws java.security.NoSuchAlgorithmException,
java.io.IOException
authMethod - "AUTHENTICATE" for client-generated response;
"" for server-generated responsejava.security.NoSuchAlgorithmException - if the platform does not have MD5
digest support.java.io.UnsupportedEncodingException - if a an error occurs
encoding a string into either Latin-1 or UTF-8.java.io.IOException - if an error occurs writing to the output
byte array buffer.protected byte[] generateResponseValue(java.lang.String authMethod,
java.lang.String digestUriValue,
java.lang.String qopValue,
byte[] urpHash,
byte[] nonceValue,
byte[] cNonceValue,
int nonceCount,
byte[] authzidValue)
throws java.security.NoSuchAlgorithmException,
java.io.IOException
authMethod - "AUTHENTICATE" for client-generated response;
"" for server-generated responsejava.security.NoSuchAlgorithmException - if the platform does not have MD5
digest support.java.io.UnsupportedEncodingException - if a an error occurs
encoding a string into either Latin-1 or UTF-8.java.io.IOException - if an error occurs writing to the output
byte array buffer.protected static java.lang.String nonceCountToHex(int count)
protected static byte[][] parseDirectives(byte[] buf,
java.lang.String[] keyTable,
java.util.List<byte[]> realmChoices,
int realmIndex)
throws javax.security.sasl.SaslException
buf - A non-null digest-challenge string.javax.security.sasl.SaslException - if the buf cannot be parsed according to RFC 2831private static boolean isLws(byte b)
private static int skipLws(byte[] buf,
int start)
private static void extractDirective(java.lang.String key,
byte[] value,
java.lang.String[] keyTable,
byte[][] valueTable,
java.util.List<byte[]> realmChoices,
int realmIndex)
throws javax.security.sasl.SaslException
key - A non-null String challenge token name.value - A non-null String token value.javax.security.sasl.SaslException - if a either the key or the value is nullprivate static void setParityBit(byte[] key)
private static byte[] addDesParity(byte[] input,
int offset,
int len)
private static javax.crypto.SecretKey makeDesKeys(byte[] input,
java.lang.String desStrength)
throws java.security.NoSuchAlgorithmException,
java.security.InvalidKeyException,
java.security.spec.InvalidKeySpecException
input - A non-null byte array containing key material for
DES / DESede.desStrength - A string specifying eithe a DES or a DESede key.java.security.NoSuchAlgorithmException - if the either the DES or DESede
algorithms cannote be lodaed by JCE.java.security.InvalidKeyException - if an invalid array of bytes is used
as a key for DES or DESede.java.security.spec.InvalidKeySpecException - in an invalid parameter is passed
to either te DESKeySpec of the DESedeKeySpec constructors.