use of org.bouncycastle.cert.ocsp.OCSPReq in project ddf by codice.
the class OcspCheckerTest method testGeneratingOcspRequest.
@Test
public void testGeneratingOcspRequest() throws Exception {
OcspChecker ocspChecker = new OcspChecker(factory, eventAdmin);
ocspChecker.setSecurityLogger(mock(SecurityLogger.class));
Certificate certificate = trustedCertBc;
OCSPReq ocspReq = ocspChecker.generateOcspRequest(certificate);
assertThat(ocspReq, is(notNullValue()));
assertThat(ocspReq.getRequestList()[0].getCertID().getSerialNumber(), equalTo(certificate.getSerialNumber().getValue()));
}
use of org.bouncycastle.cert.ocsp.OCSPReq in project ddf by codice.
the class OcspCheckerTest method testSendOcspRequestsRevokedStatus.
@Test
public void testSendOcspRequestsRevokedStatus() throws Exception {
revokedEndpoints.add(new URI("https://revokedurl:8993"));
brokenEndpoints.add(new URI(EMBEDDED_OCSP_SERVER_URL));
List<URI> ocspServerUrls = new ArrayList<>(revokedEndpoints);
OcspChecker ocspChecker = new OcspChecker(factory, eventAdmin);
ocspChecker.setSecurityLogger(mock(SecurityLogger.class));
ocspChecker.setOcspEnabled(true);
ocspChecker.setOcspServerUrls(ocspServerUrls.stream().map(URI::toString).collect(Collectors.toList()));
OCSPReq ocspReq = ocspChecker.generateOcspRequest(trustedCertBc);
Map<URI, CertificateStatus> ocspStatuses = ocspChecker.sendOcspRequests(trustedCertX509, ocspReq);
assertStatuses(ocspStatuses);
}
use of org.bouncycastle.cert.ocsp.OCSPReq in project ddf by codice.
the class OcspCheckerTest method testSendOcspRequestsGoodEmbeddedUrl.
@Test
public void testSendOcspRequestsGoodEmbeddedUrl() throws Exception {
unknownEndpoints.add(new URI("https://unknownurl:8993"));
unknownEndpoints.add(new URI("https://unknownurl2:8993"));
goodEndpoints.add(new URI(EMBEDDED_OCSP_SERVER_URL));
List<URI> ocspServerUrls = new ArrayList<>(unknownEndpoints);
OcspChecker ocspChecker = new OcspChecker(factory, eventAdmin);
ocspChecker.setSecurityLogger(mock(SecurityLogger.class));
ocspChecker.setOcspEnabled(true);
ocspChecker.setOcspServerUrls(ocspServerUrls.stream().map(URI::toString).collect(Collectors.toList()));
OCSPReq ocspReq = ocspChecker.generateOcspRequest(trustedCertBc);
Map<URI, CertificateStatus> ocspStatuses = ocspChecker.sendOcspRequests(trustedCertX509, ocspReq);
assertStatuses(ocspStatuses);
}
Aggregations