PBEParametersGenerator pbeGen = new PKCS12ParametersGenerator(new SHA1Digest());
byte[] passKey = PBEParametersGenerator.PKCS12PasswordToBytes(password);
pbeGen.init(passKey, salt, iterationCount);
hMac.init(pbeGen.generateDerivedMacParameters(hMac.getMacSize()));
for (int i = 0; i != passKey.length; i++)
{
passKey[i] = 0;
}