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

public static CipherParameters makePBEMacParameters ( PBEKeySpec keySpec , int type , int hash , int keySize ) { PBEParametersGenerator generator = makePBEGenerator ( type , hash ) ; byte [ ] key ; CipherParameters param ; key = convertPassword ( type , keySpec ) ; generator . init ( key , keySpec . getSalt ( ) , keySpec . getIterationCount ( ) ) ; param = generator . generateDerivedMacParameters ( keySize ) ; for ( int i = 0 ; i != key . length ; i ++ ) { key [ i ] = 0 ; } return param ; }
generate a pbe based key suitable for a mac algorithm , the key size is chosen according the mac size , or the hashing algorithm , whichever is greater .
