예제 #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();
 }