com.ibm.atp.auth
Class AuthBySignature

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

public class AuthBySignature
extends Auth

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

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

Fields inherited from class com.ibm.atp.auth.Auth
FIRST_TURN, NO_TURNS, SECOND_TURN
 
Constructor Summary
protected AuthBySignature()
          Default constructor creates a default message digest function.
protected AuthBySignature(java.security.PrivateKey privateKey, java.security.PublicKey publicKey)
          Constructor creates a default message digest function.
protected AuthBySignature(java.lang.String digestName)
          Constructor creates a specified message digest function.
protected AuthBySignature(java.lang.String digestName, java.security.PrivateKey privateKey, java.security.PublicKey publicKey)
          Constructor creates a specified message digest function.
protected AuthBySignature(java.lang.String digestName, java.lang.String signatureName)
          Constructor creates a specified message digest function.
protected AuthBySignature(java.lang.String digestName, java.lang.String signatureName, java.security.PrivateKey privateKey, java.security.PublicKey publicKey)
          Constructor creates a specified message digest function.
 
Method Summary
 byte[] calculateResponse(int turn, Challenge challenge)
          Calculate response value for authentication.
 java.security.PrivateKey getPrivateKey()
          Gets the private key of self.
 java.security.PublicKey getPublicKey()
          Gets the public key of opponent.
 java.lang.String getSignatureAlgorithm()
          Returns the name of digital signature algorithm.
protected  byte[] hash(int turn, Challenge challenge)
          Calculate hashed value for authentication.
protected  void setPrivateKey(java.security.PrivateKey privateKey)
          Sets the private key of self.
protected  void setPublicKey(java.security.PublicKey publicKey)
          Sets the public key of opponent.
protected  void setSignatureAlgorithm(java.lang.String name)
          Sets the name of digital signature algorithm.
protected  byte[] sign(int turn, Challenge challenge)
          Calculate signature
 boolean verify(int turn, Challenge challenge, byte[] signature)
          Verify signature
 boolean verify(int turn, Challenge challenge, ByteSequence signature)
          Verify signature
 
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

AuthBySignature

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

AuthBySignature

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

AuthBySignature

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

AuthBySignature

protected AuthBySignature(java.lang.String digestName,
                          java.lang.String signatureName,
                          java.security.PrivateKey privateKey,
                          java.security.PublicKey publicKey)
Constructor creates a specified message digest function.
Parameters:
digestName - the name of message digest function algorithm
signatureName - the name of message digest function algorithm
privateKey - private key of self
publicKey - public key of opponent

AuthBySignature

protected AuthBySignature(java.lang.String digestName,
                          java.security.PrivateKey privateKey,
                          java.security.PublicKey publicKey)
Constructor creates a specified message digest function.
Parameters:
digestName - the name of message digest function algorithm
privateKey - private key of self
publicKey - public key of opponent

AuthBySignature

protected AuthBySignature(java.security.PrivateKey privateKey,
                          java.security.PublicKey publicKey)
Constructor creates a default message digest function.
Parameters:
privateKey - private key of self
publicKey - public key of opponent
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 for response is invalid

getPrivateKey

public java.security.PrivateKey getPrivateKey()
Gets the private key of self.
Returns:
private key of self

getPublicKey

public java.security.PublicKey getPublicKey()
Gets the public key of opponent.
Returns:
public key of opponent

getSignatureAlgorithm

public java.lang.String getSignatureAlgorithm()
Returns the name of digital signature algorithm.
Returns:
the name of digital signature algorithm.

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 for response is invalid

setPrivateKey

protected void setPrivateKey(java.security.PrivateKey privateKey)
Sets the private key of self.
Parameters:
privateKey - private key of self

setPublicKey

protected void setPublicKey(java.security.PublicKey publicKey)
Sets the public key of opponent.
Parameters:
publicKey - public key of opponent

setSignatureAlgorithm

protected void setSignatureAlgorithm(java.lang.String name)
Sets the name of digital signature algorithm.
Parameters:
name - the name of digital signature algorithm

sign

protected final byte[] sign(int turn,
                            Challenge challenge)
                     throws AuthenticationException
Calculate signature
Parameters:
turn - of individual
challenge - a challenge
Throws:
AuthenticationException - byte sequence for response is invalid

verify

public final boolean verify(int turn,
                            Challenge challenge,
                            byte[] signature)
                     throws AuthenticationException
Verify signature
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 final boolean verify(int turn,
                            Challenge challenge,
                            ByteSequence signature)
                     throws AuthenticationException
Verify signature
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