示例#1
0
 private static PKIMessage parseBytes(byte[] encoding) throws IOException {
   try {
     return PKIMessage.getInstance(ASN1Object.fromByteArray(encoding));
   } catch (ClassCastException e) {
     throw new CertIOException("malformed data: " + e.getMessage(), e);
   } catch (IllegalArgumentException e) {
     throw new CertIOException("malformed data: " + e.getMessage(), e);
   }
 }
示例#2
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();
  }