Package org.apache.catalina.realm
Class MessageDigestCredentialHandler
- java.lang.Object
- 
- org.apache.catalina.realm.DigestCredentialHandlerBase
- 
- org.apache.catalina.realm.MessageDigestCredentialHandler
 
 
- 
- All Implemented Interfaces:
- CredentialHandler
 
 public class MessageDigestCredentialHandler extends DigestCredentialHandlerBase This credential handler supports the following forms of stored passwords:- encodedCredential - a hex encoded digest of the password digested using the configured digest
- {MD5}encodedCredential - a Base64 encoded MD5 digest of the password
- {SHA}encodedCredential - a Base64 encoded SHA1 digest of the password
- {SSHA}encodedCredential - 20 byte Base64 encoded SHA1 digest
     followed by variable length salt.
     {SSHA}<sha-1 digest:20><salt:n>
- salt$iterationCount$encodedCredential - a hex encoded salt, iteration code and a hex encoded credential, each separated by $
 If the stored password form does not include an iteration count then an iteration count of 1 is used. If the stored password form does not include salt then no salt is used. 
- 
- 
Field SummaryFields Modifier and Type Field Description static intDEFAULT_ITERATIONS- 
Fields inherited from class org.apache.catalina.realm.DigestCredentialHandlerBaseDEFAULT_SALT_LENGTH, sm
 
- 
 - 
Constructor SummaryConstructors Constructor Description MessageDigestCredentialHandler()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetAlgorithm()protected intgetDefaultIterations()java.lang.StringgetEncoding()protected LoggetLog()booleanmatches(java.lang.String inputCredentials, java.lang.String storedCredentials)Checks to see if the input credentials match the stored credentialsprotected java.lang.Stringmutate(java.lang.String inputCredentials, byte[] salt, int iterations)Generates the equivalent stored credentials for the given input credentials, salt and iterations.voidsetAlgorithm(java.lang.String algorithm)Set the algorithm used to convert input credentials to stored credentials.voidsetEncoding(java.lang.String encodingName)- 
Methods inherited from class org.apache.catalina.realm.DigestCredentialHandlerBaseequals, equals, getDefaultSaltLength, getIterations, getLogInvalidStoredCredentials, getSaltLength, matchesSaltIterationsEncoded, mutate, mutate, setIterations, setLogInvalidStoredCredentials, setSaltLength
 
- 
 
- 
- 
- 
Field Detail- 
DEFAULT_ITERATIONSpublic static final int DEFAULT_ITERATIONS - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
getEncodingpublic java.lang.String getEncoding() 
 - 
setEncodingpublic void setEncoding(java.lang.String encodingName) 
 - 
getAlgorithmpublic java.lang.String getAlgorithm() - Specified by:
- getAlgorithmin class- DigestCredentialHandlerBase
- Returns:
- the algorithm used to convert input credentials to stored credentials.
 
 - 
setAlgorithmpublic void setAlgorithm(java.lang.String algorithm) throws java.security.NoSuchAlgorithmExceptionDescription copied from class:DigestCredentialHandlerBaseSet the algorithm used to convert input credentials to stored credentials.- Specified by:
- setAlgorithmin class- DigestCredentialHandlerBase
- Parameters:
- algorithm- the algorithm
- Throws:
- java.security.NoSuchAlgorithmException- if the specified algorithm is not supported
 
 - 
matchespublic boolean matches(java.lang.String inputCredentials, java.lang.String storedCredentials)Description copied from interface:CredentialHandlerChecks to see if the input credentials match the stored credentials- Parameters:
- inputCredentials- User provided credentials
- storedCredentials- Credentials stored in the- Realm
- Returns:
- trueif the inputCredentials match the storedCredentials, otherwise- false
 
 - 
mutateprotected java.lang.String mutate(java.lang.String inputCredentials, byte[] salt, int iterations)Description copied from class:DigestCredentialHandlerBaseGenerates the equivalent stored credentials for the given input credentials, salt and iterations. If the algorithm requires a key length, the default will be used.- Specified by:
- mutatein class- DigestCredentialHandlerBase
- Parameters:
- inputCredentials- User provided credentials
- salt- Salt, if any
- iterations- Number of iterations of the algorithm associated with this CredentialHandler applied to the inputCredentials to generate the equivalent stored credentials
- Returns:
- The equivalent stored credentials for the given input
          credentials or nullif the generation fails
 
 - 
getDefaultIterationsprotected int getDefaultIterations() - Specified by:
- getDefaultIterationsin class- DigestCredentialHandlerBase
- Returns:
- the default number of iterations used by the
 CredentialHandler.
 
 - 
getLogprotected Log getLog() - Specified by:
- getLogin class- DigestCredentialHandlerBase
- Returns:
- the logger for the CredentialHandler instance.
 
 
- 
 
-