org.globalse.arena.frag.security
Class PasswordChecker
java.lang.Object
|
+--org.globalse.arena.frag.security.PasswordChecker
- public class PasswordChecker
- extends java.lang.Object
The PasswordChecker class is responsible for checking a password usind a MD5 hash.
A possible schema for the passowrd exchange:
1. A generates some random data - this random data is stored in this class
2. A sends the random data to B - getRandom()
3. B appends the random data to the password - PasswordChecker(random)
4. B generates a MD5 hash from the combined data block - hashPassword()
5. B sends the hash to A
6. A appends the random data to the password - hashPassword()
7. A generates a MD5 hash from the combined data block
8. A compares the calculated MD5 hash to the received one. If they are equal, the password comparison was successful.
* $Id: PasswordChecker.html,v 1.1 2003/02/12 18:06:20 schoecke Exp $
Constructor Summary |
PasswordChecker()
|
Method Summary |
boolean |
checkHash(java.lang.String password,
java.lang.String random,
java.lang.String hash)
Method for checking wether the hash is valid i.e. |
java.lang.String |
hashPassword(java.lang.String password,
java.lang.String random)
Method for creating a hash from a password and a random number. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
PasswordChecker
public PasswordChecker()
checkHash
public boolean checkHash(java.lang.String password,
java.lang.String random,
java.lang.String hash)
throws java.security.NoSuchAlgorithmException
- Method for checking wether the hash is valid i.e. the hash contains the
password, that has to be validated
- Parameters:
password
- String the password for the gamerandom
- String randomhash
- String string for the hashtable- Returns:
- if the check was successful
- Throws:
- java.security.NoSuchAlgorithmException - if the alogr. not exists
hashPassword
public java.lang.String hashPassword(java.lang.String password,
java.lang.String random)
throws java.security.NoSuchAlgorithmException
- Method for creating a hash from a password and a random number.
- Parameters:
password
- String the password for the gamerandom
- String random- Returns:
- the created hash as a hexadecimal value
- Throws:
- java.security.NoSuchAlgorithmException - if the alogr. not exists
This page is hosted by the Chair for Applied Software Engineering of the Technische Universität München.
Imprint (Impressum)