com.ibm.atp.auth
Class AuthByDigest

java.lang.Object
  |
  +--com.ibm.atp.auth.Auth
        |
        +--com.ibm.atp.auth.AuthByDigest

public class AuthByDigest
extends Auth

The AuthByDigest class is the class for challenge-response authentication by message digest.

Version:
1.00 $Date: 2001/07/28 06:33:48 $
Author:
ONO Kouichi

Fields inherited from class com.ibm.atp.auth.Auth
FIRST_TURN, NO_TURNS, SECOND_TURN
 
Constructor Summary
protected AuthByDigest()
          Default constructor creates a default message digest function.
  AuthByDigest(SharedSecret secret)
          Constructor creates a specified message digest function.
protected AuthByDigest(java.lang.String name)
          Constructor creates a specified message digest function.
  AuthByDigest(java.lang.String name, SharedSecret secret)
          Constructor creates a specified message digest function.
 
Method Summary
 byte[] calculateResponse(int turn, Challenge challenge)
          Calculate response value for authentication.
 SharedSecret getSecret()
          Gets the secret shared by each other.
protected  byte[] hash(int turn, Challenge challenge)
          Calculate hashed value for authentication.
protected  void setSecret(SharedSecret secret)
          Sets the secret shared by each other.
 boolean verify(int turn, Challenge challenge, byte[] response)
          Verify response value for authentication.
 boolean verify(int turn, Challenge challenge, ByteSequence response)
          Verify response value for authentication.
 
Methods inherited from class com.ibm.atp.auth.Auth
addBytes, getDigestAlgorithm, getDigestValue, getFirstTurnIdentifier, getSecondTurnIdentifier, getTurnPad, resetDigest, setDigestAlgorithm, setFirstTurnIdentifier, setSecondTurnIdentifier
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AuthByDigest

protected AuthByDigest()
Default constructor creates a default message digest function.

AuthByDigest

public AuthByDigest(SharedSecret secret)
Constructor creates a specified message digest function.
Parameters:
secret - secret shared by each other

AuthByDigest

protected AuthByDigest(java.lang.String name)
Constructor creates a specified message digest function.
Parameters:
name - the name of message digest function algorithm

AuthByDigest

public AuthByDigest(java.lang.String name,
                    SharedSecret secret)
Constructor creates a specified message digest function.
Parameters:
name - the name of message digest function algorithm
secret - secret shared by each other
Method Detail

calculateResponse

public final byte[] calculateResponse(int turn,
                                      Challenge challenge)
                               throws AuthenticationException
Calculate response value for authentication.
Overrides:
calculateResponse in class Auth
Parameters:
turn - of individual
challenge - a challenge
Returns:
response value for authentication
Throws:
AuthenticationException - byte sequence to be hased is invalid

getSecret

public SharedSecret getSecret()
Gets the secret shared by each other.
Returns:
secret shared by each other

hash

protected final byte[] hash(int turn,
                            Challenge challenge)
                     throws AuthenticationException
Calculate hashed value for authentication.
Overrides:
hash in class Auth
Parameters:
turn - of individual
challenge - a challenge
Returns:
hashed value for authentication
Throws:
AuthenticationException - byte sequence to be hased is invalid

setSecret

protected void setSecret(SharedSecret secret)
Sets the secret shared by each other.
Parameters:
secret - secret shared by each other

verify

public boolean verify(int turn,
                      Challenge challenge,
                      byte[] response)
               throws AuthenticationException
Verify response value for authentication.
Overrides:
verify in class Auth
Parameters:
turn - of individual
challenge - a challenge
response - response value for authentication
Throws:
AuthenticationException - byte sequence for response is invalid

verify

public boolean verify(int turn,
                      Challenge challenge,
                      ByteSequence response)
               throws AuthenticationException
Verify response value for authentication.
Overrides:
verify in class Auth
Parameters:
turn - of individual
challenge - a challenge
response - response value for authentication
Throws:
AuthenticationException - byte sequence for response is invalid