Class SimpleDigestPasswordImpl
- java.lang.Object
-
- org.wildfly.security.password.impl.AbstractPasswordImpl
-
- org.wildfly.security.password.impl.SimpleDigestPasswordImpl
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Key
,SimpleDigestPassword
,OneWayPassword
,Password
class SimpleDigestPasswordImpl extends AbstractPasswordImpl implements SimpleDigestPassword
- Author:
- David M. Lloyd
-
-
Field Summary
Fields Modifier and Type Field Description private String
algorithm
private byte[]
digest
private static long
serialVersionUID
-
Fields inherited from interface org.wildfly.security.password.interfaces.SimpleDigestPassword
ALGORITHM_SIMPLE_DIGEST_MD2, ALGORITHM_SIMPLE_DIGEST_MD5, ALGORITHM_SIMPLE_DIGEST_SHA_1, ALGORITHM_SIMPLE_DIGEST_SHA_256, ALGORITHM_SIMPLE_DIGEST_SHA_384, ALGORITHM_SIMPLE_DIGEST_SHA_512
-
-
Constructor Summary
Constructors Constructor Description SimpleDigestPasswordImpl(String algorithm, byte[] digest)
SimpleDigestPasswordImpl(String algorithm, char[] chars, Charset hashCharset)
SimpleDigestPasswordImpl(String algorithm, ClearPasswordSpec spec)
SimpleDigestPasswordImpl(String algorithm, HashPasswordSpec spec)
SimpleDigestPasswordImpl(SimpleDigestPassword password)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SimpleDigestPasswordImpl
clone()
Creates and returns a copy of thisPassword
.(package private) <T extends KeySpec>
booleanconvertibleTo(Class<T> keySpecType)
boolean
equals(Object obj)
String
getAlgorithm()
byte[]
getDigest()
Get the digest of this password.(package private) static byte[]
getDigestOf(String algorithm, char[] chars, Charset hashCharset)
(package private) static byte[]
getDigestOfKS(String algorithm, char[] chars, Charset hashCharset)
(package private) <S extends KeySpec>
SgetKeySpec(Class<S> keySpecType)
(package private) static MessageDigest
getMessageDigest(String algorithm)
int
hashCode()
private void
readObject(ObjectInputStream ignored)
(package private) boolean
verify(char[] guess)
(package private) boolean
verify(char[] guess, Charset hashCharset)
(package private) Object
writeReplace()
-
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 java.security.Key
getEncoded, getFormat
-
Methods inherited from interface org.wildfly.security.password.Password
castAndApply, castAndApply, castAs, castAs, getParameterSpec, impliesParameters
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
algorithm
private final String algorithm
-
digest
private final byte[] digest
-
-
Constructor Detail
-
SimpleDigestPasswordImpl
SimpleDigestPasswordImpl(String algorithm, byte[] digest)
-
SimpleDigestPasswordImpl
SimpleDigestPasswordImpl(String algorithm, HashPasswordSpec spec)
-
SimpleDigestPasswordImpl
SimpleDigestPasswordImpl(SimpleDigestPassword password)
-
SimpleDigestPasswordImpl
SimpleDigestPasswordImpl(String algorithm, ClearPasswordSpec spec) throws InvalidKeySpecException
- Throws:
InvalidKeySpecException
-
SimpleDigestPasswordImpl
SimpleDigestPasswordImpl(String algorithm, char[] chars, Charset hashCharset) throws InvalidKeySpecException
- Throws:
InvalidKeySpecException
-
-
Method Detail
-
getKeySpec
<S extends KeySpec> S getKeySpec(Class<S> keySpecType) throws InvalidKeySpecException
- Specified by:
getKeySpec
in classAbstractPasswordImpl
- Throws:
InvalidKeySpecException
-
getDigestOfKS
static byte[] getDigestOfKS(String algorithm, char[] chars, Charset hashCharset) throws InvalidKeySpecException
- Throws:
InvalidKeySpecException
-
getDigestOf
static byte[] getDigestOf(String algorithm, char[] chars, Charset hashCharset) throws NoSuchAlgorithmException
- Throws:
NoSuchAlgorithmException
-
getMessageDigest
static MessageDigest getMessageDigest(String algorithm) throws NoSuchAlgorithmException
- Throws:
NoSuchAlgorithmException
-
verify
boolean verify(char[] guess) throws InvalidKeyException
- Specified by:
verify
in classAbstractPasswordImpl
- Throws:
InvalidKeyException
-
verify
boolean verify(char[] guess, Charset hashCharset) throws InvalidKeyException
- Overrides:
verify
in classAbstractPasswordImpl
- Throws:
InvalidKeyException
-
convertibleTo
<T extends KeySpec> boolean convertibleTo(Class<T> keySpecType)
- Specified by:
convertibleTo
in classAbstractPasswordImpl
-
getAlgorithm
public String getAlgorithm()
- Specified by:
getAlgorithm
in interfaceKey
-
getDigest
public byte[] getDigest()
Description copied from interface:SimpleDigestPassword
Get the digest of this password.- Specified by:
getDigest
in interfaceSimpleDigestPassword
- Returns:
- the digest
-
hashCode
public int hashCode()
- Specified by:
hashCode
in classAbstractPasswordImpl
-
equals
public boolean equals(Object obj)
- Specified by:
equals
in classAbstractPasswordImpl
-
readObject
private void readObject(ObjectInputStream ignored) throws NotSerializableException
- Throws:
NotSerializableException
-
writeReplace
Object writeReplace()
-
clone
public SimpleDigestPasswordImpl clone()
Description copied from interface:Password
Creates and returns a copy of thisPassword
.- Specified by:
clone
in interfaceOneWayPassword
- Specified by:
clone
in interfacePassword
- Specified by:
clone
in interfaceSimpleDigestPassword
- Specified by:
clone
in classAbstractPasswordImpl
- Returns:
- a copy of this
Password
.
-
-