Package org.bouncycastle.cert.ocsp

Examples of org.bouncycastle.cert.ocsp.OCSPResp


        PdfArray ocspArray = dictionary.getAsArray(PdfName.OCSPS);
        ArrayList<BasicOCSPResp> ocsps = new ArrayList<BasicOCSPResp>();
        if (ocspArray != null) {
            for (int i = 0; i < ocspArray.size(); i++) {
                PRStream stream = (PRStream) ocspArray.getAsStream(i);
                OCSPResp response = new OCSPResp(PdfReader.getStreamBytes(stream));
                BasicOCSPResp basicResponse = (BasicOCSPResp) response.getResponseObject();
                ocsps.add(basicResponse);
            }
        }
        PdfArray crlArray = dictionary.getAsArray(PdfName.CRLS);
        ArrayList<X509CRL> crls = new ArrayList<X509CRL>();
View Full Code Here


        if (con.getResponseCode() / 100 != 2) {
            throw new IOException(MessageLocalization.getComposedMessage("invalid.http.response.1", con.getResponseCode()));
        }
        //Get Response
        InputStream in = (InputStream) con.getContent();
        return new OCSPResp(RandomAccessFileOrArray.InputStreamToArray(in));
    }
View Full Code Here

        return new OCSPResp(RandomAccessFileOrArray.InputStreamToArray(in));
    }
   
    public BasicOCSPResp getBasicOCSPResp(X509Certificate checkCert, X509Certificate rootCert, String url) {
        try {
            OCSPResp ocspResponse = getOcspResponse(checkCert, rootCert, url);
            if (ocspResponse == null)
              return null;
            if (ocspResponse.getStatus() != 0)
                return null;
            return (BasicOCSPResp) ocspResponse.getResponseObject();
        }
        catch (Exception ex) {
            if (LOGGER.isLogging(Level.ERROR))
                LOGGER.error(ex.getMessage());
        }
View Full Code Here

    PdfArray ocsparray = dss.getAsArray(PdfName.OCSPS);
    if (ocsparray == null)
      return ocsps;
    for (int i = 0; i < ocsparray.size(); i++) {
      PRStream stream = (PRStream) ocsparray.getAsStream(i);
      OCSPResp ocspResponse = new OCSPResp(PdfReader.getStreamBytes(stream));
      if (ocspResponse.getStatus() == 0)
        try {
          ocsps.add((BasicOCSPResp) ocspResponse.getResponseObject());
        } catch (OCSPException e) {
          throw new GeneralSecurityException(e);
        }
    }
    return ocsps;
View Full Code Here

    PdfArray ocsparray = dss.getAsArray(PdfName.OCSPS);
    if (ocsparray == null)
      return ocsps;
    for (int i = 0; i < ocsparray.size(); i++) {
      PRStream stream = (PRStream) ocsparray.getAsStream(i);
      OCSPResp ocspResponse = new OCSPResp(PdfReader.getStreamBytes(stream));
      if (ocspResponse.getStatus() == 0)
        try {
          ocsps.add((BasicOCSPResp) ocspResponse.getResponseObject());
        } catch (OCSPException e) {
          throw new GeneralSecurityException(e);
        }
    }
    return ocsps;
View Full Code Here

        if (con.getResponseCode() / 100 != 2) {
            throw new IOException(MessageLocalization.getComposedMessage("invalid.http.response.1", con.getResponseCode()));
        }
        //Get Response
        InputStream in = (InputStream) con.getContent();
        return new OCSPResp(StreamUtil.inputStreamToArray(in));
    }
View Full Code Here

        return new OCSPResp(StreamUtil.inputStreamToArray(in));
    }
   
    public BasicOCSPResp getBasicOCSPResp(X509Certificate checkCert, X509Certificate rootCert, String url) {
        try {
            OCSPResp ocspResponse = getOcspResponse(checkCert, rootCert, url);
            if (ocspResponse == null)
              return null;
            if (ocspResponse.getStatus() != 0)
                return null;
            return (BasicOCSPResp) ocspResponse.getResponseObject();
        }
        catch (Exception ex) {
            if (LOGGER.isLogging(Level.ERROR))
                LOGGER.error(ex.getMessage());
        }
View Full Code Here

      if (url == null) {
        return new ValidationError[] { new ValidationError(OCSPCertificateValidator.VALIDATOR_NAME, "No url found for validation") };
      }

      OCSPReq req = this.buildRequest(x509Certificate, x509Issuer);
      OCSPResp resp = this.sendRequest(req, url);
      if (resp.getStatus() != OCSPResponseStatus.SUCCESSFUL) {
        return new ValidationError[] { new ValidationError(OCSPCertificateValidator.VALIDATOR_NAME, "Response invalid") };
      }

      Object responseObject = resp.getResponseObject();

      if (responseObject instanceof BasicOCSPResp) {
        BasicOCSPResp basicOCSPResp = (BasicOCSPResp) responseObject;
        SingleResp[] singleResps = basicOCSPResp.getResponses();
        List<ValidationError> errors = new ArrayList<ValidationError>();
View Full Code Here

    InputStream inputStream = connection.getInputStream();

    String encoding = connection.getContentEncoding();

    byte[] bytes = this.readBytes(inputStream, encoding);
    OCSPResp resp = new OCSPResp(bytes);
    return resp;
  }
View Full Code Here

            .setProvider("BC").build(ocspResponderPrivateKey);
        BasicOCSPResp basicOCSPResp = basicOCSPRespBuilder.build(contentSigner, chain, new Date(nonceTimeinMillis));

       
        OCSPRespBuilder ocspRespBuilder = new OCSPRespBuilder();
        OCSPResp ocspResp = ocspRespBuilder.build(OCSPRespBuilder.SUCCESSFUL, basicOCSPResp);

        return ocspResp;
    }
View Full Code Here

TOP

Related Classes of org.bouncycastle.cert.ocsp.OCSPResp

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.