|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object SK.gnome.dwarf.auth.login.MD5CryptPasswordEncoder
Password encoder based on the MD5 crypt algorithm.
This class encodes user passwords using the md5-crypt algorithm compatible with the Unix/Linux/BSD systems.
This class may be used to encrypt the ASCII passwords only.
Constructor Summary | |
MD5CryptPasswordEncoder()
|
Method Summary | |
boolean |
compare(java.lang.String encoded,
char[] plain)
Compares two passwords. |
static java.lang.String |
crypt(java.lang.String salt,
char[] password)
Encrypts a single password. |
java.lang.String |
encode(char[] password)
Encodes a single password. |
static java.lang.String |
encodePassword(char[] password)
Encodes a single password. |
static void |
main(java.lang.String[] args)
Encodes an array of passwords. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MD5CryptPasswordEncoder()
Method Detail |
public static java.lang.String encodePassword(char[] password)
Encodes a single password by calling the crypt(String, char[])
method
with the salt argument generated from the current system time.
password
- the password
public static void main(java.lang.String[] args)
The original/encoded pairs are printed to System.out on a separate lines.
args
- the passwords to encodepublic java.lang.String encode(char[] password)
PasswordEncoder
Note that two subsequent calls to this method with the same argument may result in two
different strings returned. Use the compare
method therefore
for comparing the encoded password with its plain format.
encode
in interface PasswordEncoder
password
- the password
public boolean compare(java.lang.String encoded, char[] plain)
PasswordEncoder
compare
in interface PasswordEncoder
encoded
- the encoded passwordplain
- the plain (non-encoded) password
public static java.lang.String crypt(java.lang.String salt, char[] password)
salt
- the saltpassword
- the password
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |