示例#1
0
  /** verify the signature against the tbsResponseData object we contain. */
  public boolean isSignatureValid(ContentVerifierProvider verifierProvider) throws OCSPException {
    try {
      ContentVerifier verifier = verifierProvider.get(resp.getSignatureAlgorithm());
      OutputStream vOut = verifier.getOutputStream();

      vOut.write(resp.getTbsResponseData().getDEREncoded());
      vOut.close();

      return verifier.verify(this.getSignature());
    } catch (Exception e) {
      throw new OCSPException("exception processing sig: " + e, e);
    }
  }
示例#2
0
  public boolean equals(Object o) {
    if (o == this) {
      return true;
    }

    if (!(o instanceof BasicOCSPResp)) {
      return false;
    }

    BasicOCSPResp r = (BasicOCSPResp) o;

    return resp.equals(r.resp);
  }
示例#3
0
  public X509CertificateHolder[] getCerts() {
    //
    // load the certificates if we have any
    //
    if (resp.getCerts() != null) {
      ASN1Sequence s = resp.getCerts();

      if (s != null) {
        X509CertificateHolder[] certs = new X509CertificateHolder[s.size()];

        for (int i = 0; i != certs.length; i++) {
          certs[i] =
              new X509CertificateHolder(X509CertificateStructure.getInstance(s.getObjectAt(i)));
        }

        return certs;
      }

      return OCSPUtils.EMPTY_CERTS;
    } else {
      return OCSPUtils.EMPTY_CERTS;
    }
  }
示例#4
0
  public Object getResponseObject() throws OCSPException {
    ResponseBytes rb = this.resp.getResponseBytes();

    if (rb == null) {
      return null;
    }

    if (rb.getResponseType().equals(OCSPObjectIdentifiers.id_pkix_ocsp_basic)) {
      try {
        ASN1Object obj = ASN1Object.fromByteArray(rb.getResponse().getOctets());
        return new BasicOCSPResp(BasicOCSPResponse.getInstance(obj));
      } catch (Exception e) {
        throw new OCSPException("problem decoding object: " + e, e);
      }
    }

    return rb.getResponse();
  }
示例#5
0
 public ASN1ObjectIdentifier getSignatureAlgOID() {
   return resp.getSignatureAlgorithm().getAlgorithm();
 }
示例#6
0
 /**
  * Return the DER encoding of the tbsResponseData field.
  *
  * @return DER encoding of tbsResponseData
  */
 public byte[] getTBSResponseData() {
   return resp.getTbsResponseData().getDEREncoded();
 }
示例#7
0
 public BasicOCSPResp(BasicOCSPResponse resp) {
   this.resp = resp;
   this.data = resp.getTbsResponseData();
   this.extensions = resp.getTbsResponseData().getResponseExtensions();
 }
示例#8
0
 public int hashCode() {
   return resp.hashCode();
 }
示例#9
0
 /** return the ASN.1 encoded representation of this object. */
 public byte[] getEncoded() throws IOException {
   return resp.getEncoded();
 }
示例#10
0
 public byte[] getSignature() {
   return resp.getSignature().getBytes();
 }