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
Version:
File Revision 18
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. The algorithm name is set to "RAW" and may be later changed by the calling application, if required:
 String algorithm = ...;
 KeyGenerator pbkdf2 = KeyGenerator.getInstance("PBKDF2", "IAIK");
 ...
 iaik.security.cipher.SecretKey secretKey = (iaik.security.cipher.SecretKey)pbkdf2.generateKey();
 secretKey.setAlgorithm(algorithm);
 
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
Following copied from class: javax.crypto.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
Following copied from class: javax.crypto.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

This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note).

IAIK-JCE 3.1 with IAIK-JCE CC Core 3.1, (c) 1997-2004 IAIK