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btKkfBUMiv88jwUFcHMC75EESf0OPeqBlubRkeSwTj60FqB8bBK2aIauGQMFSSLF2emfVvBkpw/qjR9/0bxd1R4FQ7rcl4CyrRGd/jfca6vTAi+rqFI5bOaxKT0MUHVtegJtshmj8zHlOBpm+BG2udKcpx79KIHVVKEb2AyFYdZefXV65FkRLri7l7ew08UYHV90Dq1hI/uAc8IHauSKkGE0arCRwNcLrsfVUPoh41HK3pqs7bTFJ2qmZu2mobAdBqDJBnfTxN+oHZ4whVNh5RAgMBAAGjgacwgaQwCQYDVR0TBAIwADAOBgNVHQ8BAf8EBAMCB4AwEwYDVR0lBAwwCgYIKwYBBQUHAwkwHwYDVR0jBBgwFoAUFxWFiQkvJIdvPx0b5PKWeYNIE84wMgYDVR0fBCswKTAnoCWgI4YhaHR0cDovL2NybC5sdXh0cnVzdC5sdS9MVEdSQ0EuY3JsMB0GA1UdDgQWBBRG9FLh93YFoTCS3jTUkgpprd/GtTANBgkqhkiG9w0BAQsFAAOCAQEANR/sq+gfaAtWqUXTbNFkisEan6abNbv9C8Pgt79rlDBkhAOOksyi/9tcfEZd5XqsMobIdaRZzAOlyN5SP5MgyZxSWmNArcqImofpg5RiIzbwewZzTIGaKh/xRrl8LkABKEhJ+tvTwrw0de2ad5nMUy2t2hCdO7Y5dMGzQRdJVnu10LcziEgZSW98C2SfdV3JxkW0rTsSi1vpRmSicpVxeEfbMvnlDKaMF17uM/eeTjqq7hsQOUbXPPbDOM8LcH0UmnkXkW6FVN4QDKjuKDlaL9bsRHJCuikebzwG+FOmKXhpHxMaUWLrRMvbeBIJvmd64LURIdhdjOt+Iho1lI4Oaw=="; ExternalResourcesOCSPSource ocspSource = new ExternalResourcesOCSPSource(new ByteArrayInputStream(Utils.fromBase64(ocspResponse))); CertificateToken userUniversign = DSSUtils.loadCertificateFromBase64EncodedString( "MIIGEzCCBPugAwIBAgIDC0wwMA0GCSqGSIb3DQEBCwUAMEwxCzAJBgNVBAYTAkxVMRYwFAYDVQQKEw1MdX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Vp/6BRb70Zd35O1Zic95ZUNCxDDVkaDbuN9tjGIBKhnq/ExtpheEdZJPjppVXpsBrCUUpJ0A9oSSFOQewwKSMD/vJKF32M9A2TlRd62XdHeNJrahdU/tO55f9tz3ekl/aKoS2khJxMfBvdvlw2Yc2g02g5rYsBxrSphph6IjqIkALM95jbm9T2Xo2CSROTAtprdhKw=="); List<RevocationToken<OCSP>> ocspTokens = ocspSource.getRevocationTokens(userUniversign, caUniversign); assertEquals(1, ocspTokens.size()); OCSPToken ocspToken = (OCSPToken) ocspTokens.get(0); assertNotNull(ocspToken); assertNull(ocspToken.getArchiveCutOff()); assertNotNull(ocspToken.getThisUpdate()); assertNotNull(ocspToken.getProductionDate()); assertNotNull(ocspToken.getBasicOCSPResp()); assertNull(ocspToken.getExpiredCertsOnCRL()); assertFalse(ocspToken.isCertHashPresent()); assertNull(ocspToken.getReason()); assertNull(ocspToken.getRevocationDate()); assertEquals(CertificateStatus.UNKNOWN, ocspToken.getStatus()); }
@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);  }