Class MaskedPasswordImpl
- java.lang.Object
-
- org.wildfly.security.password.impl.AbstractPasswordImpl
-
- org.wildfly.security.password.impl.MaskedPasswordImpl
-
- All Implemented Interfaces:
Serializable,Cloneable,Key,Destroyable,MaskedPassword,Password,TwoWayPassword
final class MaskedPasswordImpl extends AbstractPasswordImpl implements MaskedPassword
-
-
Field Summary
Fields Modifier and Type Field Description private Stringalgorithmprivate static intDEFAULT_ITERATION_COUNTprivate static char[]DEFAULT_PBE_KEYprivate static intDEFAULT_SALT_SIZEprivate byte[]initializationVectorprivate char[]initialKeyMaterialprivate intiterationCountprivate byte[]maskedPasswordBytesprivate byte[]saltprivate static longserialVersionUID-
Fields inherited from interface org.wildfly.security.password.interfaces.MaskedPassword
ALGORITHM_MASKED_HMAC_SHA1_AES_128, ALGORITHM_MASKED_HMAC_SHA1_AES_256, ALGORITHM_MASKED_HMAC_SHA224_AES_128, ALGORITHM_MASKED_HMAC_SHA224_AES_256, ALGORITHM_MASKED_HMAC_SHA256_AES_128, ALGORITHM_MASKED_HMAC_SHA256_AES_256, ALGORITHM_MASKED_HMAC_SHA384_AES_128, ALGORITHM_MASKED_HMAC_SHA384_AES_256, ALGORITHM_MASKED_HMAC_SHA512_AES_128, ALGORITHM_MASKED_HMAC_SHA512_AES_256, ALGORITHM_MASKED_MD5_3DES, ALGORITHM_MASKED_MD5_3DES_CBC_PKCS5, ALGORITHM_MASKED_MD5_DES, ALGORITHM_MASKED_MD5_DES_CBC_PKCS5, ALGORITHM_MASKED_PBKDF_HMAC_SHA1, ALGORITHM_MASKED_PBKDF_HMAC_SHA224, ALGORITHM_MASKED_PBKDF_HMAC_SHA256, ALGORITHM_MASKED_PBKDF_HMAC_SHA384, ALGORITHM_MASKED_PBKDF_HMAC_SHA512, ALGORITHM_MASKED_SHA1_DES_EDE, ALGORITHM_MASKED_SHA1_DES_EDE_CBC_PKCS5, ALGORITHM_MASKED_SHA1_RC2_128, ALGORITHM_MASKED_SHA1_RC2_128_CBC_PKCS5, ALGORITHM_MASKED_SHA1_RC2_40, ALGORITHM_MASKED_SHA1_RC2_40_CBC_PKCS5, ALGORITHM_MASKED_SHA1_RC4_128, ALGORITHM_MASKED_SHA1_RC4_128_ECB, ALGORITHM_MASKED_SHA1_RC4_40, ALGORITHM_MASKED_SHA1_RC4_40_ECB
-
-
Constructor Summary
Constructors Modifier Constructor Description (package private)MaskedPasswordImpl(String algorithm, char[] clearPassword)privateMaskedPasswordImpl(String algorithm, char[] initialKeyMaterial, int iterationCount, byte[] salt, byte[] initializationVector, byte[] maskedPasswordBytes)privateMaskedPasswordImpl(String algorithm, char[] initialKeyMaterial, int iterationCount, byte[] salt, char[] chars)(package private)MaskedPasswordImpl(String algorithm, char[] clearPassword, IteratedPasswordAlgorithmSpec parameterSpec)(package private)MaskedPasswordImpl(String algorithm, char[] clearPassword, IteratedSaltedPasswordAlgorithmSpec parameterSpec)(package private)MaskedPasswordImpl(String algorithm, char[] clearPassword, MaskedPasswordAlgorithmSpec parameterSpec)(package private)MaskedPasswordImpl(String algorithm, char[] clearPassword, SaltedPasswordAlgorithmSpec parameterSpec)(package private)MaskedPasswordImpl(String algorithm, ClearPasswordSpec keySpec)(package private)MaskedPasswordImpl(String algorithm, MaskedPasswordSpec passwordSpec)(package private)MaskedPasswordImpl(MaskedPassword password)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MaskedPasswordImplclone()Creates and returns a copy of thisPassword.(package private) <T extends KeySpec>
booleanconvertibleTo(Class<T> keySpecType)booleanequals(Object obj)StringgetAlgorithm()private CiphergetCipher(int cipherMode, byte[] initializationVector)byte[]getInitializationVector()Get the initialization vector.char[]getInitialKeyMaterial()Get the initial key material.intgetIterationCount()Get the iteration count.(package private) <S extends KeySpec>
SgetKeySpec(Class<S> keySpecType)byte[]getMaskedPasswordBytes()Get the masked password bytes.byte[]getSalt()Get the salt bytes.inthashCode()private voidreadObject(ObjectInputStream ignored)private char[]unmask()(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 javax.security.auth.Destroyable
destroy, isDestroyed
-
Methods inherited from interface java.security.Key
getEncoded, getFormat
-
Methods inherited from interface org.wildfly.security.password.interfaces.MaskedPassword
getParameterSpec, impliesParameters
-
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
-
DEFAULT_PBE_KEY
private static final char[] DEFAULT_PBE_KEY
-
DEFAULT_SALT_SIZE
private static final int DEFAULT_SALT_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_ITERATION_COUNT
private static final int DEFAULT_ITERATION_COUNT
- See Also:
- Constant Field Values
-
algorithm
private final String algorithm
-
initialKeyMaterial
private final char[] initialKeyMaterial
-
iterationCount
private final int iterationCount
-
salt
private final byte[] salt
-
maskedPasswordBytes
private final byte[] maskedPasswordBytes
-
initializationVector
private final byte[] initializationVector
-
-
Constructor Detail
-
MaskedPasswordImpl
private MaskedPasswordImpl(String algorithm, char[] initialKeyMaterial, int iterationCount, byte[] salt, byte[] initializationVector, byte[] maskedPasswordBytes) throws InvalidKeySpecException
- Throws:
InvalidKeySpecException
-
MaskedPasswordImpl
private MaskedPasswordImpl(String algorithm, char[] initialKeyMaterial, int iterationCount, byte[] salt, char[] chars) throws InvalidKeySpecException
- Throws:
InvalidKeySpecException
-
MaskedPasswordImpl
MaskedPasswordImpl(String algorithm, MaskedPasswordSpec passwordSpec) throws InvalidKeySpecException
- Throws:
InvalidKeySpecException
-
MaskedPasswordImpl
MaskedPasswordImpl(String algorithm, char[] clearPassword) throws InvalidKeySpecException
- Throws:
InvalidKeySpecException
-
MaskedPasswordImpl
MaskedPasswordImpl(String algorithm, char[] clearPassword, MaskedPasswordAlgorithmSpec parameterSpec) throws InvalidKeySpecException
- Throws:
InvalidKeySpecException
-
MaskedPasswordImpl
MaskedPasswordImpl(String algorithm, char[] clearPassword, IteratedSaltedPasswordAlgorithmSpec parameterSpec) throws InvalidKeySpecException
- Throws:
InvalidKeySpecException
-
MaskedPasswordImpl
MaskedPasswordImpl(String algorithm, char[] clearPassword, SaltedPasswordAlgorithmSpec parameterSpec) throws InvalidKeySpecException
- Throws:
InvalidKeySpecException
-
MaskedPasswordImpl
MaskedPasswordImpl(String algorithm, char[] clearPassword, IteratedPasswordAlgorithmSpec parameterSpec) throws InvalidKeySpecException
- Throws:
InvalidKeySpecException
-
MaskedPasswordImpl
MaskedPasswordImpl(String algorithm, ClearPasswordSpec keySpec) throws InvalidKeySpecException
- Throws:
InvalidKeySpecException
-
MaskedPasswordImpl
MaskedPasswordImpl(MaskedPassword password) throws InvalidKeySpecException
- Throws:
InvalidKeySpecException
-
-
Method Detail
-
getAlgorithm
public String getAlgorithm()
- Specified by:
getAlgorithmin interfaceKey
-
getInitialKeyMaterial
public char[] getInitialKeyMaterial()
Description copied from interface:MaskedPasswordGet the initial key material.- Specified by:
getInitialKeyMaterialin interfaceMaskedPassword- Returns:
- the initial key material (must not be
null)
-
getIterationCount
public int getIterationCount()
Description copied from interface:MaskedPasswordGet the iteration count.- Specified by:
getIterationCountin interfaceMaskedPassword- Returns:
- the iteration count
-
getSalt
public byte[] getSalt()
Description copied from interface:MaskedPasswordGet the salt bytes.- Specified by:
getSaltin interfaceMaskedPassword- Returns:
- the salt bytes (must not be
null)
-
getMaskedPasswordBytes
public byte[] getMaskedPasswordBytes()
Description copied from interface:MaskedPasswordGet the masked password bytes.- Specified by:
getMaskedPasswordBytesin interfaceMaskedPassword- Returns:
- the masked password bytes (must not be
null)
-
getInitializationVector
public byte[] getInitializationVector()
Description copied from interface:MaskedPasswordGet the initialization vector.- Specified by:
getInitializationVectorin interfaceMaskedPassword- Returns:
- the initialization vector (
nullif not used)
-
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
-
clone
public MaskedPasswordImpl clone()
Description copied from interface:PasswordCreates and returns a copy of thisPassword.- Specified by:
clonein interfaceMaskedPassword- Specified by:
clonein interfacePassword- Specified by:
clonein interfaceTwoWayPassword- Specified by:
clonein classAbstractPasswordImpl- Returns:
- a copy of this
Password.
-
unmask
private char[] unmask() throws InvalidKeySpecException- Throws:
InvalidKeySpecException
-
getCipher
private Cipher getCipher(int cipherMode, byte[] initializationVector) throws GeneralSecurityException
- Throws:
GeneralSecurityException
-
hashCode
public int hashCode()
- Specified by:
hashCodein classAbstractPasswordImpl
-
equals
public boolean equals(Object obj)
- Specified by:
equalsin classAbstractPasswordImpl
-
writeReplace
Object writeReplace()
-
readObject
private void readObject(ObjectInputStream ignored) throws NotSerializableException
- Throws:
NotSerializableException
-
-