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