Search in sources :

Example 16 with UserCertStoreEntry

use of de.carne.certmgr.certs.UserCertStoreEntry in project certmgr by hdecarne.

the class StoreController method onCmdManageCRL.

@SuppressWarnings("unused")
@FXML
void onCmdManageCRL(ActionEvent evt) {
    UserCertStoreEntry issuerEntry = getSelectedStoreEntry();
    if (issuerEntry != null) {
        if (issuerEntry.hasPublicKey() && issuerEntry.hasKey()) {
            try {
                CRLOptionsController crlOptionsController = loadStage(CRLOptionsController.class).init(issuerEntry, this.userPreferences.expertMode.getBoolean(false));
                crlOptionsController.showAndWait();
                updateStoreEntryView();
            } catch (IOException e) {
                Alerts.unexpected(e).showAndWait();
            }
        } else {
            Alerts.message(AlertType.WARNING, StoreI18N.formatSTR_MESSAGE_CANNOT_MANAGE_CRL(issuerEntry), ButtonType.OK).showAndWait();
        }
    }
}
Also used : CRLOptionsController(de.carne.certmgr.jfx.crloptions.CRLOptionsController) IOException(java.io.IOException) UserCertStoreEntry(de.carne.certmgr.certs.UserCertStoreEntry) FXML(javafx.fxml.FXML)

Example 17 with UserCertStoreEntry

use of de.carne.certmgr.certs.UserCertStoreEntry in project certmgr by hdecarne.

the class StoreController method onStoreViewItemMouseEntered.

@SuppressWarnings("unused")
@FXML
void onStoreViewItemMouseEntered(MouseEvent evt) {
    @SuppressWarnings("unchecked") TreeTableCell<StoreEntryModel, String> cell = (TreeTableCell<StoreEntryModel, String>) evt.getSource();
    UserCertStoreEntry entry = cell.getTreeTableRow().getItem().getEntry();
    this.ctlStoreEntryTooltipExternalCrt.setVisible(entry.isExternal());
    if (entry.hasCRT()) {
        if (entry.hasKey()) {
            this.ctlStoreEntryTooltipPublicCrt.setVisible(false);
            this.ctlStoreEntryTooltipPrivateCrt.setVisible(true);
            this.ctlStoreEntryTooltipCsr.setVisible(false);
            this.ctlStoreEntryTooltipCrl.setVisible(false);
            this.ctlStoreEntryTooltipKey.setVisible(false);
        } else {
            this.ctlStoreEntryTooltipPublicCrt.setVisible(true);
            this.ctlStoreEntryTooltipPrivateCrt.setVisible(false);
            this.ctlStoreEntryTooltipCsr.setVisible(false);
            this.ctlStoreEntryTooltipCrl.setVisible(false);
            this.ctlStoreEntryTooltipKey.setVisible(false);
        }
    } else if (entry.hasCSR()) {
        this.ctlStoreEntryTooltipPublicCrt.setVisible(false);
        this.ctlStoreEntryTooltipPrivateCrt.setVisible(false);
        this.ctlStoreEntryTooltipCsr.setVisible(true);
        this.ctlStoreEntryTooltipCrl.setVisible(false);
        this.ctlStoreEntryTooltipKey.setVisible(false);
    } else if (entry.hasCRL()) {
        this.ctlStoreEntryTooltipPublicCrt.setVisible(false);
        this.ctlStoreEntryTooltipPrivateCrt.setVisible(false);
        this.ctlStoreEntryTooltipCsr.setVisible(false);
        this.ctlStoreEntryTooltipCrl.setVisible(true);
        this.ctlStoreEntryTooltipKey.setVisible(false);
    } else if (entry.hasKey()) {
        this.ctlStoreEntryTooltipPublicCrt.setVisible(false);
        this.ctlStoreEntryTooltipPrivateCrt.setVisible(false);
        this.ctlStoreEntryTooltipCsr.setVisible(false);
        this.ctlStoreEntryTooltipCrl.setVisible(false);
        this.ctlStoreEntryTooltipKey.setVisible(true);
    }
    this.ctlStoreEntryTooltipRevokedCrt.setVisible(entry.isRevoked());
    this.ctlStoreEntryTooltipInvalidCrt.setVisible(!entry.isValid());
}
Also used : TreeTableCell(javafx.scene.control.TreeTableCell) UserCertStoreEntry(de.carne.certmgr.certs.UserCertStoreEntry) FXML(javafx.fxml.FXML)

