Example usage for java.security.cert X509CRL getTBSCertList

List of usage examples for java.security.cert X509CRL getTBSCertList

Introduction

In this page you can find the example usage for java.security.cert X509CRL getTBSCertList.

Prototype

public abstract byte[] getTBSCertList() throws CRLException;

Source Link

Document

Gets the DER-encoded CRL information, the tbsCertList from this CRL.

Usage

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

/**
 * 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 a  va  2  s.  co 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();
}