Class DigestPasswordImpl
- java.lang.Object
-
- org.wildfly.security.password.impl.AbstractPasswordImpl
-
- org.wildfly.security.password.impl.DigestPasswordImpl
-
- All Implemented Interfaces:
Serializable,Cloneable,Key,DigestPassword,OneWayPassword,Password
class DigestPasswordImpl extends AbstractPasswordImpl implements DigestPassword
Pre-digested (DigestMD5) credential type implementation.- Author:
- Peter Skopek., Darran Lofthouse
-
-
Field Summary
Fields Modifier and Type Field Description private Stringalgorithmprivate byte[]digestprivate Stringrealmprivate static longserialVersionUIDprivate Stringusername-
Fields inherited from interface org.wildfly.security.password.interfaces.DigestPassword
ALGORITHM_DIGEST_MD5, ALGORITHM_DIGEST_SHA, ALGORITHM_DIGEST_SHA_256, ALGORITHM_DIGEST_SHA_384, ALGORITHM_DIGEST_SHA_512, ALGORITHM_DIGEST_SHA_512_256
-
-
Constructor Summary
Constructors Constructor Description DigestPasswordImpl(String algorithm, char[] password, DigestPasswordAlgorithmSpec spec, Charset hashCharset)DigestPasswordImpl(String algorithm, String username, String realm, byte[] digest)DigestPasswordImpl(String algorithm, DigestPasswordSpec spec)DigestPasswordImpl(String algorithm, EncryptablePasswordSpec spec)DigestPasswordImpl(DigestPassword password)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description DigestPasswordImplclone()Creates and returns a copy of thisPassword.(package private) <T extends KeySpec>
booleanconvertibleTo(Class<T> keySpecType)booleanequals(Object obj)StringgetAlgorithm()byte[]getDigest()Get the digest represented by thisPassword.(package private) <S extends KeySpec>
SgetKeySpec(Class<S> keySpecType)private static MessageDigestgetMessageDigest(String algorithm)StringgetRealm()Get the realm thisPasswordis associated with.StringgetUsername()Get the username thisPasswordis associated with.inthashCode()private voidreadObject(ObjectInputStream ignored)(package private) booleanverify(char[] guess)(package private) booleanverify(char[] guess, Charset hashCharset)(package private) ObjectwriteReplace()-
Methods inherited from class org.wildfly.security.password.impl.AbstractPasswordImpl
getEncoded, getFormat, getNormalizedPasswordBytes, getNormalizedPasswordBytes, translate
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.wildfly.security.password.interfaces.DigestPassword
getParameterSpec, impliesParameters
-
Methods inherited from interface java.security.Key
getEncoded, getFormat
-
Methods inherited from interface org.wildfly.security.password.Password
castAndApply, castAndApply, castAs, castAs
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
algorithm
private final String algorithm
-
username
private final String username
-
realm
private final String realm
-
digest
private final byte[] digest
-
-
Constructor Detail
-
DigestPasswordImpl
DigestPasswordImpl(String algorithm, String username, String realm, byte[] digest)
-
DigestPasswordImpl
DigestPasswordImpl(String algorithm, DigestPasswordSpec spec)
-
DigestPasswordImpl
DigestPasswordImpl(DigestPassword password)
-
DigestPasswordImpl
DigestPasswordImpl(String algorithm, EncryptablePasswordSpec spec) throws InvalidKeySpecException
- Throws:
InvalidKeySpecException
-
DigestPasswordImpl
DigestPasswordImpl(String algorithm, char[] password, DigestPasswordAlgorithmSpec spec, Charset hashCharset) throws InvalidKeySpecException
- Throws:
InvalidKeySpecException
-
-
Method Detail
-
getAlgorithm
public String getAlgorithm()
- Specified by:
getAlgorithmin interfaceKey
-
getUsername
public String getUsername()
Description copied from interface:DigestPasswordGet the username thisPasswordis associated with.Generally a
Passwordshould not need to know this information but this is an integral part of how the representation of thisPasswordis created.- Specified by:
getUsernamein interfaceDigestPassword- Returns:
- the username this
Passwordis associated with
-
getRealm
public String getRealm()
Description copied from interface:DigestPasswordGet the realm thisPasswordis associated with.Note: This is independent of the name of the realm used to obtain the
Passwordrepresentation, this is the value used to generate the digest.- Specified by:
getRealmin interfaceDigestPassword- Returns:
- the realm this
Passwordis associated with
-
getDigest
public byte[] getDigest()
Description copied from interface:DigestPasswordGet the digest represented by thisPassword.- Specified by:
getDigestin interfaceDigestPassword- Returns:
- the digest represented by this
Password
-
getKeySpec
<S extends KeySpec> S getKeySpec(Class<S> keySpecType) throws InvalidKeySpecException
- Specified by:
getKeySpecin classAbstractPasswordImpl- Throws:
InvalidKeySpecException
-
verify
boolean verify(char[] guess) throws InvalidKeyException- Specified by:
verifyin classAbstractPasswordImpl- Throws:
InvalidKeyException
-
verify
boolean verify(char[] guess, Charset hashCharset) throws InvalidKeyException- Overrides:
verifyin classAbstractPasswordImpl- Throws:
InvalidKeyException
-
convertibleTo
<T extends KeySpec> boolean convertibleTo(Class<T> keySpecType)
- Specified by:
convertibleToin classAbstractPasswordImpl
-
getMessageDigest
private static MessageDigest getMessageDigest(String algorithm) throws NoSuchAlgorithmException
- Throws:
NoSuchAlgorithmException
-
hashCode
public int hashCode()
- Specified by:
hashCodein classAbstractPasswordImpl
-
equals
public boolean equals(Object obj)
- Specified by:
equalsin classAbstractPasswordImpl
-
readObject
private void readObject(ObjectInputStream ignored) throws NotSerializableException
- Throws:
NotSerializableException
-
writeReplace
Object writeReplace()
-
clone
public DigestPasswordImpl clone()
Description copied from interface:PasswordCreates and returns a copy of thisPassword.- Specified by:
clonein interfaceDigestPassword- Specified by:
clonein interfaceOneWayPassword- Specified by:
clonein interfacePassword- Specified by:
clonein classAbstractPasswordImpl- Returns:
- a copy of this
Password.
-
-