equip.data
Class Challenge

java.lang.Object
  extended byequip.data.Challenge

public class Challenge
extends java.lang.Object

challenge-response utility class


Field Summary
protected static int CHALLENGE_SIZE
          challenge size
protected static java.security.MessageDigest digest
          digest algorithm
protected static java.security.SecureRandom random
          secure random for challenges
protected static int SECRET_SIZE
          secret size
 
Constructor Summary
Challenge()
           
 
Method Summary
static boolean acceptResponse(java.lang.String secret, java.lang.String challenge, java.lang.String response)
          check a response
static java.lang.String bytesToString(byte[] b)
          bytes to string (hex for now?)
static int fromHex(char c)
          char to nibble
static java.lang.String makeChallenge()
          make a new challenge
static java.lang.String makeResponse(java.lang.String secret, java.lang.String challenge)
          make a response to a challenge
static java.lang.String makeSecret()
          make a new secret
static char toHex(int nibble)
          nibble to char
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

random

protected static java.security.SecureRandom random
secure random for challenges


CHALLENGE_SIZE

protected static final int CHALLENGE_SIZE
challenge size

See Also:
Constant Field Values

SECRET_SIZE

protected static final int SECRET_SIZE
secret size

See Also:
Constant Field Values

digest

protected static java.security.MessageDigest digest
digest algorithm

Constructor Detail

Challenge

public Challenge()
Method Detail

makeChallenge

public static java.lang.String makeChallenge()
make a new challenge


makeSecret

public static java.lang.String makeSecret()
make a new secret


makeResponse

public static java.lang.String makeResponse(java.lang.String secret,
                                            java.lang.String challenge)
make a response to a challenge


acceptResponse

public static boolean acceptResponse(java.lang.String secret,
                                     java.lang.String challenge,
                                     java.lang.String response)
check a response


bytesToString

public static java.lang.String bytesToString(byte[] b)
bytes to string (hex for now?)


toHex

public static char toHex(int nibble)
nibble to char


fromHex

public static int fromHex(char c)
char to nibble