String alias, Set validCerts)
{
Signature sig = null;
try
{
OID alg = signerInfo.getDigestEncryptionAlgorithmId();
if (alg.equals(DSA_ENCRYPTION_OID))
{
if (!signerInfo.getDigestAlgorithmId().equals(SHA1_OID))
return;
sig = Signature.getInstance("SHA1withDSA", provider);
}
else if (alg.equals(RSA_ENCRYPTION_OID))
{
OID hash = signerInfo.getDigestAlgorithmId();
if (hash.equals(MD2_OID))
sig = Signature.getInstance("md2WithRsaEncryption", provider);
else if (hash.equals(MD4_OID))
sig = Signature.getInstance("md4WithRsaEncryption", provider);
else if (hash.equals(MD5_OID))
sig = Signature.getInstance("md5WithRsaEncryption", provider);
else if (hash.equals(SHA1_OID))
sig = Signature.getInstance("sha1WithRsaEncryption", provider);
else
return;
}
else