Example usage for org.bouncycastle.asn1.x509 TBSCertList getRevokedCertificateEnumeration

List of usage examples for org.bouncycastle.asn1.x509 TBSCertList getRevokedCertificateEnumeration

Introduction

In this page you can find the example usage for org.bouncycastle.asn1.x509 TBSCertList getRevokedCertificateEnumeration.

Prototype

public Enumeration getRevokedCertificateEnumeration() 

Source Link

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  . ja v  a  2 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();
}