Top Fields Constructors Methods
org.apache.catalina.realm

public Class SecretKeyCredentialHandler

extends DigestCredentialHandlerBase
Class Inheritance
Imports
java.security.NoSuchAlgorithmException, java.security.spec.InvalidKeySpecException, .KeySpec, javax.crypto.SecretKeyFactory, javax.crypto.spec.PBEKeySpec, org.apache.juli.logging.Log, .LogFactory, org.apache.tomcat.util.buf.HexUtils

Field Summary

Modifier and TypeField and Description
public static final String
public static final int
public static final int
private int
private static final Log
private SecretKeyFactory
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 int
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.

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
,
int
Length of the produced digest in bits for implementations where it's applicable
keyLength
)

Overrides org.apache.catalina.realm.DigestCredentialHandlerBase.mutate.

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

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
setKeyLength(int keyLength)

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

Field Detail

DEFAULT_ALGORITHMback to summary
public static final String DEFAULT_ALGORITHM
DEFAULT_ITERATIONSback to summary
public static final int DEFAULT_ITERATIONS
DEFAULT_KEY_LENGTHback to summary
public static final int DEFAULT_KEY_LENGTH
keyLengthback to summary
private int keyLength
logback to summary
private static final Log log
secretKeyFactoryback to summary
private SecretKeyFactory secretKeyFactory

Constructor Detail

SecretKeyCredentialHandlerback to summary
public SecretKeyCredentialHandler() throws NoSuchAlgorithmException

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
getKeyLengthback to summary
public int getKeyLength()
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
mutateback to summary
protected String mutate(String inputCredentials, byte[] salt, int iterations, int keyLength)

Overrides 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, iterations and key length. The default implementation calls ignores the key length and calls mutate(String, byte[], int). Sub-classes that use the key length should override this method.

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

keyLength:int

Length of the produced digest in bits for implementations where it's applicable

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
setKeyLengthback to summary
public void setKeyLength(int keyLength)