@Test public void faultyResponseFromOCSPServer() throws Exception { X509Certificate subject = getDefaultClientCert(); GlobalConf.reload(getTestGlobalConf()); responseData = "abcdefgh".getBytes(); X509Certificate issuer = GlobalConf.getCaCert("EE", subject); thrown.expect(OCSPException.class); OcspClient.fetchResponse(RESPONDER_URI, subject, issuer, null, null, null); }
static OCSPResp fetchResponse(X509Certificate subject, X509Certificate issuer, PrivateKey signerKey, X509Certificate signer, String signAlgoId) throws Exception { List<String> responderURIs = GlobalConf.getOcspResponderAddresses(subject); log.trace("responder URIs: {}", responderURIs); if (responderURIs.isEmpty()) { throw new ConnectException("No OCSP responder URIs available"); } for (String responderURI : responderURIs) { try { log.trace("fetch response from: {}", responderURI); return fetchResponse(responderURI, subject, issuer, signerKey, signer, signAlgoId); } catch (Exception e) { log.error("Unable to fetch response from responder at {}", responderURI, e); } } throw new OCSPException("Unable to get valid OCSP response from any responders"); }
OcspClient { static OCSPResp fetchResponse(X509Certificate subject, X509Certificate issuer, PrivateKey signerKey, X509Certificate signer, String signAlgoId) throws Exception { List<String> responderURIs = GlobalConf.getOcspResponderAddresses(subject); log.trace("responder URIs: {}", responderURIs); if (responderURIs.isEmpty()) { throw new ConnectException("No OCSP responder URIs available"); } for (String responderURI : responderURIs) { try { log.trace("fetch response from: {}", responderURI); return fetchResponse(responderURI, subject, issuer, signerKey, signer, signAlgoId); } catch (Exception e) { log.error("Unable to fetch response from responder at {}", responderURI, e); } } throw new OCSPException("Unable to get valid OCSP response from any responders"); } }
OcspClient { static OCSPResp fetchResponse(X509Certificate subject, X509Certificate issuer, PrivateKey signerKey, X509Certificate signer, String signAlgoId) throws Exception { List<String> responderURIs = GlobalConf.getOcspResponderAddresses(subject); log.trace("responder URIs: {}", responderURIs); if (responderURIs.isEmpty()) { throw new ConnectException("No OCSP responder URIs available"); } for (String responderURI : responderURIs) { try { log.trace("fetch response from: {}", responderURI); return fetchResponse(responderURI, subject, issuer, signerKey, signer, signAlgoId); } catch (Exception e) { log.error("Unable to fetch response from responder at {}", responderURI, e); } } throw new OCSPException("Unable to get valid OCSP response from any responders"); } private  OcspClient(); }
OcspClient { static OCSPResp fetchResponse(X509Certificate subject, X509Certificate issuer, PrivateKey signerKey, X509Certificate signer, String signAlgoId) throws Exception { List<String> responderURIs = GlobalConf.getOcspResponderAddresses(subject); log.trace("responder URIs: {}", responderURIs); if (responderURIs.isEmpty()) { throw new ConnectException("No OCSP responder URIs available"); } for (String responderURI : responderURIs) { try { log.trace("fetch response from: {}", responderURI); return fetchResponse(responderURI, subject, issuer, signerKey, signer, signAlgoId); } catch (Exception e) { log.error("Unable to fetch response from responder at {}", responderURI, e); } } throw new OCSPException("Unable to get valid OCSP response from any responders"); } private  OcspClient();  }
OcspClient { static OCSPResp fetchResponse(X509Certificate subject, X509Certificate issuer, PrivateKey signerKey, X509Certificate signer, String signAlgoId) throws Exception { List<String> responderURIs = GlobalConf.getOcspResponderAddresses(subject); log.trace("responder URIs: {}", responderURIs); if (responderURIs.isEmpty()) { throw new ConnectException("No OCSP responder URIs available"); } for (String responderURI : responderURIs) { try { log.trace("fetch response from: {}", responderURI); return fetchResponse(responderURI, subject, issuer, signerKey, signer, signAlgoId); } catch (Exception e) { log.error("Unable to fetch response from responder at {}", responderURI, e); } } throw new OCSPException("Unable to get valid OCSP response from any responders"); } private  OcspClient();   }