Example 18 with UserCertStoreEntry

use of de.carne.certmgr.certs.UserCertStoreEntry in project certmgr by hdecarne.

the class UserCertStoreTreeTableViewHelper method updateHelper.

private void updateHelper(TreeItem<T> parent, Set<UserCertStoreEntry> entries) {
    ObservableList<TreeItem<T>> items = parent.getChildren();
    List<TreeItem<T>> itemsToRemove = new ArrayList<>(items.size());
    Map<UserCertStoreEntry, TreeItem<T>> itemsToUpdate = new HashMap<>(items.size());
    for (TreeItem<T> item : items) {
        if (entries.contains(item.getValue().getEntry())) {
            // entry does still exist -> remember for update
            itemsToUpdate.put(item.getValue().getEntry(), item);
        } else {
            // entry no longer in store -> remember for remove
            itemsToRemove.add(item);
        }
    }
    items.removeAll(itemsToRemove);
    for (UserCertStoreEntry entry : entries) {
        TreeItem<T> entryItem = itemsToUpdate.get(entry);
        if (entryItem == null) {
            entryItem = new TreeItem<>(this.modelFactory.apply(entry));
            entryItem.graphicProperty().bind(entryItem.getValue().graphicProperty());
            items.add(entryItem);
        } else {
            entryItem.getValue().updateGraphic();
        }
        updateHelper(entryItem, entry.issuedEntries());
    }
    items.sort(this.comparator);
}
Also used : TreeItem(javafx.scene.control.TreeItem) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) UserCertStoreEntry(de.carne.certmgr.certs.UserCertStoreEntry)

Example 19 with UserCertStoreEntry

use of de.carne.certmgr.certs.UserCertStoreEntry in project certmgr by hdecarne.

the class AbstractCertGenerator method getNextSerialHelper.

private BigInteger getNextSerialHelper(UserCertStoreEntry issuer, BigInteger serial) throws IOException {
    BigInteger maxSerial = serial;
    if (!issuer.hasCRT()) {
        throw new IOException("Incomplete CA; unable to determine next serial");
    }
    maxSerial = maxSerial.max(issuer.getCRT().getSerialNumber());
    for (UserCertStoreEntry issuedEntry : issuer.issuedEntries()) {
        maxSerial = getNextSerialHelper(issuedEntry, maxSerial);
    }
    return maxSerial;
}
Also used : BigInteger(java.math.BigInteger) IOException(java.io.IOException) UserCertStoreEntry(de.carne.certmgr.certs.UserCertStoreEntry)

Aggregations

UserCertStoreEntry (de.carne.certmgr.certs.UserCertStoreEntry)19 IOException (java.io.IOException)10 FXML (javafx.fxml.FXML)6 UserCertStore (de.carne.certmgr.certs.UserCertStore)4 BigInteger (java.math.BigInteger)4 Date (java.util.Date)4 CRLOptionsController (de.carne.certmgr.jfx.crloptions.CRLOptionsController)3 X509CRL (java.security.cert.X509CRL)3 X509Certificate (java.security.cert.X509Certificate)3 CertObjectStore (de.carne.certmgr.certs.CertObjectStore)2 SignatureAlgorithm (de.carne.certmgr.certs.security.SignatureAlgorithm)2 PKCS10CertificateRequest (de.carne.certmgr.certs.x509.PKCS10CertificateRequest)2 ReasonFlag (de.carne.certmgr.certs.x509.ReasonFlag)2 CertExportController (de.carne.certmgr.jfx.certexport.CertExportController)2 Path (java.nio.file.Path)2 ButtonType (javafx.scene.control.ButtonType)2 Test (org.junit.Test)2 PasswordCallback (de.carne.certmgr.certs.PasswordCallback)1 UserCertStoreEntryId (de.carne.certmgr.certs.UserCertStoreEntryId)1 UserCertStorePreferences (de.carne.certmgr.certs.UserCertStorePreferences)1