CertificationRevocationListImpl implements CertificationRevocationList { public boolean isOnCRL(X509Certificate x509CertificateToCheck) { CertificationRevocationListImpl crlInt = CertificationRevocationListImpl.getInstance(); List<String> urls = CertificationRevocationListImpl.getCrlDistributionPoints(x509CertificateToCheck); X509CRL x509CRL; for ( String url : urls ) { x509CRL = crlInt.getX509CRL(url); if (x509CRL == null || x509CRL.isRevoked(x509CertificateToCheck)) { log.debug("Certificate {} has been revoked!", x509CertificateToCheck.getSubjectDN().getName()); return true; } } return false; } private  CertificationRevocationListImpl(Set<X509Certificate> masterList,
                                          X509Certificate cscaRootCertificate,
                                          CrlFetcher crlFetcher); static synchronized void initialize(Set<X509Certificate> masterList); static synchronized CertificationRevocationListImpl getInstance(); static List<String> getCrlDistributionPoints(X509Certificate certificate); void renewCrls(); @Override X509CRL getX509CRL(String url); boolean isOnCRL(X509Certificate x509CertificateToCheck); static void reset();  }
@Test @DisplayName("contains an intermediate certificate") void isOnCrlTest() throws Exception { X509Certificate caCertificate = (X509Certificate)cf.generateCertificate(CertificationRevocationListImplTest.class.getResourceAsStream("/ca.crt")); X509Certificate iaCertificate = (X509Certificate)cf.generateCertificate(CertificationRevocationListImplTest.class.getResourceAsStream("/ia.crt")); Set<X509Certificate> masterList = new HashSet<>(); masterList.add(caCertificate); CertificationRevocationListImpl.initialize(masterList, caCertificate, getCrlFetcher(caCertificate)); CertificationRevocationListImpl certificationRevocationList = CertificationRevocationListImpl.getInstance(); Assert.assertTrue(certificationRevocationList.isOnCRL(iaCertificate)); }