de.flexiprovider.core.kdf
Class PBKDF1

java.lang.Object
  |
  +--de.flexiprovider.api.KeyDerivation
        |
        +--de.flexiprovider.core.kdf.PBKDF1
Direct Known Subclasses:
PBKDF1.MD5, PBKDF1.SHA1

public abstract class PBKDF1
extends KeyDerivation

This class implements the PBKDF1 key derivation function as specified in PKCS #5 v2.0.

Author:
Martin Döring

Inner Class Summary
static class PBKDF1.MD5
           
static class PBKDF1.SHA1
           
 
Constructor Summary
protected PBKDF1(MessageDigest md)
          Constructor.
 
Method Summary
 byte[] deriveKey(int keySize)
          Start the derivation process and return the derived key.
 void init(byte[] secret, AlgorithmParameterSpec params)
          Initialize this KDF with a secret and parameters.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PBKDF1

protected PBKDF1(MessageDigest md)
Constructor. Set the message digest.
Parameters:
md - the message digest
Method Detail

init

public void init(byte[] secret,
                 AlgorithmParameterSpec params)
          throws InvalidKeyException,
                 InvalidAlgorithmParameterException
Initialize this KDF with a secret and parameters. The supported parameters type is PBEParameterSpec.
Overrides:
init in class KeyDerivation
Parameters:
secret - the secret from which to derive the key
params - the parameters
Throws:
InvalidKeyException - if the secret is null.
InvalidAlgorithmParameterException - if the parameters are not an instance of PBEParameterSpec.

deriveKey

public byte[] deriveKey(int keySize)
Start the derivation process and return the derived key. If supported by the concrete implementation, the derived key will be of the specified length.
Overrides:
deriveKey in class KeyDerivation
Parameters:
keySize - the desired length of the derived key
Returns:
the derived key with the specified length, or null if the key size is < 0.