Search in sources :

Example 1 with ReasonFlag

use of de.carne.certmgr.certs.x509.ReasonFlag in project certmgr by hdecarne.

the class CRLOptionsController method initEntries.

private void initEntries() throws IOException {
    ObservableList<CRLEntryModel> entryItems = this.ctlEntryOptions.getItems();
    for (UserCertStoreEntry issuedEntry : this.issuerEntryParam.get().issuedEntries()) {
        BigInteger issuedSerial = issuedEntry.getCRT().getSerialNumber();
        boolean revoked = false;
        ReasonFlag reason = ReasonFlag.UNSPECIFIED;
        Date date = null;
        if (this.issuerEntryParam.get().hasCRL()) {
            X509CRL crl = this.issuerEntryParam.get().getCRL();
            X509CRLEntry crlEntry = crl.getRevokedCertificate(issuedSerial);
            if (crlEntry != null) {
                revoked = true;
                CRLReason crlEntryReason = crlEntry.getRevocationReason();
                if (crlEntryReason != null) {
                    reason = ReasonFlag.fromCRLReason(crlEntryReason);
                }
                date = crlEntry.getRevocationDate();
            }
        }
        entryItems.add(new CRLEntryModel(issuedEntry, revoked, issuedSerial, reason, date));
    }
    entryItems.sort((o1, o2) -> o1.compareTo(o2));
}
Also used : X509CRLEntry(java.security.cert.X509CRLEntry) X509CRL(java.security.cert.X509CRL) BigInteger(java.math.BigInteger) CRLReason(java.security.cert.CRLReason) ReasonFlag(de.carne.certmgr.certs.x509.ReasonFlag) Date(java.util.Date) LocalDate(java.time.LocalDate) UserCertStoreEntry(de.carne.certmgr.certs.UserCertStoreEntry)

Aggregations

UserCertStoreEntry (de.carne.certmgr.certs.UserCertStoreEntry)1 ReasonFlag (de.carne.certmgr.certs.x509.ReasonFlag)1 BigInteger (java.math.BigInteger)1 CRLReason (java.security.cert.CRLReason)1 X509CRL (java.security.cert.X509CRL)1 X509CRLEntry (java.security.cert.X509CRLEntry)1 LocalDate (java.time.LocalDate)1 Date (java.util.Date)1