@Test public void npe() { OfflineCRLSource mocrls = new MockCRLSource(); assertThrows(NullPointerException.class, () -> mocrls.getRevocationTokens(null, null)); }
@Override public List<RevocationToken<CRL>> getRevocationTokens(final CertificateToken certificateToken, final CertificateToken issuerToken) { Objects.requireNonNull(certificateToken, "The certificate to be verified cannot be null"); Objects.requireNonNull(issuerToken, "The issuer of the certificate to be verified cannot be null"); List<RevocationToken<CRL>> result = new ArrayList<>(); final Set<EncapsulatedRevocationTokenIdentifier> collectedBinaries = getAllRevocationBinaries(); LOG.trace("--> OfflineCRLSource queried for {} contains: {} element(s).", certificateToken.getDSSIdAsString(), collectedBinaries.size()); for (EncapsulatedRevocationTokenIdentifier binary : collectedBinaries) { CRLBinary crlBinary = (CRLBinary) binary; try { CRLValidity crlValidity = CRLUtils.buildCRLValidity(crlBinary, issuerToken); if (crlValidity.isValid() && isInCertificateValidityRange(crlValidity, certificateToken)) { final CRLToken crlToken = new CRLToken(certificateToken, crlValidity); addRevocation(crlToken, crlBinary); result.add(crlToken); } } catch (Exception e) { LOG.warn("Unable to retrieve the CRLValidity for CRL with ID '{}' : {}", crlBinary.asXmlId(), e.getMessage()); } } LOG.trace("--> OfflineCRLSource found result(s) : {}", result.size()); return result; }
OfflineCRLSource extends OfflineRevocationSource<CRL> { @Override public List<RevocationToken<CRL>> getRevocationTokens(final CertificateToken certificateToken, final CertificateToken issuerToken) { Objects.requireNonNull(certificateToken, "The certificate to be verified cannot be null"); Objects.requireNonNull(issuerToken, "The issuer of the certificate to be verified cannot be null"); List<RevocationToken<CRL>> result = new ArrayList<>(); final Set<EncapsulatedRevocationTokenIdentifier> collectedBinaries = getAllRevocationBinaries(); LOG.trace("--> OfflineCRLSource queried for {} contains: {} element(s).", certificateToken.getDSSIdAsString(), collectedBinaries.size()); for (EncapsulatedRevocationTokenIdentifier binary : collectedBinaries) { CRLBinary crlBinary = (CRLBinary) binary; try { CRLValidity crlValidity = CRLUtils.buildCRLValidity(crlBinary, issuerToken); if (crlValidity.isValid() && isInCertificateValidityRange(crlValidity, certificateToken)) { final CRLToken crlToken = new CRLToken(certificateToken, crlValidity); addRevocation(crlToken, crlBinary); result.add(crlToken); } } catch (Exception e) { LOG.warn("Unable to retrieve the CRLValidity for CRL with ID '{}' : {}", crlBinary.asXmlId(), e.getMessage()); } } LOG.trace("--> OfflineCRLSource found result(s) : {}", result.size()); return result; } }
OfflineCRLSource extends OfflineRevocationSource<CRL> { @Override public List<RevocationToken<CRL>> getRevocationTokens(final CertificateToken certificateToken, final CertificateToken issuerToken) { Objects.requireNonNull(certificateToken, "The certificate to be verified cannot be null"); Objects.requireNonNull(issuerToken, "The issuer of the certificate to be verified cannot be null"); List<RevocationToken<CRL>> result = new ArrayList<>(); final Set<EncapsulatedRevocationTokenIdentifier> collectedBinaries = getAllRevocationBinaries(); LOG.trace("--> OfflineCRLSource queried for {} contains: {} element(s).", certificateToken.getDSSIdAsString(), collectedBinaries.size()); for (EncapsulatedRevocationTokenIdentifier binary : collectedBinaries) { CRLBinary crlBinary = (CRLBinary) binary; try { CRLValidity crlValidity = CRLUtils.buildCRLValidity(crlBinary, issuerToken); if (crlValidity.isValid() && isInCertificateValidityRange(crlValidity, certificateToken)) { final CRLToken crlToken = new CRLToken(certificateToken, crlValidity); addRevocation(crlToken, crlBinary); result.add(crlToken); } } catch (Exception e) { LOG.warn("Unable to retrieve the CRLValidity for CRL with ID '{}' : {}", crlBinary.asXmlId(), e.getMessage()); } } LOG.trace("--> OfflineCRLSource found result(s) : {}", result.size()); return result; } protected  OfflineCRLSource(); }
OfflineCRLSource extends OfflineRevocationSource<CRL> { @Override public List<RevocationToken<CRL>> getRevocationTokens(final CertificateToken certificateToken, final CertificateToken issuerToken) { Objects.requireNonNull(certificateToken, "The certificate to be verified cannot be null"); Objects.requireNonNull(issuerToken, "The issuer of the certificate to be verified cannot be null"); List<RevocationToken<CRL>> result = new ArrayList<>(); final Set<EncapsulatedRevocationTokenIdentifier> collectedBinaries = getAllRevocationBinaries(); LOG.trace("--> OfflineCRLSource queried for {} contains: {} element(s).", certificateToken.getDSSIdAsString(), collectedBinaries.size()); for (EncapsulatedRevocationTokenIdentifier binary : collectedBinaries) { CRLBinary crlBinary = (CRLBinary) binary; try { CRLValidity crlValidity = CRLUtils.buildCRLValidity(crlBinary, issuerToken); if (crlValidity.isValid() && isInCertificateValidityRange(crlValidity, certificateToken)) { final CRLToken crlToken = new CRLToken(certificateToken, crlValidity); addRevocation(crlToken, crlBinary); result.add(crlToken); } } catch (Exception e) { LOG.warn("Unable to retrieve the CRLValidity for CRL with ID '{}' : {}", crlBinary.asXmlId(), e.getMessage()); } } LOG.trace("--> OfflineCRLSource found result(s) : {}", result.size()); return result; } protected  OfflineCRLSource(); @Override List<RevocationToken<CRL>> getRevocationTokens(final CertificateToken certificateToken, final CertificateToken issuerToken); }
OfflineCRLSource extends OfflineRevocationSource<CRL> { @Override public List<RevocationToken<CRL>> getRevocationTokens(final CertificateToken certificateToken, final CertificateToken issuerToken) { Objects.requireNonNull(certificateToken, "The certificate to be verified cannot be null"); Objects.requireNonNull(issuerToken, "The issuer of the certificate to be verified cannot be null"); List<RevocationToken<CRL>> result = new ArrayList<>(); final Set<EncapsulatedRevocationTokenIdentifier> collectedBinaries = getAllRevocationBinaries(); LOG.trace("--> OfflineCRLSource queried for {} contains: {} element(s).", certificateToken.getDSSIdAsString(), collectedBinaries.size()); for (EncapsulatedRevocationTokenIdentifier binary : collectedBinaries) { CRLBinary crlBinary = (CRLBinary) binary; try { CRLValidity crlValidity = CRLUtils.buildCRLValidity(crlBinary, issuerToken); if (crlValidity.isValid() && isInCertificateValidityRange(crlValidity, certificateToken)) { final CRLToken crlToken = new CRLToken(certificateToken, crlValidity); addRevocation(crlToken, crlBinary); result.add(crlToken); } } catch (Exception e) { LOG.warn("Unable to retrieve the CRLValidity for CRL with ID '{}' : {}", crlBinary.asXmlId(), e.getMessage()); } } LOG.trace("--> OfflineCRLSource found result(s) : {}", result.size()); return result; } protected  OfflineCRLSource(); @Override List<RevocationToken<CRL>> getRevocationTokens(final CertificateToken certificateToken, final CertificateToken issuerToken);  }