/** * Adds all the service entries (current and history) of all the providers of the trusted list to * the list of CertificateSource * * @param trustStatusList */ private void loadAllCertificatesFromOneTSL(final TrustStatusList trustStatusList) { for (final TrustServiceProvider trustServiceProvider : trustStatusList.getTrustServicesProvider()) { for (final AbstractTrustService trustService : trustServiceProvider.getTrustServiceList()) { if (LOG.isTraceEnabled()) { LOG.trace("### " + trustService.getServiceName()); LOG.trace("------> " + trustService.getType()); LOG.trace("------> " + trustService.getStatus()); } for (final Object digitalIdentity : trustService.getDigitalIdentity()) { try { X509Certificate x509Certificate = null; if (digitalIdentity instanceof X509Certificate) { x509Certificate = (X509Certificate) digitalIdentity; } else if (digitalIdentity instanceof X500Principal) { final X500Principal x500Principal = (X500Principal) digitalIdentity; final List<CertificateToken> certificateTokens = certPool.get(x500Principal); if (certificateTokens.size() > 0) { x509Certificate = certificateTokens.get(0).getCertificate(); } else { LOG.warn( "There is currently no certificate with the given X500Principal: '{}' within the certificate pool!", x500Principal); } } if (x509Certificate != null) { addCertificate( x509Certificate, trustService, trustServiceProvider, trustStatusList.isWellSigned()); } } catch (DSSException e) { // There is a problem when loading the certificate, we continue with the next one. LOG.warn(e.getLocalizedMessage()); } } } } }