Class SaltedSimpleDigestPasswordImpl
- java.lang.Object
-
- org.wildfly.security.password.impl.AbstractPasswordImpl
-
- org.wildfly.security.password.impl.SaltedSimpleDigestPasswordImpl
-
- All Implemented Interfaces:
Serializable,Cloneable,Key,SaltedSimpleDigestPassword,OneWayPassword,Password
class SaltedSimpleDigestPasswordImpl extends AbstractPasswordImpl implements SaltedSimpleDigestPassword
APasswordimplementation forSaltedSimpleDigestPassword.- Author:
- Darran Lofthouse
-
-
Field Summary
Fields Modifier and Type Field Description private Stringalgorithmprivate byte[]digestprivate byte[]saltprivate static longserialVersionUID-
Fields inherited from interface org.wildfly.security.password.interfaces.SaltedSimpleDigestPassword
ALGORITHM_PASSWORD_SALT_DIGEST_MD5, ALGORITHM_PASSWORD_SALT_DIGEST_SHA_1, ALGORITHM_PASSWORD_SALT_DIGEST_SHA_256, ALGORITHM_PASSWORD_SALT_DIGEST_SHA_384, ALGORITHM_PASSWORD_SALT_DIGEST_SHA_512, ALGORITHM_SALT_PASSWORD_DIGEST_MD5, ALGORITHM_SALT_PASSWORD_DIGEST_SHA_1, ALGORITHM_SALT_PASSWORD_DIGEST_SHA_256, ALGORITHM_SALT_PASSWORD_DIGEST_SHA_384, ALGORITHM_SALT_PASSWORD_DIGEST_SHA_512, DEFAULT_SALT_SIZE
-
-
Constructor Summary
Constructors Modifier Constructor Description (package private)SaltedSimpleDigestPasswordImpl(String algorithm, byte[] salt, byte[] digest)privateSaltedSimpleDigestPasswordImpl(String algorithm, byte[] salt, char[] password, Charset hashCharset)(package private)SaltedSimpleDigestPasswordImpl(String algorithm, char[] password, Charset hashCharset)(package private)SaltedSimpleDigestPasswordImpl(String algorithm, char[] password, SaltedPasswordAlgorithmSpec spec, Charset hashCharset)(package private)SaltedSimpleDigestPasswordImpl(String algorithm, ClearPasswordSpec spec)(package private)SaltedSimpleDigestPasswordImpl(String algorithm, SaltedHashPasswordSpec spec)(package private)SaltedSimpleDigestPasswordImpl(SaltedSimpleDigestPassword password)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SaltedSimpleDigestPasswordImplclone()Creates and returns a copy of thisPassword.(package private) <T extends KeySpec>
booleanconvertibleTo(Class<T> keySpecType)private static byte[]digestOf(String algorithm, byte[] salt, char[] password, Charset hashCharset)booleanequals(Object obj)StringgetAlgorithm()byte[]getDigest()Get the digest represented by this password.(package private) <S extends KeySpec>
SgetKeySpec(Class<S> keySpecType)private static MessageDigestgetMessageDigest(String algorithm)byte[]getSalt()Get the salt used to generate the digest.inthashCode()private static booleanisSaltFirst(String algorithm)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 java.security.Key
getEncoded, getFormat
-
Methods inherited from interface org.wildfly.security.password.Password
castAndApply, castAndApply, castAs, castAs
-
Methods inherited from interface org.wildfly.security.password.interfaces.SaltedSimpleDigestPassword
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
-
salt
private final byte[] salt
-
-
Constructor Detail
-
SaltedSimpleDigestPasswordImpl
SaltedSimpleDigestPasswordImpl(String algorithm, byte[] salt, byte[] digest)
-
SaltedSimpleDigestPasswordImpl
SaltedSimpleDigestPasswordImpl(String algorithm, SaltedHashPasswordSpec spec)
-
SaltedSimpleDigestPasswordImpl
SaltedSimpleDigestPasswordImpl(SaltedSimpleDigestPassword password)
-
SaltedSimpleDigestPasswordImpl
SaltedSimpleDigestPasswordImpl(String algorithm, ClearPasswordSpec spec) throws InvalidKeySpecException
- Throws:
InvalidKeySpecException
-
SaltedSimpleDigestPasswordImpl
SaltedSimpleDigestPasswordImpl(String algorithm, char[] password, SaltedPasswordAlgorithmSpec spec, Charset hashCharset) throws InvalidKeySpecException
- Throws:
InvalidKeySpecException
-
SaltedSimpleDigestPasswordImpl
SaltedSimpleDigestPasswordImpl(String algorithm, char[] password, Charset hashCharset) throws InvalidKeySpecException
- Throws:
InvalidKeySpecException
-
SaltedSimpleDigestPasswordImpl
private SaltedSimpleDigestPasswordImpl(String algorithm, byte[] salt, char[] password, Charset hashCharset) throws InvalidKeySpecException
- Throws:
InvalidKeySpecException
-
-
Method Detail
-
getAlgorithm
public String getAlgorithm()
- Specified by:
getAlgorithmin interfaceKey
-
getDigest
public byte[] getDigest()
Description copied from interface:SaltedSimpleDigestPasswordGet the digest represented by this password.- Specified by:
getDigestin interfaceSaltedSimpleDigestPassword- Returns:
- the digest represented by this password
-
getSalt
public byte[] getSalt()
Description copied from interface:SaltedSimpleDigestPasswordGet the salt used to generate the digest.- Specified by:
getSaltin interfaceSaltedSimpleDigestPassword- Returns:
- the salt used to generate the digest
-
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
-
digestOf
private static byte[] digestOf(String algorithm, byte[] salt, char[] password, Charset hashCharset) throws NoSuchAlgorithmException
- Throws:
NoSuchAlgorithmException
-
getMessageDigest
private static MessageDigest getMessageDigest(String algorithm) throws NoSuchAlgorithmException
- Throws:
NoSuchAlgorithmException
-
isSaltFirst
private static boolean isSaltFirst(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 SaltedSimpleDigestPasswordImpl clone()
Description copied from interface:PasswordCreates and returns a copy of thisPassword.- Specified by:
clonein interfaceOneWayPassword- Specified by:
clonein interfacePassword- Specified by:
clonein interfaceSaltedSimpleDigestPassword- Specified by:
clonein classAbstractPasswordImpl- Returns:
- a copy of this
Password.
-
-