public class Cast3Parameters
extends java.security.AlgorithmParametersSpi
The parameters specified for the CAST algorithm in RFC 2144 consist of an initialization vector (of eight octets) and the m_keyLength:
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.
Cast3Parameters can be generated provider independently by calling one of the
AlgorithmParameters.getInstance methods for the algorithm in
mind. Subsequently the new AlgorithmParameters object must be initialized with
a proper CAST3 parameter specification or a DER encoded byte array,
e.g.:
Cast3ParameterSpec castParamSpec = ...;
AlgorithmParameters params = AlgorithmParameters.getInstance("CAST3", "Entrust");
params.init(castParamsSpec);
For obtaining CAST parameters in transparent representation from an opaque
Cast3Parameters object, the getParameterSpec method can be used;
for obtaining the parameters as DER encoded ASN.1 object, use
getEncoded.
| Constructor and Description |
|---|
Cast3Parameters()
The default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected byte[] |
engineGetEncoded()
Returns the parameters as DER byte array.
|
protected byte[] |
engineGetEncoded(java.lang.String format)
Returns the parameters as a DER byte array.
|
protected <T extends java.security.spec.AlgorithmParameterSpec> |
engineGetParameterSpec(java.lang.Class<T> paramSpec)
Returns the algorithm parameters in transparent representation.
|
protected void |
engineInit(java.security.spec.AlgorithmParameterSpec paramSpec)
Initializes this Cast3Parameters with the parameter values from a
given Cast3ParameterSpec.
|
protected void |
engineInit(byte[] params)
Initializes this Cast3Parameters object from the given DER encoded byte array.
|
protected void |
engineInit(byte[] params,
java.lang.String format)
Initializes the parameters from a DER encoded byte array.
|
protected java.lang.String |
engineToString()
Returns a String representation of the parameters.
|
public Cast3Parameters()
Cast3Parameters object.
Applications must use one of the AlgorithmParameters.getInstance
factory methods for obtaining a Cast3Parameters instanceprotected byte[] engineGetEncoded()
throws java.io.IOException
engineGetEncoded in class java.security.AlgorithmParametersSpijava.io.IOException - if an encoding error occursprotected byte[] engineGetEncoded(java.lang.String format)
throws java.io.IOException
Format is ignored. Only DER encoding is supported at this time. This method
only calls engineGetEncoded(), regardless of what
is specified in the format string.
engineGetEncoded in class java.security.AlgorithmParametersSpiformat - the encoding format; ignoredjava.io.IOException - if an encoding error occursprotected <T extends java.security.spec.AlgorithmParameterSpec> T engineGetParameterSpec(java.lang.Class<T> paramSpec)
throws java.security.spec.InvalidParameterSpecException
For details on the parameter specifications supported refer to the class documentation of the instance.
engineGetParameterSpec in class java.security.AlgorithmParametersSpiparamSpec - the parameter specification class in which the algorithm
parameters should be returnedjava.security.spec.InvalidParameterSpecException - if the requested parameter specification is inappropriate for
this parameters objectprotected void engineInit(java.security.spec.AlgorithmParameterSpec paramSpec)
throws java.security.spec.InvalidParameterSpecException
engineInit in class java.security.AlgorithmParametersSpiparamSpec - the parameter specification, which has to be a Cast3ParameterSpecjava.security.spec.InvalidParameterSpecException - if the given parameter specification
is not a Cast3ParameterSpec or the included
parameters are invalidprotected void engineInit(byte[] params)
throws java.io.IOException
engineInit in class java.security.AlgorithmParametersSpiparams - the DER encoded byte arrayjava.io.IOException - if an error occurs when decoding the given byte array or
the derived parameter values are invalidprotected void engineInit(byte[] params,
java.lang.String format)
throws java.io.IOException
engineInit(params) for initializing this Cast3Parameters
object from the given DER encoded byte array, regardless of what is specified
in the format string.
engineInit in class java.security.AlgorithmParametersSpiparams - the DER encoded byte arrayformat - the encoding format; ignoredjava.io.IOException - if an error occurs when decoding the given byte arrayprotected java.lang.String engineToString()
engineToString in class java.security.AlgorithmParametersSpi