de.flexiprovider.api
Class KeyDerivation

java.lang.Object
  |
  +--de.flexiprovider.api.KeyDerivation
Direct Known Subclasses:
KDF1, KDF2, PBKDF1, PBKDF1_PKCS12, PBKDF2, X963

public abstract class KeyDerivation
extends java.lang.Object

This class defines a key derivation function. All the abstract methods in this class must be implemented by each cryptographic service provider who wishes to supply the implementation of a particular Key Derivation algorithm. A key derivation function is used to generate a longer or shorter secret key, with a second secret shared by both parties. The derived secret key may be used by other schemes which use different key length, to the normal secret keys.

Author:
Jochen Hechler, Marcus Stögbauer, Martin Döring

Constructor Summary
KeyDerivation()
           
 
Method Summary
abstract  byte[] deriveKey(int keySize)
          Start the derivation process and return the derived key.
abstract  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

KeyDerivation

public KeyDerivation()
Method Detail

init

public abstract void init(byte[] secret,
                          AlgorithmParameterSpec params)
                   throws InvalidKeyException,
                          InvalidAlgorithmParameterException
Initialize this KDF with a secret and parameters.
Parameters:
secret - the secret from which to derive the key
params - the parameters
Throws:
InvalidKeyException - if the secret is invalid.
InvalidAlgorithmParameterException - if the parameters are invalid.

deriveKey

public abstract 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.
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.