Top Description Fields Constructors Methods
org.apache.catalina.realm

public Class MessageDigestCredentialHandler

extends DigestCredentialHandlerBase
Class Inheritance
Imports
java.io.UnsupportedEncodingException, java.nio.charset.Charset, .StandardCharsets, java.security.NoSuchAlgorithmException, java.util.Arrays, org.apache.juli.logging.Log, .LogFactory, org.apache.tomcat.util.buf.B2CConverter, .HexUtils, org.apache.tomcat.util.codec.binary.Base64, org.apache.tomcat.util.security.ConcurrentMessageDigest

This credential handler supports the following forms of stored passwords:

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 Summary

Modifier and TypeField and Description
private String
public static final int
private Charset
private static final Log
Inherited from org.apache.catalina.realm.DigestCredentialHandlerBase:
DEFAULT_SALT_LENGTHsm

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
protected int
public String
protected Log
public boolean
matches(String
User provided credentials
inputCredentials
,
String
Credentials stored in the Realm
storedCredentials
)

Implements org.apache.catalina.CredentialHandler.matches.

Checks to see if the input credentials match the stored credentials

protected String
mutate(String
User provided credentials
inputCredentials
,
byte[]
Salt, if any
salt
,
int
Number of iterations of the algorithm associated with this CredentialHandler applied to the inputCredentials to generate the equivalent stored credentials
iterations
)

Implements abstract org.apache.catalina.realm.DigestCredentialHandlerBase.mutate.

Generates the equivalent stored credentials for the given input credentials, salt and iterations.

public void
setAlgorithm(String
the algorithm
algorithm
)

Implements abstract org.apache.catalina.realm.DigestCredentialHandlerBase.setAlgorithm.

Set the algorithm used to convert input credentials to stored credentials.

public void
setEncoding(String encodingName)

Inherited from org.apache.catalina.realm.DigestCredentialHandlerBase:
equalsequalsgetDefaultSaltLengthgetIterationsgetLogInvalidStoredCredentialsgetSaltLengthmatchesSaltIterationsEncodedmutatemutatesetIterationssetLogInvalidStoredCredentialssetSaltLength

Field Detail

algorithmback to summary
private String algorithm
DEFAULT_ITERATIONSback to summary
public static final int DEFAULT_ITERATIONS
encodingback to summary
private Charset encoding
logback to summary
private static final Log log

Constructor Detail

MessageDigestCredentialHandlerback to summary
public MessageDigestCredentialHandler()

Method Detail

getAlgorithmback to summary
public String getAlgorithm()

Implements abstract org.apache.catalina.realm.DigestCredentialHandlerBase.getAlgorithm.

Returns:String

Doc from org.apache.catalina.realm.DigestCredentialHandlerBase.getAlgorithm.

the algorithm used to convert input credentials to stored credentials.

Annotations
@Override
getDefaultIterationsback to summary
protected int getDefaultIterations()

Implements abstract org.apache.catalina.realm.DigestCredentialHandlerBase.getDefaultIterations.

Returns:int

Doc from org.apache.catalina.realm.DigestCredentialHandlerBase.getDefaultIterations.

the default number of iterations used by the CredentialHandler.

Annotations
@Override
getEncodingback to summary
public String getEncoding()
getLogback to summary
protected Log getLog()

Implements abstract org.apache.catalina.realm.DigestCredentialHandlerBase.getLog.

Returns:Log

Doc from org.apache.catalina.realm.DigestCredentialHandlerBase.getLog.

the logger for the CredentialHandler instance.

Annotations
@Override
matchesback to summary
public boolean matches(String inputCredentials, String storedCredentials)

Implements org.apache.catalina.CredentialHandler.matches.

Doc from org.apache.catalina.CredentialHandler.matches.

Checks to see if the input credentials match the stored credentials

Parameters
inputCredentials:String

User provided credentials

storedCredentials:String

Credentials stored in the Realm

Returns:boolean

true if the inputCredentials match the storedCredentials, otherwise false

Annotations
@Override
mutateback to summary
protected String mutate(String inputCredentials, byte[] salt, int iterations)

Implements abstract org.apache.catalina.realm.DigestCredentialHandlerBase.mutate.

Doc from org.apache.catalina.realm.DigestCredentialHandlerBase.mutate.

Generates the equivalent stored credentials for the given input credentials, salt and iterations. If the algorithm requires a key length, the default will be used.

Parameters
inputCredentials:String

User provided credentials

salt:byte[]

Salt, if any

iterations:int

Number of iterations of the algorithm associated with this CredentialHandler applied to the inputCredentials to generate the equivalent stored credentials

Returns:String

The equivalent stored credentials for the given input credentials or null if the generation fails

Annotations
@Override
setAlgorithmback to summary
public void setAlgorithm(String algorithm) throws NoSuchAlgorithmException

Implements abstract org.apache.catalina.realm.DigestCredentialHandlerBase.setAlgorithm.

Doc from org.apache.catalina.realm.DigestCredentialHandlerBase.setAlgorithm.

Set the algorithm used to convert input credentials to stored credentials.

Parameters
algorithm:String

the algorithm

Annotations
@Override
Exceptions
NoSuchAlgorithmException:
if the specified algorithm is not supported
setEncodingback to summary
public void setEncoding(String encodingName)