|
Rakesh API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.rakeshv.utils.PasswordGenerator
public final class PasswordGenerator
A utility class that can be used to generate secure random password values.
Copyright 2005-2006 Rakesh Vidyadharan
| Field Summary | |
|---|---|
private static char[] |
PASSWORD_CHARACTERS
The default characters that are allowed in a password value. |
private static java.security.SecureRandom |
random
The random number generator. |
| Constructor Summary | |
|---|---|
private |
PasswordGenerator()
Default constructor. |
| Method Summary | |
|---|---|
private static int |
byteToInt(byte byteValue)
Convert a byte value into a postive integer. |
static char[] |
generatePassword(int length)
Generate a random password of the specified length. |
static char[] |
generatePassword(int length,
char[] characters)
Generate a random password of the specified length and restricted to the characters specified. |
private static int |
getIntFromByte(byte[] bytes)
Convert a byte value returned by the random number generator ( random) to an integer that may be used to index into
the allowable characters array. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final char[] PASSWORD_CHARACTERS
private static final java.security.SecureRandom random
| Constructor Detail |
|---|
private PasswordGenerator()
| Method Detail |
|---|
public static final char[] generatePassword(int length)
length - The desired length of the password.
generatePassword( int, char[] )
public static final char[] generatePassword(int length,
char[] characters)
length - The desired length of the password.characters - The array of valid characters thay may be used
in the password.
private static final int getIntFromByte(byte[] bytes)
random) to an integer that may be used to index into
the allowable characters array.
bytes - The byte values returned by the random number
generator.private static final int byteToInt(byte byteValue)
byteValue - The byte that is to be converted into an integer.
|
Rakesh API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||