Example usage for org.bouncycastle.asn1 ASN1InputStream ASN1InputStream

List of usage examples for org.bouncycastle.asn1 ASN1InputStream ASN1InputStream

Introduction

In this page you can find the example usage for org.bouncycastle.asn1 ASN1InputStream ASN1InputStream.

Prototype

public ASN1InputStream(InputStream input, int limit, boolean lazyEvaluate) 

Source Link

Document

Create an ASN1InputStream where no DER object will be longer than limit, and constructed objects such as sequences will be parsed lazily.

Usage

From source file:be.fedict.trust.service.bean.HarvesterMDB.java

License:Open Source License

/**
 * Added for as {@link X509CRL#getRevokedCertificates()} is memory intensive
 * because it is returning a complete set, for huge CRL's this can get kinda
 * out of hand. So we return an enumeration of the DER
 * {@link TBSCertList.CRLEntry} objects.
 * //from w  w w  . j av a2  s.  c o  m
 * @param crl
 *            the CRL
 * @return {@link Enumeration} of {@link TBSCertList.CRLEntry}'s.
 * @throws IOException
 *             something went wrong parsing.
 * @throws CRLException
 *             something went wrong parsing.
 */
@SuppressWarnings("unchecked")
private Enumeration<TBSCertList.CRLEntry> getRevokedCertificatesEnum(X509CRL crl)
        throws IOException, CRLException {
    byte[] certList = crl.getTBSCertList();
    ByteArrayInputStream bais = new ByteArrayInputStream(certList);
    ASN1InputStream aIn = new ASN1InputStream(bais, Integer.MAX_VALUE, true);
    ASN1Sequence seq = (ASN1Sequence) aIn.readObject();
    TBSCertList cl = TBSCertList.getInstance(seq);
    return cl.getRevokedCertificateEnumeration();
}