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 { ASN1Primitive obj = ASN1Primitive.fromByteArray(rb.getResponse().getOctets()); return new BasicOCSPResp(BasicOCSPResponse.getInstance(obj)); } catch (Exception e) { throw new OCSPException("problem decoding object: " + e, e); } } return rb.getResponse(); }
public BasicOCSPResp( BasicOCSPResponse resp) { this.resp = resp; this.data = resp.getTbsResponseData(); this.extensions = Extensions.getInstance(resp.getTbsResponseData().getResponseExtensions()); }
private RevocationValues(ASN1Sequence seq) { if (seq.size() > 3) { throw new IllegalArgumentException("Bad sequence size: " + seq.size()); } Enumeration e = seq.getObjects(); while (e.hasMoreElements()) { DERTaggedObject o = (DERTaggedObject)e.nextElement(); switch (o.getTagNo()) { case 0: ASN1Sequence crlValsSeq = (ASN1Sequence)o.getObject(); Enumeration crlValsEnum = crlValsSeq.getObjects(); while (crlValsEnum.hasMoreElements()) { CertificateList.getInstance(crlValsEnum.nextElement()); } this.crlVals = crlValsSeq; break; case 1: ASN1Sequence ocspValsSeq = (ASN1Sequence)o.getObject(); Enumeration ocspValsEnum = ocspValsSeq.getObjects(); while (ocspValsEnum.hasMoreElements()) { BasicOCSPResponse.getInstance(ocspValsEnum.nextElement()); } this.ocspVals = ocspValsSeq; break; case 2: this.otherRevVals = OtherRevVals.getInstance(o.getObject()); break; default: throw new IllegalArgumentException("invalid tag: " + o.getTagNo()); } } }
public RevocationValues(CertificateList[] crlVals, BasicOCSPResponse[] ocspVals, OtherRevVals otherRevVals) { if (null != crlVals) { this.crlVals = new DERSequence(crlVals); } if (null != ocspVals) { this.ocspVals = new DERSequence(ocspVals); } this.otherRevVals = otherRevVals; }
public BasicOCSPResponse[] getOcspVals() { if (null == this.ocspVals) { return new BasicOCSPResponse[0]; } BasicOCSPResponse[] result = new BasicOCSPResponse[this.ocspVals.size()]; for (int idx = 0; idx < result.length; idx++) { result[idx] = BasicOCSPResponse.getInstance(this.ocspVals .getObjectAt(idx)); } return result; }
public static byte[] getEncoded(BasicOCSPResp basicOCSPResp) { try { BasicOCSPResponse basicOCSPResponse = BasicOCSPResponse.getInstance(basicOCSPResp.getEncoded()); return getDEREncoded(basicOCSPResponse); } catch (IOException e) { throw new DSSException(e); } }
public BasicOCSPResp( BasicOCSPResponse resp) { this.resp = resp; this.data = resp.getTbsResponseData(); }
@Override public List<BasicOCSPResp> getContainedOCSPResponses() { final List<BasicOCSPResp> basicOCSPResps = new ArrayList<BasicOCSPResp>(); // Add OCSPs from SignedData addBasicOcspRespFrom_id_pkix_ocsp_basic(basicOCSPResps); addBasicOcspRespFrom_id_ri_ocsp_response(basicOCSPResps); // Adds OCSP responses in -XL id_aa_ets_revocationValues inside SignerInfo attribute if present if (signerInformation != null) { final AttributeTable attributes = signerInformation.getUnsignedAttributes(); if (attributes != null) { final Attribute attribute = attributes.get(PKCSObjectIdentifiers.id_aa_ets_revocationValues); /* ETSI TS 101 733 V2.2.1 (2013-04) page 43 6.3.4 revocation-values Attribute Definition This attribute is used to contain the revocation information required for the following forms of extended electronic signature: CAdES-X Long, ES X-Long Type 1, and CAdES-X Long Type 2, see clause B.1.1 for an illustration of this form of electronic signature. The revocation-values attribute is an unsigned attribute. Only a single instance of this attribute shall occur with an electronic signature. It holds the values of CRLs and OCSP referenced in the complete-revocation-references attribute. RevocationValues ::= SEQUENCE { crlVals [0] SEQUENCE OF CertificateList OPTIONAL, ocspVals [1] SEQUENCE OF BasicOCSPResponse OPTIONAL, otherRevVals [2] OtherRevVals OPTIONAL} */ if (attribute != null) { final ASN1Set attrValues = attribute.getAttrValues(); final ASN1Encodable attValue = attrValues.getObjectAt(0); final RevocationValues revocationValues = RevocationValues.getInstance(attValue); for (final BasicOCSPResponse basicOCSPResponse : revocationValues.getOcspVals()) { final BasicOCSPResp basicOCSPResp = new BasicOCSPResp(basicOCSPResponse); addBasicOcspResp(basicOCSPResps, basicOCSPResp); } /* TODO: should add also OtherRevVals, but: "The syntax and semantics of the other revocation values (OtherRevVals) are outside the scope of the present document. The definition of the syntax of the other form of revocation information is as identified by OtherRevRefType." */ } } } /* TODO (pades): Read revocation data from from unsigned attribute 1.2.840.113583.1.1.8 In the PKCS #7 object of a digital signature in a PDF file, identifies a signed attribute that "can include all the revocation information that is necessary to carry out revocation checks for the signer's certificate and its issuer certificates." Defined as adbe-revocationInfoArchival { adbe(1.2.840.113583) acrobat(1) security(1) 8 } in "PDF Reference, fifth edition: Adobe® Portable Document Format, Version 1.6" Adobe Systems Incorporated, 2004. http://partners.adobe.com/public/developer/en/pdf/PDFReference16.pdf page 698 RevocationInfoArchival ::= SEQUENCE { crl [0] EXPLICIT SEQUENCE of CRLs, OPTIONAL ocsp [1] EXPLICIT SEQUENCE of OCSP Responses, OPTIONAL otherRevInfo [2] EXPLICIT SEQUENCE of OtherRevInfo, OPTIONAL } OtherRevInfo ::= SEQUENCE { Type OBJECT IDENTIFIER Value OCTET STRING } */ return basicOCSPResps; }