org.bouncycastle.asn1.ocsp.OCSPResponse Java Examples

The following examples show how to use org.bouncycastle.asn1.ocsp.OCSPResponse. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PAdESOCSPSource.java    From dss with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void collectOCSPArchivalValues(AttributeTable attributes) {
	final ASN1Encodable attValue = DSSASN1Utils.getAsn1Encodable(attributes, OID.adbe_revocationInfoArchival);
	if (attValue !=null) {	
		RevocationInfoArchival revocationArchival = PAdESUtils.getRevocationInfoArchivals(attValue);
		if (revocationArchival != null) {
			for (final OCSPResponse ocspResponse : revocationArchival.getOcspVals()) {
				final OCSPResp ocspResp = new OCSPResp(ocspResponse);
				try {
					BasicOCSPResp basicOCSPResponse = (BasicOCSPResp) ocspResp.getResponseObject();
					addBinary(OCSPResponseBinary.build(basicOCSPResponse), RevocationOrigin.ADBE_REVOCATION_INFO_ARCHIVAL);
				} catch (OCSPException e) {
					LOG.warn("Error while extracting OCSPResponse from Revocation Info Archivals (ADBE) : {}", e.getMessage());
				}					
			}
		}
	}
}
 
Example #2
Source File: RevocationInfoArchival.java    From dss with GNU Lesser General Public License v2.1 5 votes vote down vote up
private RevocationInfoArchival(ASN1Sequence seq)
{
    if (seq.size() > 3)
    {
        throw new IllegalArgumentException("Bad sequence size: "
            + seq.size());
    }
    Enumeration e = seq.getObjects();
    while (e.hasMoreElements())
    {
        ASN1TaggedObject o = (ASN1TaggedObject)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())
                {
                    OCSPResponse.getInstance(ocspValsEnum.nextElement());
                }
                this.ocspVals = ocspValsSeq;
                break;
            case 2:
                this.otherRevVals = OtherRevVals.getInstance(o.getObject());
                break;
            default:
                throw new IllegalArgumentException("invalid tag: "
                    + o.getTagNo());
        }
    }
}
 
Example #3
Source File: RevocationInfoArchival.java    From dss with GNU Lesser General Public License v2.1 5 votes vote down vote up
public RevocationInfoArchival(CertificateList[] crlVals, OCSPResponse[] ocspVals, OtherRevVals otherRevVals)
{
    if (null != crlVals)
    {
        this.crlVals = new DERSequence(crlVals);
    }
    if (null != ocspVals)
    {
        this.ocspVals = new DERSequence(ocspVals);
    }
    this.otherRevVals = otherRevVals;
}
 
Example #4
Source File: RevocationInfoArchival.java    From dss with GNU Lesser General Public License v2.1 5 votes vote down vote up
public OCSPResponse[] getOcspVals()
{
    if (null == this.ocspVals)
    {
        return new OCSPResponse[0];
    }
    OCSPResponse[] result = new OCSPResponse[this.ocspVals.size()];
    for (int idx = 0; idx < result.length; idx++)
    {
        result[idx] = OCSPResponse.getInstance(this.ocspVals
            .getObjectAt(idx));
    }
    return result;
}
 
Example #5
Source File: DSSRevocationUtils.java    From dss with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Convert a BasicOCSPResp in OCSPResp (connection status is set to
 * SUCCESSFUL).
 *
 * @param basicOCSPRespBinary
 *            the binary of BasicOCSPResp
 * @return an instance of OCSPResp
 */
public static OCSPResp fromBasicToResp(final byte[] basicOCSPRespBinary) {
	final OCSPResponseStatus responseStatus = new OCSPResponseStatus(OCSPResponseStatus.SUCCESSFUL);
	final DEROctetString derBasicOCSPResp = new DEROctetString(basicOCSPRespBinary);
	final ResponseBytes responseBytes = new ResponseBytes(OCSPObjectIdentifiers.id_pkix_ocsp_basic, derBasicOCSPResp);
	final OCSPResponse ocspResponse = new OCSPResponse(responseStatus, responseBytes);
	// !!! todo to be checked: System.out.println("===> RECREATED: " +
	// ocspResp.hashCode());
	return new OCSPResp(ocspResponse);
}