Example usage for java.security.cert X509CRL toString

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

Introduction

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

Prototype

public abstract String toString();

Source Link

Document

Returns a string representation of this CRL.

Usage

From source file:org.jasig.cas.adaptors.x509.authentication.handler.support.ThresholdExpiredCRLRevocationPolicy.java

/**
 * The CRL next update time is compared against the current time with the threshold
 * applied and rejected if and only if the next update time is in the past.
 *
 * @param crl CRL instance to evaluate./*from   w ww  .  j  a v a2s  . c  o m*/
 *
 * @throws ExpiredCRLException On expired CRL data.
 *
 * @see org.jasig.cas.adaptors.x509.authentication.handler.support.RevocationPolicy#apply(java.lang.Object)
 */
public void apply(final X509CRL crl) throws GeneralSecurityException {
    final Calendar cutoff = Calendar.getInstance();
    if (CertUtils.isExpired(crl, cutoff.getTime())) {
        cutoff.add(Calendar.SECOND, -this.threshold);
        if (CertUtils.isExpired(crl, cutoff.getTime())) {
            throw new ExpiredCRLException(crl.toString(), cutoff.getTime(), this.threshold);
        }
        log.info(String.format("CRL expired on %s but is within threshold period, %s seconds.",
                crl.getNextUpdate(), this.threshold));
    }
}