org.resoa.util
Class PasswordUtil

java.lang.Object
  extended by org.resoa.util.PasswordUtil

public class PasswordUtil
extends java.lang.Object

Some helper stuff around password management

Author:
Wolfgang Suft

Nested Class Summary
static class PasswordUtil.PasswordStrength
          Enumeration of different password strength
 
Field Summary
static int LENGTH_MIN
          The default password minimum length
 
Constructor Summary
PasswordUtil()
           
 
Method Summary
static PasswordUtil.PasswordStrength checkNewPassword(java.lang.String password)
          Checks a password
static PasswordUtil.PasswordStrength checkNewPassword(java.lang.String password, int minLength)
          Checks a password
static boolean compareSecrets(java.lang.String secret, java.lang.String md5Hash)
          Compares a secret with an existing md5Hash value
static java.lang.String getMD5(java.lang.String secret)
          Generates a MD5 Hash
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LENGTH_MIN

public static int LENGTH_MIN
The default password minimum length

Constructor Detail

PasswordUtil

public PasswordUtil()
Method Detail

checkNewPassword

public static PasswordUtil.PasswordStrength checkNewPassword(java.lang.String password,
                                                             int minLength)
Checks a password

Parameters:
password - the password to check
minLength - minimum lenght
Returns:
the estimated strength of the password

checkNewPassword

public static PasswordUtil.PasswordStrength checkNewPassword(java.lang.String password)
Checks a password

Parameters:
password -
Returns:
the estimated strength of the password

getMD5

public static java.lang.String getMD5(java.lang.String secret)
                               throws java.security.NoSuchAlgorithmException
Generates a MD5 Hash

Parameters:
secret -
Returns:
the MD5 string
Throws:
java.security.NoSuchAlgorithmException

compareSecrets

public static boolean compareSecrets(java.lang.String secret,
                                     java.lang.String md5Hash)
                              throws java.security.NoSuchAlgorithmException
Compares a secret with an existing md5Hash value

Parameters:
secret - the secret to check
md5Hash - the existing md5
Returns:
true if matching
Throws:
java.security.NoSuchAlgorithmException


Copyright © 2005-2011 The Resoa Project, resoa.org. All Rights Reserved.