Example usage for org.bouncycastle.cert X509CRLEntryHolder getSerialNumber

List of usage examples for org.bouncycastle.cert X509CRLEntryHolder getSerialNumber

Introduction

In this page you can find the example usage for org.bouncycastle.cert X509CRLEntryHolder getSerialNumber.

Prototype

public BigInteger getSerialNumber() 

Source Link

Document

Return the serial number of the certificate associated with this CRLEntry.

Usage

From source file:se.tillvaxtverket.tsltrust.webservice.daemon.ca.CertificationAuthority.java

License:Open Source License

public void logRevocation(List<DbCert> revCertList) {
    List<Long> crlList = new LinkedList<Long>();
    if (latestCrl != null) {
        X509CRLEntryHolder revokedCertificate = latestCrl.getRevokedCertificate(BigInteger.ZERO);
        latestCrl.getRevokedCertificates().iterator().forEachRemaining((crlEntryObj) -> {
            X509CRLEntryHolder crlEntry = (X509CRLEntryHolder) crlEntryObj;
            long revokedSerial = crlEntry.getSerialNumber().longValue();
            crlList.add(revokedSerial);/*from  w  w  w . j  a va  2s  .co m*/
        });
    }

    for (DbCert dbCert : revCertList) {
        if (!crlList.contains((long) dbCert.getSerial())) {
            //update log 
            DbCALog caLog = new DbCALog();
            caLog.setLogCode(REVOKE_EVENT);
            caLog.setEventString("Certificate revoked");
            caLog.setLogParameter(dbCert.getSerial() * 256 + CRLReason.privilegeWithdrawn);
            caLog.setLogTime(dbCert.getRevDate());
            CaSQLiteUtil.addCertLog(caLog, caDir);
        }
    }
}