Java Code Examples for java.security.cert.X509CRLEntry#getRevocationDate()

The following examples show how to use java.security.cert.X509CRLEntry#getRevocationDate() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RevokedCertsTableModel.java    From portecle with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Load the RevokedCertsTableModel with an array of X.509 CRL entries.
 *
 * @param revokedCerts The X.509 CRL entries
 */
public void load(X509CRLEntry[] revokedCerts)
{
	// Create one table row for each revoked certificate
	m_data = new Object[revokedCerts.length][getColumnCount()];

	// Iterate through the sorted revoked certificates populating the table model
	int iCnt = 0;
	for (X509CRLEntry x509CrlEntry : revokedCerts)
	{
		int col = 0;

		// Populate the serial number column
		m_data[iCnt][col++] = x509CrlEntry.getSerialNumber();

		// Populate the modified date column
		m_data[iCnt][col++] = x509CrlEntry.getRevocationDate();

		iCnt++;
	}

	fireTableDataChanged();
}
 
Example 2
Source File: RevokedCertificateException.java    From cas4.0.x-server-wechat with Apache License 2.0 5 votes vote down vote up
public RevokedCertificateException(final X509CRLEntry entry) {
    this.revocationDate = entry.getRevocationDate();
    this.serial = entry.getSerialNumber();
    if (entry.hasExtensions()) {
        try {
            final int code = Integer.parseInt(
                    new String(entry.getExtensionValue(CRL_REASON_OID), "ASCII"));
            if (code < Reason.values().length) {
                this.reason = Reason.fromCode(code);
            }
        } catch (final Exception e) {
            logger.trace("An exception occurred when resolving extension value: {}", e.getMessage());
        }
    }
}
 
Example 3
Source File: CRLToken.java    From dss with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * @param certificateToken
 *            the {@code CertificateToken} which is managed by this CRL.
 */
private void setRevocationStatus(final CertificateToken certificateToken) {
	final X500Principal issuerToken = certificateToken.getIssuerX500Principal();
	CertificateToken crlSigner = crlValidity.getIssuerToken();
	X500Principal crlSignerSubject = null;
	if (crlSigner != null) {
		crlSignerSubject = crlSigner.getSubject().getPrincipal();
	}

	if (!DSSASN1Utils.x500PrincipalAreEquals(issuerToken, crlSignerSubject)) {
		if (!crlValidity.isSignatureIntact()) {
			throw new DSSException(crlValidity.getSignatureInvalidityReason());
		}
		throw new DSSException("The CRLToken is not signed by the same issuer as the CertificateToken to be verified!");
	}

	final BigInteger serialNumber = certificateToken.getSerialNumber();
	X509CRLEntry crlEntry = CRLUtils.getRevocationInfo(crlValidity, serialNumber);

	if (crlEntry != null) {
		status = CertificateStatus.REVOKED;
		revocationDate = crlEntry.getRevocationDate();
		CRLReason revocationReason = crlEntry.getRevocationReason();
		if (revocationReason != null) {
			reason = RevocationReason.fromInt(revocationReason.ordinal());
		}
	} else {
		status = CertificateStatus.GOOD;
	}
}
 
Example 4
Source File: RevokedCertificateException.java    From springboot-shiro-cas-mybatis with MIT License 2 votes vote down vote up
/**
 * Instantiates a new revoked certificate exception.
 *
 * @param entry the entry
 */
public RevokedCertificateException(final X509CRLEntry entry) {
    this(entry.getRevocationDate(), entry.getSerialNumber(), getReasonFromX509Entry(entry));
}