edu.vt.middleware.password
Class PasswordGenerator

java.lang.Object
  extended by edu.vt.middleware.password.PasswordGenerator

public class PasswordGenerator
extends java.lang.Object

Creates passwords that meet password character rule criteria.

Version:
$Revision: 1926 $
Author:
Sean C. Sullivan, Middleware Services

Constructor Summary
PasswordGenerator()
          Default constructor.
PasswordGenerator(java.util.Random r)
          Creates a new password generator with the supplied random.
 
Method Summary
protected  void fillRandomCharacters(java.lang.CharSequence source, int count, java.lang.Appendable target)
          Fills the supplied target with count random characters from source.
 java.lang.String generatePassword(int length, java.util.List<CharacterRule> rules)
          Generates a password of the supplied length which meets the requirements of the supplied character rules.
protected  void randomize(java.nio.CharBuffer buffer)
          Randomizes the contents of the given buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PasswordGenerator

public PasswordGenerator()
Default constructor. Instantiates a secure random for password generation.


PasswordGenerator

public PasswordGenerator(java.util.Random r)
Creates a new password generator with the supplied random.

Parameters:
r - random
Method Detail

generatePassword

public java.lang.String generatePassword(int length,
                                         java.util.List<CharacterRule> rules)
Generates a password of the supplied length which meets the requirements of the supplied character rules. For length to be evaluated it must be greater than the number of characters defined in the character rule.

Parameters:
length - of password to generate
rules - to generate compliant password from
Returns:
generated password

fillRandomCharacters

protected void fillRandomCharacters(java.lang.CharSequence source,
                                    int count,
                                    java.lang.Appendable target)
Fills the supplied target with count random characters from source.

Parameters:
source - of random characters.
count - number of random characters.
target - character sequence that will hold characters.

randomize

protected void randomize(java.nio.CharBuffer buffer)
Randomizes the contents of the given buffer.

Parameters:
buffer - character buffer whose contents will be randomized.


Copyright © 2003-2011 Virginia Tech. All Rights Reserved.