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[]hashprivate shortsaltprivate static longserialVersionUIDprivate static boolean[]SHIFT2private static int[][]SKBprivate 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)UnixDESCryptPasswordImplclone()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 intdEncrypt(int el, int r, int s, int e0, int e1, int[] sArr)private static int[]desSetKey(byte[] key)booleanequals(Object obj)private static intfourBytesToInt(byte[] b, int offset)private static byte[]generateHash(short salt, char[] password)private static byte[]generateHash(short salt, char[] password, Charset hashCharset)StringgetAlgorithm()byte[]getHash()Get the crypt bytes, not including the salt.(package private) <S extends KeySpec>
SgetKeySpec(Class<S> keySpecType)shortgetSalt()Get the salt of this password as ashort.inthashCode()private static inthPermOp(int a, int n, int m)private static voidintToFourBytes(int iValue, byte[] b, int offset)private static voidpermOp(int a, int b, int n, int m, int[] results)private voidreadObject(ObjectInputStream ignored)private static shortsaltFromBytes(byte[] saltBytes)(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.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:
 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
 
- 
getAlgorithm
public String getAlgorithm()
- Specified by:
 getAlgorithmin interfaceKey
 
- 
getSalt
public short getSalt()
Description copied from interface:UnixDESCryptPasswordGet the salt of this password as ashort.- Specified by:
 getSaltin interfaceUnixDESCryptPassword- Returns:
 - the salt
 
 
- 
getHash
public byte[] getHash()
Description copied from interface:UnixDESCryptPasswordGet the crypt bytes, not including the salt.- Specified by:
 getHashin 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:
 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 UnixDESCryptPasswordImpl clone()
Description copied from interface:PasswordCreates and returns a copy of thisPassword.- Specified by:
 clonein interfaceOneWayPassword- Specified by:
 clonein interfacePassword- Specified by:
 clonein interfaceUnixDESCryptPassword- Specified by:
 clonein classAbstractPasswordImpl- Returns:
 - a copy of this 
Password. 
 
 - 
 
 -