if (x509Certificates == null || x509Certificates.length == 0) {
throw new IllegalArgumentException("Null or empty certificates list");
}
BasicX509Credential credential = new BasicX509Credential();
X509Certificate x509Certificate = x509Certificates[0];
credential.setEntityCertificate(x509Certificate);
credential.setEntityCertificateChain(Arrays.asList(x509Certificates));
credential.setUsageType(UsageType.UNSPECIFIED);
EntityIDCriteria entityIDCriteria = criteriaSet.get(EntityIDCriteria.class);
if (entityIDCriteria != null) {
credential.setEntityId(entityIDCriteria.getEntityID());
}
try {
log.debug("Checking server trust");
if (trustEngine.validate(credential, criteriaSet)) {