edu.vt.middleware.password
Class DictionarySubstringRule

java.lang.Object
  extended by edu.vt.middleware.password.AbstractDictionaryRule
      extended by edu.vt.middleware.password.DictionarySubstringRule
All Implemented Interfaces:
Rule

public class DictionarySubstringRule
extends AbstractDictionaryRule

Rule for determining if a password matches a dictionary word, or if it contains a dictionary word of a given minimum length or greater. This rule will optionally also check for reversed words.

Version:
$Revision: 1926 $ $Date: 2011-04-26 15:52:24 -0400 (Tue, 26 Apr 2011) $
Author:
Middleware Services

Field Summary
static int DEFAULT_WORD_LENGTH
          Default word length.
 
Fields inherited from class edu.vt.middleware.password.AbstractDictionaryRule
dictionary, ERROR_CODE, ERROR_CODE_REVERSED, matchBackwards
 
Constructor Summary
DictionarySubstringRule()
          Creates a new dictionary substring rule.
DictionarySubstringRule(edu.vt.middleware.dictionary.Dictionary dict)
          Creates a new dictionary substring rule.
DictionarySubstringRule(edu.vt.middleware.dictionary.Dictionary dict, int n)
          Create a new dictionary substring rule.
 
Method Summary
protected  String doWordSearch(String text)
          Searches the dictionary with the supplied text.
 int getWordLength()
          Returns the number of characters that constitute a word in a password.
 void setWordLength(int n)
          Sets the minimum number of characters that constitute a word in a password.
 
Methods inherited from class edu.vt.middleware.password.AbstractDictionaryRule
createRuleResultDetailParameters, getDictionary, isMatchBackwards, setDictionary, setMatchBackwards, toString, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_WORD_LENGTH

public static final int DEFAULT_WORD_LENGTH
Default word length.

See Also:
Constant Field Values
Constructor Detail

DictionarySubstringRule

public DictionarySubstringRule()
Creates a new dictionary substring rule. The dictionary should be set using the AbstractDictionaryRule.setDictionary(Dictionary) method.


DictionarySubstringRule

public DictionarySubstringRule(edu.vt.middleware.dictionary.Dictionary dict)
Creates a new dictionary substring rule. The dictionary should be ready to use when passed to this constructor.

Parameters:
dict - to use for searching

DictionarySubstringRule

public DictionarySubstringRule(edu.vt.middleware.dictionary.Dictionary dict,
                               int n)
Create a new dictionary substring rule. The dictionary should be ready to use when passed to this constructor. See setWordLength(int).

Parameters:
dict - to use for searching
n - number of characters to check in each dictionary word
Method Detail

setWordLength

public void setWordLength(int n)
Sets the minimum number of characters that constitute a word in a password. If n = 5 and the password contains 'test', then the password is valid. However if n = 4 then 'test' will be found in the dictionary. The default value is 4.

Parameters:
n - minimum number of characters to check in each dictionary word

getWordLength

public int getWordLength()
Returns the number of characters that constitute a word in a password.

Returns:
minimum number of characters to check in each dictionary word

doWordSearch

protected String doWordSearch(String text)
Searches the dictionary with the supplied text.

Specified by:
doWordSearch in class AbstractDictionaryRule
Parameters:
text - to search dictionary with
Returns:
matching word


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