|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.util.PasswordManager
public class PasswordManager
Manage both plaintext and salted/hashed password storage in router.config. There's no state here, so instantiate at will.
Field Summary | |
---|---|
protected static String |
PROP_B64
stored obfuscated as b64 of the UTF-8 bytes |
protected static String |
PROP_CRYPT
stored as a Unix crypt string |
protected static String |
PROP_MD5
stored as the hex of the MD5 hash of the ISO-8859-1 bytes. |
protected static String |
PROP_PW
stored as plain text |
protected static String |
PROP_SHASH
stored as the b64 of the 16 byte salt + the 32 byte hash of the UTF-8 bytes |
protected static int |
SALT_LENGTH
|
protected static int |
SHASH_LENGTH
48 |
Constructor Summary | |
---|---|
PasswordManager(I2PAppContext ctx)
|
Method Summary | |
---|---|
boolean |
check(String realm,
String user,
String pw)
Checks both plaintext and hash |
boolean |
checkB64(String realm,
String user,
String pw)
|
boolean |
checkHash(String realm,
String user,
String pw)
With random salt |
boolean |
checkPlain(String realm,
String user,
String pw)
|
String |
get(String realm,
String user)
Either plain or b64 |
String |
getB64(String realm,
String user)
|
String |
getPlain(String realm,
String user)
|
static String |
md5Hex(String fullpw)
Straight MD5, no salt Will return the MD5 sum of the data, compatible with Jetty and RFC 2617. |
static String |
md5Hex(String subrealm,
String user,
String pw)
Straight MD5, no salt Will return the MD5 sum of "user:subrealm:pw", compatible with Jetty and RFC 2617. |
static byte[] |
md5Sum(byte[] data)
Standard MD5 checksum |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final int SALT_LENGTH
protected static final int SHASH_LENGTH
protected static final String PROP_PW
protected static final String PROP_B64
protected static final String PROP_MD5
protected static final String PROP_CRYPT
protected static final String PROP_SHASH
Constructor Detail |
---|
public PasswordManager(I2PAppContext ctx)
Method Detail |
---|
public boolean check(String realm, String user, String pw)
realm
- e.g. i2cp, routerconsole, etc.user
- null or "" for no user, already trimmedpw
- plain text, already trimmed
public boolean checkPlain(String realm, String user, String pw)
realm
- e.g. i2cp, routerconsole, etc.user
- null or "" for no user, already trimmedpw
- plain text, already trimmed
public boolean checkB64(String realm, String user, String pw)
realm
- e.g. i2cp, routerconsole, etc.user
- null or "" for no user, already trimmedpw
- plain text, already trimmed
public boolean checkHash(String realm, String user, String pw)
realm
- e.g. i2cp, routerconsole, etc.user
- null or "" for no user, already trimmedpw
- plain text, already trimmed
public String get(String realm, String user)
realm
- e.g. i2cp, routerconsole, etc.user
- null or "" for no user, already trimmed
public String getPlain(String realm, String user)
realm
- e.g. i2cp, routerconsole, etc.user
- null or "" for no user, already trimmed
public String getB64(String realm, String user)
realm
- e.g. i2cp, routerconsole, etc.user
- null or "" for no user, already trimmed
public static String md5Hex(String subrealm, String user, String pw)
subrealm
- to be used in creating the checksumuser
- non-null, non-empty, already trimmedpw
- non-null, plain text, already trimmed
public static String md5Hex(String fullpw)
fullpw
- non-null, plain text, already trimmed
public static byte[] md5Sum(byte[] data)
data
- non-null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |