public class CAST128WrapParameters
extends java.security.AlgorithmParametersSpi
The parameters specified for the CMS CAST key wrap algorithm in RFC 2984 consist of an INTEGER giving the keyLength:
cast5CMSkeywrapParameter ::= INTEGER -- key length in bits
CAST128WrapParameters 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 CAST128 Wrap parameter specification or a DER encoded byte array,
e.g.:
CAST128WrapParameterSpec castParamSpec = ...; AlgorithmParameters params = AlgorithmParameters.getInstance("CAST128WrapCAST128", "IAIK"); params.init(castParamsSpec);
For obtaining CAST parameters in transparent representation from an opaque
CAST128WrapParameters object, the getParameterSpec
method can be used;
for obtaining the parameters as DER encoded ASN.1 object, use
getEncoded
.
Constructor and Description |
---|
CAST128WrapParameters()
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 java.security.spec.AlgorithmParameterSpec |
engineGetParameterSpec(java.lang.Class paramSpec)
Returns the CAST parameters as transparent CAST parameter specification of the
given class type.
|
protected void |
engineInit(java.security.spec.AlgorithmParameterSpec paramSpec)
Initializes this CAST128WrapParameters with the parameter values from a
given CAST128WrapParameterSpec.
|
protected void |
engineInit(byte[] params)
Initializes this CAST128WrapParameters object from the given DER encoded byte array.
|
protected void |
engineInit(byte[] params,
java.lang.String format)
Inits the parameters from an DER encoded byte array.
|
protected java.lang.String |
engineToString()
Returns a String representation of the parameters.
|
public CAST128WrapParameters()
CAST128WrapParameters
object.
Applications shall use one of the AlgorithmParameters.getInstance
factory methods for obtaining CAST128WrapParameters.protected byte[] engineGetEncoded() throws java.io.IOException
engineGetEncoded
in class java.security.AlgorithmParametersSpi
java.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.AlgorithmParametersSpi
format
- the encoding format; ignoredjava.io.IOException
- if an encoding error occursprotected java.security.spec.AlgorithmParameterSpec engineGetParameterSpec(java.lang.Class paramSpec) throws java.security.spec.InvalidParameterSpecException
engineGetParameterSpec
in class java.security.AlgorithmParametersSpi
paramSpec
- the desired parameter specification class (CAST128WrapParameterSpec)java.security.spec.InvalidParameterSpecException
- if the parameters cannot be converted to
the desired parameter specificationprotected void engineInit(java.security.spec.AlgorithmParameterSpec paramSpec) throws java.security.spec.InvalidParameterSpecException
engineInit
in class java.security.AlgorithmParametersSpi
paramSpec
- the parameter specification, which has to be a CAST128WrapParameterSpecjava.security.spec.InvalidParameterSpecException
- if the given parameter specification
is not a CAST128WrapParameterSpec or the included
parameters are invalidprotected void engineInit(byte[] params) throws java.io.IOException
engineInit
in class java.security.AlgorithmParametersSpi
params
- 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 CAST128Parameters
object from the given DER encoded byte array, regardless of what is specified
in the format
string.
engineInit
in class java.security.AlgorithmParametersSpi
params
- 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