use of de.carne.jfx.util.validation.ValidationException in project certmgr by hdecarne.
the class CertImportController method validateAndReloadPlatformSource.
private void validateAndReloadPlatformSource() {
try {
PlatformKeyStore platformSource = validatePlatformSourceInput();
getExecutorService().submit(new ReloadTask<PlatformKeyStore>(platformSource) {
@Override
protected UserCertStore createStore(PlatformKeyStore params) throws IOException {
return UserCertStore.createFromPlatformKeyStore(params, PasswordDialog.enterPassword(CertImportController.this));
}
});
} catch (ValidationException e) {
ValidationAlerts.error(e).showAndWait();
}
}
use of de.carne.jfx.util.validation.ValidationException in project certmgr by hdecarne.
the class CertImportController method validateURLSourceInput.
private URL validateURLSourceInput() throws ValidationException {
String urlSourceInput = InputValidator.notEmpty(Strings.safeTrim(this.ctlURLSourceInput.getText()), CertImportI18N::formatSTR_MESSAGE_NO_URL);
URL urlSource;
try {
urlSource = new URL(urlSourceInput);
} catch (MalformedURLException e) {
throw new ValidationException(CertImportI18N.formatSTR_MESSAGE_INVALID_DIRECTORY(urlSourceInput), e);
}
return urlSource;
}
use of de.carne.jfx.util.validation.ValidationException in project certmgr by hdecarne.
the class BasicConstraintsController method onApply.
private void onApply(ActionEvent evt) {
try {
boolean critical = this.ctlCritical.isSelected();
boolean ca = this.ctlCA.isSelected();
BigInteger pathLenConstraint = null;
if (ca) {
pathLenConstraint = valdiateAndGetPathLenConstraint();
}
this.extensionDataResult = new BasicConstraintsExtensionData(critical, ca, pathLenConstraint);
} catch (ValidationException e) {
ValidationAlerts.error(e).showAndWait();
evt.consume();
}
}
use of de.carne.jfx.util.validation.ValidationException in project certmgr by hdecarne.
the class SubjectAlternativeNameController method onApply.
private void onApply(ActionEvent evt) {
try {
boolean critical = this.ctlCritical.isSelected();
GeneralNames names = validateAndGetNames();
this.extensionDataResult = new SubjectAlternativeNameExtensionData(critical, names);
} catch (ValidationException e) {
ValidationAlerts.error(e).showAndWait();
evt.consume();
}
}
use of de.carne.jfx.util.validation.ValidationException in project certmgr by hdecarne.
the class CertExportController method onCmdExport.
@SuppressWarnings("unused")
@FXML
void onCmdExport(ActionEvent evt) {
try {
CertWriter exportFormat = validateAndGetFormat();
boolean encrypt = this.ctlEncryptOption.isSelected();
boolean exportCert = this.ctlExportCertOption.isSelected();
boolean exportChain = this.ctlExportChainOption.isSelected();
boolean exportChainRoot = this.ctlExportChainRootOption.isSelected();
boolean exportKey = this.ctlExportKeyOption.isSelected();
boolean exportCSR = this.ctlExportCSROption.isSelected();
boolean exportCRL = this.ctlExportCRLOption.isSelected();
if (this.ctlFileDestinationOption.isSelected()) {
Path exportFile = validateFileDestinationInput();
getExecutorService().submit(new ExportTask<Path>(exportCert, exportChain, exportChainRoot, exportKey, exportCSR, exportCRL, exportFormat, exportFile, encrypt) {
@Override
protected void export(CertWriter format, @Nullable Path param, CertObjectStore exportObjects, boolean encryptExport) throws IOException {
exportToFile(format, Check.notNull(param), exportObjects, encryptExport);
}
});
} else if (this.ctlDirectoryDestinationOption.isSelected()) {
Path exportDirectory = validateDirectoryDestinationInput();
getExecutorService().submit(new ExportTask<Path>(exportCert, exportChain, exportChainRoot, exportKey, exportCSR, exportCRL, exportFormat, exportDirectory, encrypt) {
@Override
protected void export(CertWriter format, @Nullable Path param, CertObjectStore exportObjects, boolean encryptExport) throws IOException {
exportToDirectory(format, Check.notNull(param), exportObjects, encryptExport);
}
});
} else if (this.ctlClipboardDestinationOption.isSelected()) {
getExecutorService().submit(new ExportTask<Void>(exportCert, exportChain, exportChainRoot, exportKey, exportCSR, exportCRL, exportFormat, null, encrypt) {
@Override
protected void export(CertWriter format, @Nullable Void param, CertObjectStore exportObjects, boolean encryptExport) throws IOException {
exportToClipboard(format, exportObjects, encryptExport);
}
});
}
} catch (ValidationException e) {
ValidationAlerts.error(e).showAndWait();
}
}
Aggregations