public class PBEParameterGenerator
extends java.security.AlgorithmParameterGeneratorSpi
PKCS#5 describes a method for encrypting messages (octet strings) with secret keys derived from a password. For generating the key from the password, special parameters (salt an octet string and iteration count an integer) are required.
Applications shall use
for obtaining an AlgorithmParameterGenerator for generating PBE parameters in opaque representation. Once the generator has been created, it shall be properly initialized by one of the severalAlgorithmParameterGenerator.getInstance("PBE")
init
methods.
If none explicit initialization is done, per default the salt length is set to 8 bytes,
and the iteration count value is set to 2000. After initializing the generator
(or relying on default settings), the required parameters
actually are created by calling the generateParameters
method.PBEParameters
,
PBEGenParameterSpec
,
AlgorithmParameterGenerator
Constructor and Description |
---|
PBEParameterGenerator()
The default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected java.security.AlgorithmParameters |
engineGenerateParameters()
Actually generates the required PBE AlgorithmParameters.
|
protected void |
engineInit(java.security.spec.AlgorithmParameterSpec param,
java.security.SecureRandom random)
Initializes this generator with PBE-specific parameter generation values and
some random seed.
|
protected void |
engineInit(int saltLength,
java.security.SecureRandom random)
Initializes the parameter generator with given salt length and random seed.
|
public PBEParameterGenerator()
AlgorithmParameterGenerator.getInstance
factory
methods for obtaining an AlgorithmParamterGenerator for generating parameters
for password based encryption.protected void engineInit(int saltLength, java.security.SecureRandom random)
engineInit
in class java.security.AlgorithmParameterGeneratorSpi
saltLength
- the length of the salt in bytesrandom
- the random seed to be used by this generator.protected void engineInit(java.security.spec.AlgorithmParameterSpec param, java.security.SecureRandom random) throws java.security.InvalidAlgorithmParameterException
From the given parameter specification (which has to be of type
PBEGenParameterSpec
) salt length and iteration count
are obtained for generating the algorithm parameters.
Applications shall call init(param_spec, random)
for provider
independently accessing this method.
engineInit
in class java.security.AlgorithmParameterGeneratorSpi
param
- an instance of PBEGenParameterSpecrandom
- the random seed to be used by this generator.java.security.InvalidAlgorithmParameterException
- if param
is not an
instance of PBEGenParameterSpecprotected java.security.AlgorithmParameters engineGenerateParameters()
Applications shall call generatePrameters()
for provider
independently accessing this method.
engineGenerateParameters
in class java.security.AlgorithmParameterGeneratorSpi