{
case MD5:
generator = new PKCS5S1ParametersGenerator(new MD5Digest());
break;
case SHA1:
generator = new PKCS5S1ParametersGenerator(new SHA1Digest());
break;
default:
throw new IllegalStateException("PKCS5 scheme 1 only supports only MD5 and SHA1.");
}
}
else if (type == PKCS5S2)
{
generator = new PKCS5S2ParametersGenerator();
}
else if (type == OLD_PKCS12)
{
switch (hash)
{
case MD5:
generator = new OldPKCS12ParametersGenerator(new MD5Digest());
break;
case SHA1:
generator = new OldPKCS12ParametersGenerator(new SHA1Digest());
break;
case RIPEMD160:
generator = new OldPKCS12ParametersGenerator(new RIPEMD160Digest());
break;
default:
throw new IllegalStateException("unknown digest scheme for PBE encryption.");
}
}
else
{
switch (hash)
{
case MD5:
generator = new PKCS12ParametersGenerator(new MD5Digest());
break;
case SHA1:
generator = new PKCS12ParametersGenerator(new SHA1Digest());
break;
case RIPEMD160:
generator = new PKCS12ParametersGenerator(new RIPEMD160Digest());
break;
default: