Package org.ejbca.core.model.ca.caadmin.extendedcaservices

Examples of org.ejbca.core.model.ca.caadmin.extendedcaservices.OCSPCAServiceResponse


  throws CADoesntExistsException, ExtendedCAServiceRequestException, ExtendedCAServiceNotActiveException, IllegalExtendedCAServiceRequestException {

      // Call extended CA services to get our OCSP stuff
      OCSPCAServiceRequest ocspservicerequest = new OCSPCAServiceRequest(req, responseList, exts, m_sigAlg, m_includeChain);
      ocspservicerequest.setRespIdType(m_respIdType);
      OCSPCAServiceResponse caserviceresp = extendedService(this.data.m_adm, this.data.getCaid(cacert), ocspservicerequest);
      // Now we can use the returned OCSPServiceResponse to get private key and cetificate chain to sign the ocsp response
      if (m_log.isDebugEnabled()) {
          Collection coll = caserviceresp.getOCSPSigningCertificateChain();
          m_log.debug("Cert chain for OCSP signing is of size " + coll.size());             
      }
      return caserviceresp.getBasicOCSPResp();
  }
View Full Code Here


    }
    /* (non-Javadoc)
     * @see java.lang.Runnable#run()
     */
    public void run() {
        OCSPCAServiceResponse _result = null;
        ExtendedCAServiceRequestException _extendedCAServiceRequestException = null;
        IllegalExtendedCAServiceRequestException _illegalExtendedCAServiceRequestException = null;
        try {
            _result = this.se.sign(this.request);
        } catch (ExtendedCAServiceRequestException e) {
View Full Code Here

    // First check that the whole chain is included and the responderId is keyHash
    OCSPCAServiceRequest ocspServiceReq = new OCSPCAServiceRequest(req, responseList, null, "SHA1WithRSA;SHA1WithDSA;SHA1WithECDSA", true);
    ocspServiceReq.setRespIdType(OcspConfiguration.RESPONDERIDTYPE_KEYHASH);

    OCSPCAServiceResponse response = OCSPUtil.createOCSPCAServiceResponse(ocspServiceReq, privKey, providerName, certChain);
    BasicOCSPResp basicResp = response.getBasicOCSPResp();
    X509Certificate[] respCerts = basicResp.getCerts("BC");
    assertEquals(3, respCerts.length); // Certificate chain included
    RespID respId = basicResp.getResponderId();
    RespID testKeyHash = new RespID(racert.getPublicKey());
    RespID testName = new RespID(racert.getSubjectX500Principal());
    assertEquals(respId, testKeyHash);
    assertFalse(respId.equals(testName));

    // Second check that the whole chain is NOT included and the responderId is Name
    ocspServiceReq = new OCSPCAServiceRequest(req, responseList, null, "SHA1WithRSA;SHA1WithDSA;SHA1WithECDSA", false);
    ocspServiceReq.setRespIdType(OcspConfiguration.RESPONDERIDTYPE_NAME);
    response = OCSPUtil.createOCSPCAServiceResponse(ocspServiceReq, privKey, providerName, certChain);
    basicResp = response.getBasicOCSPResp();
    respCerts = basicResp.getCerts("BC");
    assertEquals(1, respCerts.length); // Certificate chain included
    respId = basicResp.getResponderId();
    assertFalse(respId.equals(testKeyHash));
    assertEquals(respId, testName);
View Full Code Here

            throw e;
        }
        final SignerThread runnable = new SignerThread(se,request);
        final Thread thread = new Thread(runnable);
        thread.start();
        final OCSPCAServiceResponse result = runnable.getSignResult();
        thread.interrupt();
        return result;
    }
View Full Code Here

        chain[0] = signerCert;
      }
      try {
        final int respIdType = ocspServiceReq.getRespIdType();
        final BasicOCSPResp ocspresp = OCSPUtil.generateBasicOCSPResp(ocspServiceReq, sigAlg, signerCert, privKey, providerName, chain, respIdType);
        final OCSPCAServiceResponse result = new OCSPCAServiceResponse(ocspresp, Arrays.asList(chain));
        isCertificateValid(signerCert);
        return result;
      } catch (OCSPException ocspe) {
        throw new ExtendedCAServiceRequestException(ocspe);
      } catch (NoSuchProviderException nspe) {
View Full Code Here

TOP

Related Classes of org.ejbca.core.model.ca.caadmin.extendedcaservices.OCSPCAServiceResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.