iaik.pkcs.pkcs12
Class IvGenerator

java.lang.Object
  |
  +--javax.crypto.KeyGeneratorSpi
        |
        +--iaik.pkcs.pkcs12.KeyMaterialGenerator
              |
              +--iaik.pkcs.pkcs12.IvGenerator

public class IvGenerator
extends iaik.pkcs.pkcs12.KeyMaterialGenerator

This class uses the KeyMaterialGenerator for deriving a PKCS#12 IV from a password, a salt and an iteration count.

Version:
File Revision 11
See Also:
KeyMaterialGenerator

Field Summary
protected  String hash_algorithm
           
protected  int ID
           
 
Constructor Summary
IvGenerator()
          Default Constructor.
 
Method Summary
protected  SecretKey engineGenerateKey()
          Generates the desired key material and returns it as a SecretKey.
protected  void engineInit(AlgorithmParameterSpec params, SecureRandom random)
          Inits this KeyMaterialGenerator.
protected  void engineInit(int keylen, SecureRandom random)
          Sets the lenght of the key to generate.
protected  void engineInit(SecureRandom random)
          Not implemented.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID

protected int ID

hash_algorithm

protected String hash_algorithm
Constructor Detail

IvGenerator

public IvGenerator()
Default Constructor. Initializes the KeyMaterialGenerator for generating an IV for a symmetric CBC cipher.
Method Detail

engineInit

protected void engineInit(AlgorithmParameterSpec params,
                          SecureRandom random)
                   throws InvalidAlgorithmParameterException
Inits this KeyMaterialGenerator.
Overrides:
engineInit in class KeyGeneratorSpi
Parameters:
params - the required parameters as PBEKeyAndParameterSpec
random - not needed by this key generator

engineInit

protected void engineInit(int keylen,
                          SecureRandom random)
Sets the lenght of the key to generate. This method overwrites the key length taken form the PBEKeyAndParameterSpec.
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

protected void engineInit(SecureRandom random)
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)

engineGenerateKey

protected SecretKey engineGenerateKey()
Generates the desired key material and returns it as a SecretKey. Note that this method also returns IVs as SecretKey objects since there is no method for returning an IvParameterSpec. The algorithm name of the returned key is set to "RAW" and may be later changed by the calling application, if required:
 String algorithm = ...;
 KeyGenerator keyGen = KeyGenerator.getInstance("PKCS#12", "IAIK");
 ...
 iaik.security.cipher.SecretKey secretKey = (iaik.security.cipher.SecretKey)keyGen.generateKey();
 secretKey.setAlgorithm(algorithm);
 
Overrides:
engineGenerateKey in class KeyGeneratorSpi
Following copied from class: javax.crypto.KeyGeneratorSpi
Returns:
the generated secret key
See Also:
KeyGenerator.generateKey()

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