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();
}
}
}
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());
}
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);
}
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;
}
Aggregations