{
byte[] hash = new byte[digest.getDigestSize()];
digest.doFinal(hash, 0);
DigestInfo digInfo;
byte[] sig;
try
{
sig = cipher.processBlock(sigBytes, 0, sigBytes.length);
digInfo = derDecode(sig);
}
catch (Exception e)
{
return false;
}
if (!digInfo.getAlgorithmId().equals(algId))
{
return false;
}
byte[] sigHash = digInfo.getDigest();
if (hash.length != sigHash.length)
{
return false;
}