de.flexiprovider.common.mode
Class ModeParameters

java.lang.Object
  |
  +--java.security.AlgorithmParametersSpi
        |
        +--de.flexiprovider.api.parameters.AlgorithmParameters
              |
              +--de.flexiprovider.common.mode.ModeParameters

public class ModeParameters
extends AlgorithmParameters

This class is used as an opaque representation of initialization vectors used as mode parameters. ASN.1/DER encoding and decoding are supported. Parameters are encoded as

   ModeParameters = OCTET STRING (SIZE 8) IV
 

Author:
Norbert Trummel, Sylvain Franke

Constructor Summary
ModeParameters()
           
 
Method Summary
protected  java.security.spec.AlgorithmParameterSpec engineGetParameterSpec(java.lang.Class paramSpec)
          JCA adapter for FlexiAPI method getParameterSpec(Class): return a (transparent) specification of this parameters object.
protected  void engineInit(java.security.spec.AlgorithmParameterSpec params)
          JCA adapter for FlexiAPI method init(AlgorithmParameterSpec): initialize this parameters object using the parameters specified in paramSpec.
 byte[] getEncoded()
          Encode the parameters according to the primary encoding format (ASN.1).
 byte[] getEncoded(java.lang.String format)
          Return the parameters encoded in the specified format.
 AlgorithmParameterSpec getParameterSpec(java.lang.Class paramSpec)
          Return a (transparent) specification of this parameters object.
 void init(AlgorithmParameterSpec paramSpec)
          Initialize this parameters object using the parameters specified in paramSpec.
 void init(byte[] encParams)
          Import the specified parameters and decodes them according to the primary decoding format for parameters.
 void init(byte[] params, java.lang.String format)
          Import the specified parameters and decodes them according to the specified decoding format.
 java.lang.String toString()
           
 
Methods inherited from class de.flexiprovider.api.parameters.AlgorithmParameters
engineGetEncoded, engineGetEncoded, engineInit, engineInit, engineToString
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ModeParameters

public ModeParameters()
Method Detail

engineInit

protected void engineInit(java.security.spec.AlgorithmParameterSpec params)
                   throws java.security.spec.InvalidParameterSpecException
JCA adapter for FlexiAPI method init(AlgorithmParameterSpec): initialize this parameters object using the parameters specified in paramSpec. This method overrides the corresponding method of AlgorithmParameters in order to provide support for IvParameterSpec.
Overrides:
engineInit in class AlgorithmParameters
Parameters:
params - the parameter specification
Throws:
java.security.spec.InvalidParameterSpecException - if paramSpec is inappropriate for initialization.

engineGetParameterSpec

protected java.security.spec.AlgorithmParameterSpec engineGetParameterSpec(java.lang.Class paramSpec)
                                                                    throws java.security.spec.InvalidParameterSpecException
JCA adapter for FlexiAPI method getParameterSpec(Class): return a (transparent) specification of this parameters object. This method overrides the corresponding method of AlgorithmParameters in order to provide support for IvParameterSpec.
Overrides:
engineGetParameterSpec in class AlgorithmParameters
Parameters:
paramSpec - the the specification class in which the parameters should be returned
Returns:
the parameter specification
Throws:
java.security.spec.InvalidParameterSpecException - if the requested parameter specification is inappropriate for this parameter object.

init

public final void init(AlgorithmParameterSpec paramSpec)
                throws InvalidParameterSpecException
Initialize this parameters object using the parameters specified in paramSpec.
Overrides:
init in class AlgorithmParameters
Parameters:
paramSpec - the parameter specification
Throws:
InvalidParameterSpecException - if the given parameter specification is inappropriate for the initialization of this parameter object.

init

public final void init(byte[] encParams)
                throws java.io.IOException
Import the specified parameters and decodes them according to the primary decoding format for parameters. The primary decoding format for parameters is ASN.1.
Overrides:
init in class AlgorithmParameters
Parameters:
encParams - the encoded parameters
Throws:
java.io.IOException - on decoding errors

init

public final void init(byte[] params,
                       java.lang.String format)
                throws java.io.IOException
Import the specified parameters and decodes them according to the specified decoding format. Only "ASN.1" is supported at the moment.
Overrides:
init in class AlgorithmParameters
Parameters:
params - the encoded parameters.
format - the name of the decoding format.
Throws:
java.io.IOException - if format is not equal to "ASN.1".

getEncoded

public final byte[] getEncoded()
Description copied from class: AlgorithmParameters
Encode the parameters according to the primary encoding format (ASN.1).
Overrides:
getEncoded in class AlgorithmParameters
Returns:
the ASN.1 encoded parameters

getEncoded

public final byte[] getEncoded(java.lang.String format)
                        throws java.io.IOException
Return the parameters encoded in the specified format. Only "ASN.1" is supported at the moment.
Overrides:
getEncoded in class AlgorithmParameters
Parameters:
format - the encoding format
Returns:
the encoded parameters
Throws:
java.io.IOException - if format is not equal to "ASN.1".

getParameterSpec

public final AlgorithmParameterSpec getParameterSpec(java.lang.Class paramSpec)
                                              throws InvalidParameterSpecException
Return a (transparent) specification of this parameters object. paramSpec identifies the specification class in which the parameters should be returned. Only ModeParameterSpec is supported.
Overrides:
getParameterSpec in class AlgorithmParameters
Parameters:
paramSpec - the specification class in which the parameters should be returned
Returns:
the parameter specification
Throws:
InvalidParameterSpecException - if the requested parameter specification is inappropriate for this parameters object.

toString

public final java.lang.String toString()
Overrides:
toString in class AlgorithmParameters
Returns:
a formatted string describing the parameters