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ExternalResourcesOCSPSource(new ByteArrayInputStream(Utils.fromBase64(ocspResponse))); CertificateToken certUser = DSSUtils.loadCertificateFromBase64EncodedString(user); CertificateToken certCA = DSSUtils.loadCertificateFromBase64EncodedString(ca); List<RevocationToken<OCSP>> ocspTokens = ocspSource.getRevocationTokens(certUser, certCA); assertEquals(1, ocspTokens.size()); OCSPToken ocspToken = (OCSPToken) ocspTokens.get(0); assertEquals(SignatureAlgorithm.RSA_SSA_PSS_SHA256_MGF1, ocspToken.getSignatureAlgorithm()); assertEquals(SignatureValidity.VALID, ocspToken.getSignatureValidity()); assertTrue(ocspToken.isValid()); assertTrue(ocspToken.isCertHashPresent()); assertTrue(ocspToken.isCertHashMatch()); assertEquals(CertificateStatus.GOOD, ocspToken.getStatus()); assertNull(ocspToken.getReason()); assertNull(ocspToken.getRevocationDate()); }
@Override public List<RevocationToken<OCSP>> getRevocationTokens(CertificateToken certificate, CertificateToken issuer) { Objects.requireNonNull(certificate, "The certificate to be verified cannot be null"); Objects.requireNonNull(issuer, "The issuer of the certificate to be verified cannot be null"); List<RevocationToken<OCSP>> result = new ArrayList<>(); final Set<EncapsulatedRevocationTokenIdentifier> collectedBinaries = getAllRevocationBinaries(); LOG.trace("--> OfflineOCSPSource queried for {} contains: {} element(s).", certificate.getDSSIdAsString(), collectedBinaries.size()); for (EncapsulatedRevocationTokenIdentifier binary : collectedBinaries) { OCSPResponseBinary ocspBinary = (OCSPResponseBinary) binary; BasicOCSPResp basicOCSPResp = ocspBinary.getBasicOCSPResp(); SingleResp latestSingleResponse = DSSRevocationUtils.getLatestSingleResponse(basicOCSPResp, certificate, issuer); if (latestSingleResponse != null) { OCSPToken ocspToken = new OCSPToken(basicOCSPResp, latestSingleResponse, certificate, issuer); addRevocation(ocspToken, ocspBinary); result.add(ocspToken); } } LOG.trace("--> OfflineOCSPSource found result(s) : {}", result.size()); return result; }
OfflineOCSPSource extends OfflineRevocationSource<OCSP> { @Override public List<RevocationToken<OCSP>> getRevocationTokens(CertificateToken certificate, CertificateToken issuer) { Objects.requireNonNull(certificate, "The certificate to be verified cannot be null"); Objects.requireNonNull(issuer, "The issuer of the certificate to be verified cannot be null"); List<RevocationToken<OCSP>> result = new ArrayList<>(); final Set<EncapsulatedRevocationTokenIdentifier> collectedBinaries = getAllRevocationBinaries(); LOG.trace("--> OfflineOCSPSource queried for {} contains: {} element(s).", certificate.getDSSIdAsString(), collectedBinaries.size()); for (EncapsulatedRevocationTokenIdentifier binary : collectedBinaries) { OCSPResponseBinary ocspBinary = (OCSPResponseBinary) binary; BasicOCSPResp basicOCSPResp = ocspBinary.getBasicOCSPResp(); SingleResp latestSingleResponse = DSSRevocationUtils.getLatestSingleResponse(basicOCSPResp, certificate, issuer); if (latestSingleResponse != null) { OCSPToken ocspToken = new OCSPToken(basicOCSPResp, latestSingleResponse, certificate, issuer); addRevocation(ocspToken, ocspBinary); result.add(ocspToken); } } LOG.trace("--> OfflineOCSPSource found result(s) : {}", result.size()); return result; } }
OfflineOCSPSource extends OfflineRevocationSource<OCSP> { @Override public List<RevocationToken<OCSP>> getRevocationTokens(CertificateToken certificate, CertificateToken issuer) { Objects.requireNonNull(certificate, "The certificate to be verified cannot be null"); Objects.requireNonNull(issuer, "The issuer of the certificate to be verified cannot be null"); List<RevocationToken<OCSP>> result = new ArrayList<>(); final Set<EncapsulatedRevocationTokenIdentifier> collectedBinaries = getAllRevocationBinaries(); LOG.trace("--> OfflineOCSPSource queried for {} contains: {} element(s).", certificate.getDSSIdAsString(), collectedBinaries.size()); for (EncapsulatedRevocationTokenIdentifier binary : collectedBinaries) { OCSPResponseBinary ocspBinary = (OCSPResponseBinary) binary; BasicOCSPResp basicOCSPResp = ocspBinary.getBasicOCSPResp(); SingleResp latestSingleResponse = DSSRevocationUtils.getLatestSingleResponse(basicOCSPResp, certificate, issuer); if (latestSingleResponse != null) { OCSPToken ocspToken = new OCSPToken(basicOCSPResp, latestSingleResponse, certificate, issuer); addRevocation(ocspToken, ocspBinary); result.add(ocspToken); } } LOG.trace("--> OfflineOCSPSource found result(s) : {}", result.size()); return result; } protected  OfflineOCSPSource(); }
OfflineOCSPSource extends OfflineRevocationSource<OCSP> { @Override public List<RevocationToken<OCSP>> getRevocationTokens(CertificateToken certificate, CertificateToken issuer) { Objects.requireNonNull(certificate, "The certificate to be verified cannot be null"); Objects.requireNonNull(issuer, "The issuer of the certificate to be verified cannot be null"); List<RevocationToken<OCSP>> result = new ArrayList<>(); final Set<EncapsulatedRevocationTokenIdentifier> collectedBinaries = getAllRevocationBinaries(); LOG.trace("--> OfflineOCSPSource queried for {} contains: {} element(s).", certificate.getDSSIdAsString(), collectedBinaries.size()); for (EncapsulatedRevocationTokenIdentifier binary : collectedBinaries) { OCSPResponseBinary ocspBinary = (OCSPResponseBinary) binary; BasicOCSPResp basicOCSPResp = ocspBinary.getBasicOCSPResp(); SingleResp latestSingleResponse = DSSRevocationUtils.getLatestSingleResponse(basicOCSPResp, certificate, issuer); if (latestSingleResponse != null) { OCSPToken ocspToken = new OCSPToken(basicOCSPResp, latestSingleResponse, certificate, issuer); addRevocation(ocspToken, ocspBinary); result.add(ocspToken); } } LOG.trace("--> OfflineOCSPSource found result(s) : {}", result.size()); return result; } protected  OfflineOCSPSource(); @Override List<RevocationToken<OCSP>> getRevocationTokens(CertificateToken certificate, CertificateToken issuer); }
OfflineOCSPSource extends OfflineRevocationSource<OCSP> { @Override public List<RevocationToken<OCSP>> getRevocationTokens(CertificateToken certificate, CertificateToken issuer) { Objects.requireNonNull(certificate, "The certificate to be verified cannot be null"); Objects.requireNonNull(issuer, "The issuer of the certificate to be verified cannot be null"); List<RevocationToken<OCSP>> result = new ArrayList<>(); final Set<EncapsulatedRevocationTokenIdentifier> collectedBinaries = getAllRevocationBinaries(); LOG.trace("--> OfflineOCSPSource queried for {} contains: {} element(s).", certificate.getDSSIdAsString(), collectedBinaries.size()); for (EncapsulatedRevocationTokenIdentifier binary : collectedBinaries) { OCSPResponseBinary ocspBinary = (OCSPResponseBinary) binary; BasicOCSPResp basicOCSPResp = ocspBinary.getBasicOCSPResp(); SingleResp latestSingleResponse = DSSRevocationUtils.getLatestSingleResponse(basicOCSPResp, certificate, issuer); if (latestSingleResponse != null) { OCSPToken ocspToken = new OCSPToken(basicOCSPResp, latestSingleResponse, certificate, issuer); addRevocation(ocspToken, ocspBinary); result.add(ocspToken); } } LOG.trace("--> OfflineOCSPSource found result(s) : {}", result.size()); return result; } protected  OfflineOCSPSource(); @Override List<RevocationToken<OCSP>> getRevocationTokens(CertificateToken certificate, CertificateToken issuer);  }