iaik.pkcs.pkcs5
Class PBKDF2

java.lang.Object
  |
  +--javax.crypto.KeyGeneratorSpi
        |
        +--iaik.pkcs.pkcs5.PBKDF2

public class PBKDF2
extends KeyGeneratorSpi

This class implements the KeyGenerator Service Provider Interface (SPI) for the password-based-key-derivation-function-2 from the PKCS#5 v2.0 Password-Based Cryptography Standard. You can get this document from: RSA Laboratories .

Use this class as you can read here:

 KeyGenerator pKCS5_PBKDF2 = null;
 try {
   pKCS5_PBKDF2 = KeyGenerator.getInstance("PBKDF2", "IAIK");
 } catch (Exception e) {
    ....
 }
 iaik.security.spec.PBEKeyAndParameterSpec parameterSpec;
 parameterSpec = new PBEKeyAndParameterSpec(password, 
                                            salt, 
                                            iterationCount, 
                                            derivedKeyLength);
 try {
   pKCS5_PBKDF2.init(parameterSpec, null);
 } catch (InvalidAlgorithmParameterException e) {
    ...
 }
 SecretKey derivedKey;
 derivedKey = pKCS5_PBKDF2.generateKey();

 

Since:
JDK1.2
See Also:
KeyGenerator

Constructor Summary
PBKDF2()
          The default constructor
 
Method Summary
 SecretKey engineGenerateKey()
          Derives symmetric key.
 void engineInit(AlgorithmParameterSpec algorithmParameterSp, SecureRandom secureRandom)
          Initializes the password-based-key-derivation-function
 void engineInit(int int1, SecureRandom secureRandom)
          Don't use this method.
 void engineInit(SecureRandom secureRandom)
          Don't use this method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PBKDF2

public PBKDF2()
The default constructor
Method Detail

engineGenerateKey

public SecretKey engineGenerateKey()
Derives symmetric key.
Overrides:
engineGenerateKey in class KeyGeneratorSpi
Returns:
the derived key

engineInit

public void engineInit(int int1,
                       SecureRandom secureRandom)
Don't use this method. It is not implemented.
Overrides:
engineInit in class KeyGeneratorSpi
Tags copied from class: KeyGeneratorSpi
Parameters:
strength - the strength of the key to be created
random - the random seed

engineInit

public void engineInit(SecureRandom secureRandom)
Don't use this method. It is not implemented.
Overrides:
engineInit in class KeyGeneratorSpi
Tags copied from class: KeyGeneratorSpi
Parameters:
random - the random seed
See Also:
KeyGenerator.init(java.security.SecureRandom)

engineInit

public void engineInit(AlgorithmParameterSpec algorithmParameterSp,
                       SecureRandom secureRandom)
                throws InvalidAlgorithmParameterException
Initializes the password-based-key-derivation-function
Overrides:
engineInit in class KeyGeneratorSpi
Parameters:
algorithmParameterSp - must be an instance of PBEKeyAndParameterSpec
secureRandom - not needed, should be null