public static CipherParameters makePBEParameters(PBEKeySpec keySpec,int type,int hash,int keySize,int ivSize){
  PBEParametersGenerator generator=makePBEGenerator(type,hash);
  byte[] key;
  CipherParameters param;
  key=convertPassword(type,keySpec);
  generator.init(key,keySpec.getSalt(),keySpec.getIterationCount());
  if (ivSize != 0) {
    param=generator.generateDerivedParameters(keySize,ivSize);
  }
 else {
    param=generator.generateDerivedParameters(keySize);
  }
  for (int i=0; i != key.length; i++) {
    key[i]=0;
  }
  return param;
}

public static CipherParameters makePBEParameters ( PBEKeySpec keySpec , int type , int hash , int keySize , int ivSize ) { PBEParametersGenerator generator = makePBEGenerator ( type , hash ) ; byte [ ] key ; CipherParameters param ; key = convertPassword ( type , keySpec ) ; generator . init ( key , keySpec . getSalt ( ) , keySpec . getIterationCount ( ) ) ; if ( ivSize != 0 ) { param = generator . generateDerivedParameters ( keySize , ivSize ) ; } else { param = generator . generateDerivedParameters ( keySize ) ; } for ( int i = 0 ; i != key . length ; i ++ ) { key [ i ] = 0 ; } return param ; }
construct a key and iv ( if necessary ) suitable for use with a cipher .
