| Modifier and Type | Field and Description |
|---|---|
static int |
DES_KEY_LEN
The length of a DES key in bytes.
|
| Constructor and Description |
|---|
DESKeySpec(byte[] key)
Creates a new
DESKeySpec from the first 8 bytes of the
specified key data. |
DESKeySpec(byte[] key,
int offset)
Creates a new
DESKeySpec from the first 8 bytes of the
specified key data starting at offset. |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
getKey()
Returns a copy of the key.
|
static boolean |
isParityAdjusted(byte[] key,
int offset)
Returns whether the specified key data starting at
offset is
parity-adjusted. |
static boolean |
isWeak(byte[] key,
int offset)
Returns whether the specified key data starting at
offset is
weak or semi-weak. |
public static final int DES_KEY_LEN
public DESKeySpec(byte[] key)
throws InvalidKeyException
DESKeySpec from the first 8 bytes of the
specified key data.key - the key data.InvalidKeyException - if the length of the specified key data is less than 8.public DESKeySpec(byte[] key,
int offset)
throws InvalidKeyException
DESKeySpec from the first 8 bytes of the
specified key data starting at offset.key - the key dataoffset - the offset to start at.InvalidKeyException - if the length of the specified key data starting at offset is
less than 8.public byte[] getKey()
public static boolean isParityAdjusted(byte[] key,
int offset)
throws InvalidKeyException
offset is
parity-adjusted.key - the key data.offset - the offset to start checking at.true if the specified key data is parity-adjusted,
false otherwise.InvalidKeyException - if the length of the key data starting at offset is less than
8, or the key is null.public static boolean isWeak(byte[] key,
int offset)
throws InvalidKeyException
offset is
weak or semi-weak.key - the key data.offset - the offset to start checking at.true if the specified key data is weak or semi-weak.InvalidKeyException - if the length of the key data starting at offset is less than
8, or it is null.