|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--org.PingOO.DLAI.lib.util.PasswordGenerator
This class can randomly generate a password, a salt and crypt the password using the UNIX crypt algorithm.
PasswordCodec| Field Summary | |
static int |
DEFAULT_PASSWORD_LENGTH
Default password lenght. |
static int |
DEFAULT_SALT_LENGTH
Default password lenght. |
private static java.util.Random |
random
The random number generator. |
private static int |
seed
The random seed. |
| Constructor Summary | |
private |
PasswordGenerator()
Hiddes the constructor from the outside. |
| Method Summary | |
static java.lang.String |
cryptPassword(java.lang.String password)
Crypts a password, using the UNIX crypt algorithm and a randomly generated salt. |
static java.lang.String |
cryptPassword(java.lang.String password,
java.lang.String salt)
Crypts a password, using the UNIX crypt algorithm and the provided salt. |
static java.lang.String |
generatePassword()
Randomly generates a eight letters long password. |
static java.lang.String |
generatePassword(int passwordLength)
Randomly generates a password. |
static java.lang.String |
generateSalt()
Randomly generates a two letters long salt. |
private static void |
initialize()
Initialize the number generator. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
public static final int DEFAULT_PASSWORD_LENGTH
public static final int DEFAULT_SALT_LENGTH
private static int seed
private static java.util.Random random
| Constructor Detail |
private PasswordGenerator()
| Method Detail |
public static final java.lang.String cryptPassword(java.lang.String password)
password - The non-crypted password.
public static final java.lang.String cryptPassword(java.lang.String password,
java.lang.String salt)
password - The non-crypted password.password - The salt needed to crypt the password.public static final java.lang.String generateSalt()
public static final java.lang.String generatePassword()
public static final java.lang.String generatePassword(int passwordLength)
passwordLength - The desired lenght of the password. If passwordLength < 8, the password will be at least 8 letters long.private static final void initialize()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||