Constructs a secret key from the given byte array, using the first
len
bytes of key
, starting at
offset
inclusive.
The bytes that constitute the secret key are
those between key[offset]
and
key[offset+len-1]
inclusive.
This constructor does not check if the given bytes indeed specify a
secret key of the specified algorithm. For example, if the algorithm is
DES, this constructor does not check if key
is 8 bytes
long, and also does not check for weak or semi-weak keys.
In order for those checks to be performed, an algorithm-specific key
specification class
must be used.
keyData = new byte[len];
System.arraycopy(key, offset, keyData, 0, len);
this.algorithm = algorithm.toUpperCase();