de.flexiprovider.common.mode
Class ModeParameterGenerator
java.lang.Object
|
+--java.security.AlgorithmParameterGeneratorSpi
|
+--de.flexiprovider.api.parameters.AlgorithmParameterGenerator
|
+--de.flexiprovider.common.mode.ModeParameterGenerator
- public class ModeParameterGenerator
- extends AlgorithmParameterGenerator
This class is used to generate initialization vectors (IVs) used by the modes
CBC, CFB, OFB, and CTR.
- Author:
- Martin Döring
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ModeParameterGenerator
public ModeParameterGenerator()
getAlgorithmParameters
protected AlgorithmParameters getAlgorithmParameters()
- Overrides:
getAlgorithmParameters in class AlgorithmParameterGenerator
- Returns:
- an instance of the
AlgorithmParameters class
corresponding to the generated parameters
init
public void init(AlgorithmParameterSpec genParams,
SecureRandom random)
throws InvalidAlgorithmParameterException
- Initialize the parameter generator with parameters and a source of
randomness. If the parameters are null, the
default parameters
are used.
- Overrides:
init in class AlgorithmParameterGenerator
- Parameters:
genParams - the parametersrandom - the source of randomness- Throws:
InvalidAlgorithmParameterException - if the parameters are not an instance of
ModeParamGenParameterSpec.
init
public void init(int ivLength,
SecureRandom random)
- Initialize the parameter generator with the desired length of the IV in
bytes and the source of randomness used to generate the IV.
- Overrides:
init in class AlgorithmParameterGenerator
- Parameters:
ivLength - the length of the IV in bytesrandom - the source of randomness
generateParameters
public AlgorithmParameterSpec generateParameters()
- Generate a new IV using the length and source of randomness specified
during initialization.
- Overrides:
generateParameters in class AlgorithmParameterGenerator
- Returns:
- the generated IV encapsulated in an instance of
ModeParameterSpec