OnlineOCSPSource implements OCSPSource, RevocationSourceAlternateUrlsSupport<OCSP>, OnlineRevocationSource<OCSP> { @Override public OCSPToken getRevocationToken(CertificateToken certificateToken, CertificateToken issuerCertificateToken) { return getRevocationToken(certificateToken, issuerCertificateToken, Collections.<String>emptyList()); } OnlineOCSPSource();  OnlineOCSPSource(final DataLoader dataLoader); @Override void setDataLoader(final DataLoader dataLoader); void setNonceSource(NonceSource nonceSource); void setCertIDDigestAlgorithm(DigestAlgorithm certIDDigestAlgorithm); @Override OCSPToken getRevocationToken(CertificateToken certificateToken, CertificateToken issuerCertificateToken); @Override OCSPToken getRevocationToken(CertificateToken certificateToken, CertificateToken issuerCertificateToken,
			List<String> alternativeUrls);  }
@Test public void testOCSPWithoutNonce() { OnlineOCSPSource ocspSource = new OnlineOCSPSource(); OCSPToken ocspToken = ocspSource.getRevocationToken(certificateToken, rootToken); assertNotNull(ocspToken); assertNotNull(ocspToken.getBasicOCSPResp()); }
@Test public void testOCSP() { OnlineOCSPSource ocspSource = new OnlineOCSPSource(); OCSPToken ocspToken = ocspSource.getRevocationToken(goodUser, goodCa); assertNotNull(ocspToken); assertNotNull(ocspToken.getBasicOCSPResp()); }
@Test public void testWithCustomDataLoaderConstructor() { OCSPDataLoader ocspDataLoader = new OCSPDataLoader(); OnlineOCSPSource ocspSource = new OnlineOCSPSource(ocspDataLoader); OCSPToken ocspToken = ocspSource.getRevocationToken(goodUser, goodCa); assertNotNull(ocspToken); assertNotNull(ocspToken.getBasicOCSPResp()); }
@Test public void testOCSPEd25519() { OnlineOCSPSource ocspSource = new OnlineOCSPSource(); OCSPToken ocspToken = ocspSource.getRevocationToken(ed25519goodUser, ed25519goodCa); assertNotNull(ocspToken); assertNotNull(ocspToken.getBasicOCSPResp()); assertEquals(SignatureAlgorithm.ED25519, ocspToken.getSignatureAlgorithm()); assertEquals(SignatureValidity.VALID, ocspToken.getSignatureValidity()); }
@Test public void testInjectExternalUrls() { OnlineOCSPSource ocspSource = new OnlineOCSPSource(); List<String> alternativeOCSPUrls = new ArrayList<>(); alternativeOCSPUrls.add("http: RevocationSource<OCSP> currentOCSPSource = new AlternateUrlsSourceAdapter<OCSP>(ocspSource, alternativeOCSPUrls); OCSPToken ocspToken = (OCSPToken) currentOCSPSource.getRevocationToken(certificateToken, rootToken); assertNotNull(ocspToken); }