question: public static CipherParameters makePBEMacParameters ( BCPBEKey pbeKey , AlgorithmParameterSpec spec ) { if ( ( spec == null ) || ! ( spec instanceof PBEParameterSpec ) ) { throw new IllegalArgumentException ( "Need a PBEParameter spec with a PBE key." ) ; } PBEParameterSpec pbeParam = ( PBEParameterSpec ) spec ; PBEParametersGenerator generator = makePBEGenerator ( pbeKey . getType ( ) , pbeKey . getDigest ( ) ) ; byte [ ] key = pbeKey . getEncoded ( ) ; CipherParameters param ; if ( pbeKey . shouldTryWrongPKCS12 ( ) ) { key = new byte [ 2 ] ; } generator . init ( key , pbeParam . getSalt ( ) , pbeParam . getIterationCount ( ) ) ; param = generator . generateDerivedMacParameters ( pbeKey . getKeySize ( ) ) ; for ( int i = 0 ; i != key . length ; i ++ ) { key [ i ] = 0 ; } return param ; }
target:  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.