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 String
algorithm
private static int
DEFAULT_ITERATION_COUNT
private static char[]
DEFAULT_PBE_KEY
private static int
DEFAULT_SALT_SIZE
private byte[]
initializationVector
private char[]
initialKeyMaterial
private int
iterationCount
private byte[]
maskedPasswordBytes
private byte[]
salt
private static long
serialVersionUID
-
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)
private
MaskedPasswordImpl(String algorithm, char[] initialKeyMaterial, int iterationCount, byte[] salt, byte[] initializationVector, byte[] maskedPasswordBytes)
private
MaskedPasswordImpl(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 MaskedPasswordImpl
clone()
Creates and returns a copy of thisPassword
.(package private) <T extends KeySpec>
booleanconvertibleTo(Class<T> keySpecType)
boolean
equals(Object obj)
String
getAlgorithm()
private Cipher
getCipher(int cipherMode, byte[] initializationVector)
byte[]
getInitializationVector()
Get the initialization vector.char[]
getInitialKeyMaterial()
Get the initial key material.int
getIterationCount()
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.int
hashCode()
private void
readObject(ObjectInputStream ignored)
private char[]
unmask()
(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 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:
getAlgorithm
in interfaceKey
-
getInitialKeyMaterial
public char[] getInitialKeyMaterial()
Description copied from interface:MaskedPassword
Get the initial key material.- Specified by:
getInitialKeyMaterial
in interfaceMaskedPassword
- Returns:
- the initial key material (must not be
null
)
-
getIterationCount
public int getIterationCount()
Description copied from interface:MaskedPassword
Get the iteration count.- Specified by:
getIterationCount
in interfaceMaskedPassword
- Returns:
- the iteration count
-
getSalt
public byte[] getSalt()
Description copied from interface:MaskedPassword
Get the salt bytes.- Specified by:
getSalt
in interfaceMaskedPassword
- Returns:
- the salt bytes (must not be
null
)
-
getMaskedPasswordBytes
public byte[] getMaskedPasswordBytes()
Description copied from interface:MaskedPassword
Get the masked password bytes.- Specified by:
getMaskedPasswordBytes
in interfaceMaskedPassword
- Returns:
- the masked password bytes (must not be
null
)
-
getInitializationVector
public byte[] getInitializationVector()
Description copied from interface:MaskedPassword
Get the initialization vector.- Specified by:
getInitializationVector
in interfaceMaskedPassword
- Returns:
- the initialization vector (
null
if not used)
-
getKeySpec
<S extends KeySpec> S getKeySpec(Class<S> keySpecType) throws InvalidKeySpecException
- Specified by:
getKeySpec
in classAbstractPasswordImpl
- Throws:
InvalidKeySpecException
-
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
-
clone
public MaskedPasswordImpl clone()
Description copied from interface:Password
Creates and returns a copy of thisPassword
.- Specified by:
clone
in interfaceMaskedPassword
- Specified by:
clone
in interfacePassword
- Specified by:
clone
in interfaceTwoWayPassword
- Specified by:
clone
in 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:
hashCode
in classAbstractPasswordImpl
-
equals
public boolean equals(Object obj)
- Specified by:
equals
in classAbstractPasswordImpl
-
writeReplace
Object writeReplace()
-
readObject
private void readObject(ObjectInputStream ignored) throws NotSerializableException
- Throws:
NotSerializableException
-
-