public class Cast3ParameterSpec extends java.lang.Object implements java.security.spec.AlgorithmParameterSpec, ASN1Type
Cast3CBCParameter ::= SEQUENCE {
iv OCTET STRING OPTIONAL -- 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 |
|---|
Cast3ParameterSpec()
The default constructor.
|
Cast3ParameterSpec(ASN1Object obj)
Creates a new
Cast3ParameterSpec from an
ASN1Object. |
Cast3ParameterSpec(int keyLength)
Creates a new
Cast3ParameterSpec object with the specified
key length. |
Cast3ParameterSpec(int keyLength,
byte[] iv)
Creates a new
Cast3ParameterSpec object with the specified
components. |
Cast3ParameterSpec(int keyLength,
byte[] iv,
int offset)
Creates a new
Cast3ParameterSpec object with the specified
components. |
| Modifier and Type | Method and Description |
|---|---|
void |
decode(ASN1Object obj)
Decodes a
Cast3ParameterSpec 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 beginning at the specified offset.
|
void |
setKeyLength(int keyLength)
Sets the length (size) of the key.
|
ASN1Object |
toASN1Object()
Encodes this
Cast3ParameterSpec object as an
ASN1Object. |
java.lang.String |
toString()
Creates a text representation of the ASN.1 structure of this
Cast3ParameterSpec object. |
public Cast3ParameterSpec()
Cast3ParameterSpec
object with a default key length of 64.public Cast3ParameterSpec(int keyLength)
Cast3ParameterSpec object with the specified
key length.keyLength - the key length in bitspublic Cast3ParameterSpec(int keyLength,
byte[] iv)
Cast3ParameterSpec 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 Cast3ParameterSpec(int keyLength,
byte[] iv,
int offset)
Cast3ParameterSpec 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 vectoroffset - 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 Cast3ParameterSpec(ASN1Object obj) throws CodingException
Cast3ParameterSpec from an
ASN1Object. The ASN1Object must be a
Cast3ParameterSpec structure.obj - the ASN.1 representation of a Cast3ParameterSpec 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 vectoroffset - 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
Cast3ParameterSpec from an
ASN1Object. The ASN1Object must be a
Cast3ParameterSpec structure.decode in interface ASN1Typeobj - an ASN.1 representation of a Cast3ParameterSpec structureCodingException - thrown if an errors occurs while decoding the ANS1Objectpublic ASN1Object toASN1Object()
Cast3ParameterSpec object as an
ASN1Object.toASN1Object in interface ASN1Typepublic java.lang.String toString()
Cast3ParameterSpec object.toString in class java.lang.Object