public DESKeySpec(byte[] key,
int offset) throws InvalidKeyException {
if (key.length - offset < DES_KEY_LEN) {
throw new InvalidKeyException("Wrong key size");
}
this.key = new byte[DES_KEY_LEN];
System.arraycopy(key, offset, this.key, 0, DES_KEY_LEN);
}
Parameters:
key - the buffer with the DES key material. The first 8 bytes
of the buffer beginning at offset inclusive are copied
to protect against subsequent modification.
offset - the offset in key, where the DES key
material starts.
Throws:
NullPointerException - if the given key material is
null
InvalidKeyException - if the given key material, starting at
offset inclusive, is shorter than 8 bytes.
- exception:
NullPointerException - if the given key material is
null
- exception:
InvalidKeyException - if the given key material, starting at
offset inclusive, is shorter than 8 bytes.
|