public class CAST128ParameterSpec
extends java.lang.Object
implements java.security.spec.AlgorithmParameterSpec
This class represents parameters for the CAST128 algorithm as specified by RFC 2144:
Parameters ::= SEQUENCE { iv OCTET STRING DEFAULT 0, -- Initialization vector keyLength INTEGER -- Key length, in bits }If no initialization vector is included it defaults to an IV of all zeros.
Constructor and Description |
---|
CAST128ParameterSpec(int keyLength)
Creates a CAST128ParametersSpec from the given keyLength value.
|
CAST128ParameterSpec(int keyLength,
byte[] initVector)
Creates a CAST128ParametersSpec by using the first 8 bytes of the supplied byte array
as initialization vector (IV).
|
CAST128ParameterSpec(int keyLength,
byte[] initVector,
int offset)
Creates a CAST128ParametersSpec by using 8 bytes of the supplied
byte array as IV, beginning at the given offset.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
getIV()
Returns a copy of the initialization vector (IV) as byte array representation.
|
int |
getKeyLength()
Return the key length.
|
public CAST128ParameterSpec(int keyLength)
keyLength
- the key lengthpublic CAST128ParameterSpec(int keyLength, byte[] initVector)
keyLength
- the key lengthinitVector
- the byte array holding the IVpublic CAST128ParameterSpec(int keyLength, byte[] initVector, int offset)
keyLength
- the key lengthinitVector
- the byte array holding the IVoffset
- the offset indicating the start position within the input IV byte arraypublic int getKeyLength()
public byte[] getIV()
If no initialization vector has been set, a default iv off all zeros is returned as required by RFC 2144.