static Collection getOthersFromStore(ASN1ObjectIdentifier otherRevocationInfoFormat, Store otherRevocationInfos) { List others = new ArrayList(); for (Iterator it = otherRevocationInfos.getMatches(null).iterator(); it.hasNext();) { ASN1Encodable info = (ASN1Encodable)it.next(); if (CMSObjectIdentifiers.id_ri_ocsp_response.equals(otherRevocationInfoFormat)) { OCSPResponse resp = OCSPResponse.getInstance(info); if (resp.getResponseStatus().getValue().intValue() != OCSPResponseStatus.SUCCESSFUL) { throw new IllegalArgumentException("cannot add unsuccessful OCSP response to CMS SignedData"); } } others.add(new DERTaggedObject(false, 1, new OtherRevocationInfoFormat(otherRevocationInfoFormat, info))); } return others; }
static Collection getOthersFromStore(ASN1ObjectIdentifier otherRevocationInfoFormat, Store otherRevocationInfos) { List others = new ArrayList(); for (Iterator it = otherRevocationInfos.getMatches(null).iterator(); it.hasNext();) { ASN1Encodable info = (ASN1Encodable)it.next(); OtherRevocationInfoFormat infoFormat = new OtherRevocationInfoFormat(otherRevocationInfoFormat, info); validateInfoFormat(infoFormat); others.add(new DERTaggedObject(false, 1, infoFormat)); } return others; }
Store getOtherRevocationInfo(ASN1ObjectIdentifier otherRevocationInfoFormat, ASN1Set crlSet) { if (crlSet != null) { List crlList = new ArrayList(crlSet.size()); for (Enumeration en = crlSet.getObjects(); en.hasMoreElements();) { ASN1Primitive obj = ((ASN1Encodable)en.nextElement()).toASN1Primitive(); if (obj instanceof ASN1TaggedObject) { ASN1TaggedObject tObj = ASN1TaggedObject.getInstance(obj); if (tObj.getTagNo() == 1) { OtherRevocationInfoFormat other = OtherRevocationInfoFormat.getInstance(tObj, false); if (otherRevocationInfoFormat.equals(other.getInfoFormat())) { crlList.add(other.getInfo()); } } } } return new CollectionStore(crlList); } return new CollectionStore(new ArrayList()); }
/** * Add a single instance of otherRevocationData to the CRL set to be included with the generated SignedData message. * * @param otherRevocationInfoFormat the OID specifying the format of the otherRevocationInfo data. * @param otherRevocationInfo the otherRevocationInfo ASN.1 structure. */ public void addOtherRevocationInfo( ASN1ObjectIdentifier otherRevocationInfoFormat, ASN1Encodable otherRevocationInfo) { crls.add(new DERTaggedObject(false, 1, new OtherRevocationInfoFormat(otherRevocationInfoFormat, otherRevocationInfo))); }
static List getCRLsFromStore(Store crlStore) throws CMSException { List crls = new ArrayList(); try { for (Iterator it = crlStore.getMatches(null).iterator(); it.hasNext();) { Object rev = it.next(); if (rev instanceof X509CRLHolder) { X509CRLHolder c = (X509CRLHolder)rev; crls.add(c.toASN1Structure()); } else if (rev instanceof OtherRevocationInfoFormat) { OtherRevocationInfoFormat infoFormat = OtherRevocationInfoFormat.getInstance(rev); validateInfoFormat(infoFormat); crls.add(new DERTaggedObject(false, 1, infoFormat)); } else if (rev instanceof ASN1TaggedObject) { crls.add(rev); } } return crls; } catch (ClassCastException e) { throw new CMSException("error processing certs", e); } }
private static void validateInfoFormat(OtherRevocationInfoFormat infoFormat) { if (CMSObjectIdentifiers.id_ri_ocsp_response.equals(infoFormat.getInfoFormat())) { OCSPResponse resp = OCSPResponse.getInstance(infoFormat.getInfo()); if (resp.getResponseStatus().getValue().intValue() != OCSPResponseStatus.SUCCESSFUL) { throw new IllegalArgumentException("cannot add unsuccessful OCSP response to CMS SignedData"); } } }