*/
public static Object[] verifyCertificates(Certificate certs[], KeyStore keystore, Collection crls, Calendar calendar) {
if (calendar == null)
calendar = new GregorianCalendar();
for (int k = 0; k < certs.length; ++k) {
X509Certificate cert = (X509Certificate)certs[k];
String err = verifyCertificate(cert, crls, calendar);
if (err != null)
return new Object[]{cert, err};
try {
for (Enumeration aliases = keystore.aliases(); aliases.hasMoreElements();) {
try {
String alias = (String)aliases.nextElement();
if (!keystore.isCertificateEntry(alias))
continue;
X509Certificate certStoreX509 = (X509Certificate)keystore.getCertificate(alias);
if (verifyCertificate(certStoreX509, crls, calendar) != null)
continue;
try {
cert.verify(certStoreX509.getPublicKey());
return null;
}
catch (Exception e) {
continue;
}
}
catch (Exception ex) {
}
}
}
catch (Exception e) {
}
int j;
for (j = 0; j < certs.length; ++j) {
if (j == k)
continue;
X509Certificate certNext = (X509Certificate)certs[j];
try {
cert.verify(certNext.getPublicKey());
break;
}
catch (Exception e) {
}
}