public class CAST128ParameterSpec extends java.lang.Object implements java.security.spec.AlgorithmParameterSpec, ASN1Type
CAST128Parameter ::= SEQUENCE {
iv OCTET STRING DEFAULT 0, -- Initialization vector
keyLength INTEGER -- Key length, in bits
}
As defined in the structure, if no IV is set, a default one of all zeros
is used.| Constructor and Description |
|---|
CAST128ParameterSpec()
The default constructor.
|
CAST128ParameterSpec(ASN1Object obj)
Creates a new
CAST128ParameterSpec from an
ASN1Object. |
CAST128ParameterSpec(int keyLength)
Creates a new
CAST128ParameterSpec object with the specified
component. |
CAST128ParameterSpec(int keyLength,
byte[] iv)
Creates a new
CAST128ParameterSpec object with the specified
components. |
CAST128ParameterSpec(int keyLength,
byte[] iv,
int offset)
Creates a new
CAST128ParameterSpec object with the specified
components. |
| Modifier and Type | Method and Description |
|---|---|
void |
decode(ASN1Object obj)
Decodes a
CAST128ParameterSpec from an
ASN1Object. |
byte[] |
getIV()
Returns a copy of the initialization vector(IV).
|
int |
getKeyLength()
Returns the length (size) of the key.
|
void |
setIV(byte[] iv,
int offset)
Sets the initialization vector(IV) by copying 8-bytes of data from the
byte array begenning at the specified offset.
|
void |
setKeyLength(int keyLength)
Sets the length (size) of the key.
|
ASN1Object |
toASN1Object()
Encodes this
CAST128ParameterSpec object as an
ASN1Object. |
java.lang.String |
toString()
Creates a text representation of the ASN.1 structure of this
CAST128ParameterSpec object. |
public CAST128ParameterSpec()
CAST128ParameterSpec
object with a default key length of 128.public CAST128ParameterSpec(int keyLength)
CAST128ParameterSpec object with the specified
component.keyLength - the key length in bitspublic CAST128ParameterSpec(int keyLength,
byte[] iv)
CAST128ParameterSpec object with the specified
components. The first 8 bytes of the supplied byte array are copied, and
used as the initialization vector (IV). If the supplied byte array is
null, then the default IV of all zeros is automatically set.keyLength - the key length in bitsiv - a byte array containing the initialization vectorjava.lang.ArrayIndexOutOfBoundsException - thrown if an 8-byte initialization vector could not be extracted
from the byte arraypublic CAST128ParameterSpec(int keyLength,
byte[] iv,
int offset)
CAST128ParameterSpec object with the specified
components. The 8-byte initialization vector(IV) is copied from the
supplied byte array starting at the indicated offset. If the supplied
byte array is null, then the default IV of all zeros is
automatically set.keyLength - the key length in bitsiv - a byte array containing the initialization vectoroffest - the offset in the byte array where the initialization vector beginsjava.lang.ArrayIndexOutOfBoundsException - thrown if an 8-byte initialization vector could not be extracted
from the byte arraypublic CAST128ParameterSpec(ASN1Object obj) throws CodingException
CAST128ParameterSpec from an
ASN1Object. The ASN1Object must be a
CAST128Parameter structure.obj - the ASN.1 representation of a CAST128Parameter structureCodingException - thrown if an errors occurs while decoding the ANS1Objectpublic byte[] getIV()
public int getKeyLength()
public void setIV(byte[] iv,
int offset)
null, then the default IV of all zeros is automatically
set.iv - a byte array containing the initialization vectoroffest - the offset in the byte array where the initialization vector beginsjava.lang.ArrayIndexOutOfBoundsException - thrown if an 8-byte initialization vector could not be extracted
from the byte arraypublic void setKeyLength(int keyLength)
keyLength - the key length in bitspublic void decode(ASN1Object obj) throws CodingException
CAST128ParameterSpec from an
ASN1Object. The ASN1Object must be a
CAST128Parameter structure.decode in interface ASN1Typeobj - an ASN.1 representation of a CAST128Parameter structureCodingException - thrown if an errors occurs while decoding the ANS1Objectpublic ASN1Object toASN1Object()
CAST128ParameterSpec object as an
ASN1Object.toASN1Object in interface ASN1Typepublic java.lang.String toString()
CAST128ParameterSpec object.toString in class java.lang.Object