Often a Credential is related to a Password via a one way algorithm, so while a Password itself is a Credential, a UnixCrypt or MD5 digest of a a password is only a credential that can be checked against the password.
This class includes an implementation for unix Crypt an MD5 digest.
Password
| Modifier and Type | Class and Description |
|---|---|
| public static class | Credential.Crypt
Unix Crypt Credentials |
| public static class | Credential.MD5
MD5 Credentials |
| Modifier and Type | Field and Description |
|---|---|
| private static final List | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected static boolean | Returns: whether the two byte arrays are equalthe first byte array to compare (should be known value) known, byte[] the second byte array to compare (should be unknown value) unknown)Utility method that replaces Arrays.equals() to avoid timing attacks. |
| public abstract boolean | Returns: True if the credentials indicated that the shared secret is known to both this Credential and the passed credential.The credential to check against. This may either be another Credential object, a Password object or a String which is interpreted by this
credential. credentials)Check a credential |
| public static Credential | Returns: A Credential or Password instance.String representation of the credential credential)Get a credential from a String. |
| protected static boolean | Returns: whether the two strings are equalthe first string to compare (should be known string) known, String the second string to compare (should be the unknown string) unknown)Utility method that replaces String.equals() to avoid timing attacks. |
| CREDENTIAL_PROVIDERS | back to summary |
|---|---|
| private static final List<CredentialProvider> CREDENTIAL_PROVIDERS | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| Credential | back to summary |
|---|---|
| public Credential() | |
| byteEquals | back to summary |
|---|---|
| protected static boolean byteEquals(byte[] known, byte[] unknown) Utility method that replaces Arrays.equals() to avoid timing attacks. The length of the loop executed will always be the length of the unknown credential
| |
| check | back to summary |
|---|---|
| public abstract boolean check(Object credentials) Check a credential
| |
| getCredential | back to summary |
|---|---|
| public static Credential getCredential(String credential) Get a credential from a String. If the credential String starts with a known Credential type (eg "CRYPT:" or "MD5:" ) then a Credential of that type is returned. Otherwise, it tries to find a credential provider whose prefix matches with the start of the credential String. Else the credential is assumed to be a Password.
| |
| stringEquals | back to summary |
|---|---|
| protected static boolean stringEquals(String known, String unknown) Utility method that replaces String.equals() to avoid timing attacks. The length of the loop executed will always be the length of the unknown credential | |
| Modifier and Type | Field and Description |
|---|---|
| private static final String | |
| private final String | |
| private static final long |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | check(Object
The credential to check against. This may either be another Credential object, a Password object or a String which is interpreted by this
credential. credentials)Implements abstract org. |
| public static String | |
| public boolean | equals(Object
the reference object with which to compare. credential)Overrides java. |
| __TYPE | back to summary |
|---|---|
| private static final String __TYPE | |
| _cooked | back to summary |
|---|---|
| private final String _cooked | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides org. | |
| Crypt | back to summary |
|---|---|
| pack-priv Crypt(String cooked) | |
| check | back to summary |
|---|---|
| public boolean check(Object credentials) Implements abstract org. Doc from org. Check a credential
| |
| crypt | back to summary |
|---|---|
| public static String crypt(String user, String pw) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object credential) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| Modifier and Type | Field and Description |
|---|---|
| private static MessageDigest | |
| private static final AutoLock | |
| private static final String | |
| private final byte[] | |
| private static final long |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | check(Object
The credential to check against. This may either be another Credential object, a Password object or a String which is interpreted by this
credential. credentials)Implements abstract org. |
| public static String | |
| public boolean | equals(Object
the reference object with which to compare. obj)Overrides java. |
| public byte[] |
| __md | back to summary |
|---|---|
| private static MessageDigest __md | |
| __md5Lock | back to summary |
|---|---|
| private static final AutoLock __md5Lock | |
| __TYPE | back to summary |
|---|---|
| private static final String __TYPE | |
| _digest | back to summary |
|---|---|
| private final byte[] _digest | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides org. | |
| MD5 | back to summary |
|---|---|
| pack-priv MD5(String digest) | |
| check | back to summary |
|---|---|
| public boolean check(Object credentials) Implements abstract org. Doc from org. Check a credential
| |
| digest | back to summary |
|---|---|
| public static String digest(String password) Used only by Command Line Password utility | |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| getDigest | back to summary |
|---|---|
| public byte[] getDigest() | |