use of de.carne.certmgr.certs.UserCertStoreEntry in project certmgr by hdecarne.
the class CertOptionsController method resetStorePresetMenuHelper.
private void resetStorePresetMenuHelper(ObservableList<MenuItem> menuItems, Set<UserCertStoreEntry> storeEntries, String indent) {
for (UserCertStoreEntry storeEntry : storeEntries) {
if (storeEntry.hasCRT() || storeEntry.hasCSR()) {
MenuItem storeEntryMenuItem = new MenuItem(CertOptionsI18N.formatSTR_MENU_STORE_PRESET(indent, storeEntry.id().getAlias(), X500Names.toString(storeEntry.dn())));
storeEntryMenuItem.setUserData(CertOptionsTemplates.wrap(storeEntry));
storeEntryMenuItem.setOnAction(this::onCmdApplyTemplate);
menuItems.add(storeEntryMenuItem);
String nextIndent = (Strings.notEmpty(indent) ? " " + indent : " \u21b3");
resetStorePresetMenuHelper(menuItems, storeEntry.issuedEntries(), nextIndent);
}
}
}
use of de.carne.certmgr.certs.UserCertStoreEntry in project certmgr by hdecarne.
the class CertImportController method importSelection.
void importSelection(Set<UserCertStoreEntry> importSelection) throws IOException {
PasswordCallback newPassword = PasswordDialog.enterNewPassword(this);
UserCertStore importStore = this.importStoreParam.get();
for (UserCertStoreEntry importEntry : importSelection) {
importStore.importEntry(importEntry, newPassword, CertImportI18N.formatSTR_TEXT_ALIASHINT());
}
}
use of de.carne.certmgr.certs.UserCertStoreEntry in project certmgr by hdecarne.
the class StoreController method onCmdRevokeCert.
@SuppressWarnings("unused")
@FXML
void onCmdRevokeCert(ActionEvent evt) {
UserCertStoreEntry entry = getSelectedStoreEntry();
if (entry != null) {
UserCertStoreEntry issuerEntry = entry.issuer();
if (!entry.isSelfSigned() && issuerEntry.hasPublicKey() && issuerEntry.hasKey()) {
try {
CRLOptionsController crlOptionsController = loadStage(CRLOptionsController.class).init(issuerEntry, this.userPreferences.expertMode.getBoolean(false));
crlOptionsController.revokeStoreEntry(entry, ReasonFlag.UNSPECIFIED);
crlOptionsController.showAndWait();
updateStoreEntryView();
} catch (IOException e) {
Alerts.unexpected(e).showAndWait();
}
} else {
Alerts.message(AlertType.WARNING, StoreI18N.formatSTR_MESSAGE_CANNOT_REVOKE_CRT(issuerEntry), ButtonType.OK).showAndWait();
}
}
}
use of de.carne.certmgr.certs.UserCertStoreEntry in project certmgr by hdecarne.
the class StoreController method onCmdExportCert.
@SuppressWarnings("unused")
@FXML
void onCmdExportCert(ActionEvent evt) {
UserCertStoreEntry exportEntry = getSelectedStoreEntry();
if (exportEntry != null) {
try {
CertExportController exportController = loadStage(CertExportController.class).init(exportEntry);
exportController.showAndWait();
updateStoreEntryView();
} catch (IOException e) {
Alerts.unexpected(e).showAndWait();
}
}
}
use of de.carne.certmgr.certs.UserCertStoreEntry in project certmgr by hdecarne.
the class StoreController method updateDetailsView.
private void updateDetailsView(@Nullable TreeItem<StoreEntryModel> selection) {
TreeItem<AttributeModel> rootItem = null;
if (selection != null) {
rootItem = new TreeItem<>();
rootItem.setExpanded(true);
UserCertStoreEntry entry = selection.getValue().getEntry();
updateDetailsViewHelper(rootItem, Attributes.toAttributes(entry), true);
if (entry.hasCRT()) {
try {
X509Certificate crt = entry.getCRT();
updateDetailsViewHelper(rootItem, X509CertificateHelper.toAttributes(crt), true);
} catch (IOException e) {
Exceptions.warn(e);
}
}
if (entry.hasCSR()) {
try {
PKCS10CertificateRequest csr = entry.getCSR();
updateDetailsViewHelper(rootItem, csr.toAttributes(), true);
} catch (IOException e) {
Exceptions.ignore(e);
}
}
if (entry.hasCRL()) {
try {
X509CRL crl = entry.getCRL();
updateDetailsViewHelper(rootItem, X509CRLHelper.toAttributes(crl), true);
} catch (IOException e) {
Exceptions.ignore(e);
}
}
}
this.ctlDetailsView.setRoot(rootItem);
}
Aggregations