Class UnixDESCryptPasswordImpl
- java.lang.Object
-
- org.wildfly.security.password.impl.AbstractPasswordImpl
-
- org.wildfly.security.password.impl.UnixDESCryptPasswordImpl
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Key
,UnixDESCryptPassword
,OneWayPassword
,Password
class UnixDESCryptPasswordImpl extends AbstractPasswordImpl implements UnixDESCryptPassword
- Author:
- David M. Lloyd
-
-
Field Summary
Fields Modifier and Type Field Description private byte[]
hash
private short
salt
private static long
serialVersionUID
private static boolean[]
SHIFT2
private static int[][]
SKB
private static int[][]
SP_TRANS
-
Fields inherited from interface org.wildfly.security.password.interfaces.UnixDESCryptPassword
ALGORITHM_CRYPT_DES
-
-
Constructor Summary
Constructors Constructor Description UnixDESCryptPasswordImpl(byte[] saltBytes, byte[] hash)
UnixDESCryptPasswordImpl(byte[] saltBytes, char[] passwordChars, Charset hashCharset)
UnixDESCryptPasswordImpl(char[] passwordChars, Charset hashCharset)
UnixDESCryptPasswordImpl(char[] passwordChars, SaltedPasswordAlgorithmSpec algorithmSpec, Charset hashCharset)
UnixDESCryptPasswordImpl(short salt, byte[] hash)
UnixDESCryptPasswordImpl(short salt, char[] passwordChars)
UnixDESCryptPasswordImpl(short salt, char[] passwordChars, Charset hashCharset)
UnixDESCryptPasswordImpl(UnixDESCryptPassword password)
UnixDESCryptPasswordImpl(ClearPasswordSpec spec)
UnixDESCryptPasswordImpl(SaltedHashPasswordSpec spec)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static int[]
body(int[] schedule, int eSwap0, int eSwap1)
UnixDESCryptPasswordImpl
clone()
Creates and returns a copy of thisPassword
.(package private) <T extends KeySpec>
booleanconvertibleTo(Class<T> keySpecType)
private static byte[]
crypt(byte[] original, short salt)
private static int
dEncrypt(int el, int r, int s, int e0, int e1, int[] sArr)
private static int[]
desSetKey(byte[] key)
boolean
equals(Object obj)
private static int
fourBytesToInt(byte[] b, int offset)
private static byte[]
generateHash(short salt, char[] password)
private static byte[]
generateHash(short salt, char[] password, Charset hashCharset)
String
getAlgorithm()
byte[]
getHash()
Get the crypt bytes, not including the salt.(package private) <S extends KeySpec>
SgetKeySpec(Class<S> keySpecType)
short
getSalt()
Get the salt of this password as ashort
.int
hashCode()
private static int
hPermOp(int a, int n, int m)
private static void
intToFourBytes(int iValue, byte[] b, int offset)
private static void
permOp(int a, int b, int n, int m, int[] results)
private void
readObject(ObjectInputStream ignored)
private static short
saltFromBytes(byte[] saltBytes)
(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
-
Methods inherited from interface org.wildfly.security.password.interfaces.UnixDESCryptPassword
getParameterSpec, impliesParameters
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
salt
private final short salt
-
hash
private final byte[] hash
-
SHIFT2
private static final boolean[] SHIFT2
-
SKB
private static final int[][] SKB
-
SP_TRANS
private static final int[][] SP_TRANS
-
-
Constructor Detail
-
UnixDESCryptPasswordImpl
UnixDESCryptPasswordImpl(short salt, byte[] hash) throws InvalidKeyException
- Throws:
InvalidKeyException
-
UnixDESCryptPasswordImpl
UnixDESCryptPasswordImpl(byte[] saltBytes, byte[] hash) throws InvalidParameterSpecException, InvalidKeyException
-
UnixDESCryptPasswordImpl
UnixDESCryptPasswordImpl(byte[] saltBytes, char[] passwordChars, Charset hashCharset) throws InvalidParameterSpecException, InvalidKeyException
-
UnixDESCryptPasswordImpl
UnixDESCryptPasswordImpl(SaltedHashPasswordSpec spec) throws InvalidKeySpecException, InvalidParameterSpecException, InvalidKeyException
-
UnixDESCryptPasswordImpl
UnixDESCryptPasswordImpl(ClearPasswordSpec spec) throws InvalidKeySpecException, InvalidKeyException
-
UnixDESCryptPasswordImpl
UnixDESCryptPasswordImpl(char[] passwordChars, Charset hashCharset) throws InvalidKeyException
- Throws:
InvalidKeyException
-
UnixDESCryptPasswordImpl
UnixDESCryptPasswordImpl(char[] passwordChars, SaltedPasswordAlgorithmSpec algorithmSpec, Charset hashCharset) throws InvalidParameterSpecException, InvalidKeyException
-
UnixDESCryptPasswordImpl
UnixDESCryptPasswordImpl(UnixDESCryptPassword password) throws InvalidKeyException
- Throws:
InvalidKeyException
-
UnixDESCryptPasswordImpl
UnixDESCryptPasswordImpl(short salt, char[] passwordChars) throws InvalidKeyException
- Throws:
InvalidKeyException
-
UnixDESCryptPasswordImpl
UnixDESCryptPasswordImpl(short salt, char[] passwordChars, Charset hashCharset) throws InvalidKeyException
- Throws:
InvalidKeyException
-
-
Method Detail
-
saltFromBytes
private static short saltFromBytes(byte[] saltBytes) throws InvalidParameterSpecException
- Throws:
InvalidParameterSpecException
-
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
-
getAlgorithm
public String getAlgorithm()
- Specified by:
getAlgorithm
in interfaceKey
-
getSalt
public short getSalt()
Description copied from interface:UnixDESCryptPassword
Get the salt of this password as ashort
.- Specified by:
getSalt
in interfaceUnixDESCryptPassword
- Returns:
- the salt
-
getHash
public byte[] getHash()
Description copied from interface:UnixDESCryptPassword
Get the crypt bytes, not including the salt.- Specified by:
getHash
in interfaceUnixDESCryptPassword
- Returns:
- the crypt bytes
-
generateHash
private static byte[] generateHash(short salt, char[] password)
-
generateHash
private static byte[] generateHash(short salt, char[] password, Charset hashCharset)
-
crypt
private static byte[] crypt(byte[] original, short salt)
-
body
private static int[] body(int[] schedule, int eSwap0, int eSwap1)
-
dEncrypt
private static int dEncrypt(int el, int r, int s, int e0, int e1, int[] sArr)
-
desSetKey
private static int[] desSetKey(byte[] key)
-
fourBytesToInt
private static int fourBytesToInt(byte[] b, int offset)
-
hPermOp
private static int hPermOp(int a, int n, int m)
-
intToFourBytes
private static void intToFourBytes(int iValue, byte[] b, int offset)
-
permOp
private static void permOp(int a, int b, int n, int m, int[] results)
-
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 UnixDESCryptPasswordImpl 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 interfaceUnixDESCryptPassword
- Specified by:
clone
in classAbstractPasswordImpl
- Returns:
- a copy of this
Password
.
-
-