for (XMLObject xo : digests) {
if (!(xo instanceof X509Digest)) {
continue;
}
X509Digest digest = (X509Digest) xo;
if (!DatatypeHelper.isEmpty(digest.getValue())) {
xmlValue = Base64.decode(digest.getValue());
for (X509Certificate cert : certs) {
try {
certValue = X509Util.getX509Digest(cert, digest.getAlgorithm());
if (certValue != null && Arrays.equals(xmlValue, certValue)) {
return cert;
}
} catch (SecurityException e) {
// Ignore as no match.