use of de.carne.certmgr.certs.UserCertStorePreferences in project certmgr by hdecarne.
the class CRLOptionsController method init.
/**
* Initialize the dialog for CRL options editing.
*
* @param issuerEntry The CRL issuer to edit the options for.
* @param expertModeParam Whether to run in expert mode ({@code true}) or not ({@code false}).
* @return This controller.
* @throws IOException if an I/O error occurs during initialization.
*/
public CRLOptionsController init(UserCertStoreEntry issuerEntry, boolean expertModeParam) throws IOException {
this.issuerEntryParam.set(issuerEntry);
this.ctlIssuerField.setText(issuerEntry.getName());
UserCertStorePreferences preferences = Check.notNull(issuerEntry.store().storePreferences());
initSigAlgOptions(preferences, expertModeParam);
initUpdateOptions(preferences);
initEntries();
return this;
}
use of de.carne.certmgr.certs.UserCertStorePreferences in project certmgr by hdecarne.
the class StorePreferencesController method onDefKeyAlgChanged.
private void onDefKeyAlgChanged(KeyPairAlgorithm keyAlg) {
Integer keySizeDefaultHint = null;
String sigAlgDefaultHint = null;
if (this.storePreferencesParam.toOptional().isPresent()) {
UserCertStorePreferences storePreferences = this.storePreferencesParam.get();
if (keyAlg.algorithm().equals(storePreferences.defaultKeyPairAlgorithm.get())) {
keySizeDefaultHint = storePreferences.defaultKeySize.get();
sigAlgDefaultHint = storePreferences.defaultSignatureAlgorithm.get();
}
}
Controls.resetComboBoxOptions(this.ctlDefKeySizeOption, keyAlg.getStandardKeySizes(keySizeDefaultHint), (o1, o2) -> o1.compareTo(o2));
Controls.resetComboBoxOptions(this.ctlDefSigAlgOption, SignatureAlgorithm.getDefaultSet(keyAlg.algorithm(), sigAlgDefaultHint, this.expertModeParam), (o1, o2) -> o1.toString().compareTo(o2.toString()));
}
use of de.carne.certmgr.certs.UserCertStorePreferences in project certmgr by hdecarne.
the class StorePreferencesController method onApply.
private void onApply(ActionEvent evt) {
if (!this.storeParam.toOptional().isPresent()) {
try {
Path storeHome = validateStoreHomeInput();
this.storeParam.set(UserCertStore.createStore(storeHome));
this.storePreferencesParam.set(Check.notNull(this.storeParam.get().storePreferences()));
} catch (ValidationException e) {
ValidationAlerts.error(e).showAndWait();
evt.consume();
} catch (Exception e) {
Alerts.unexpected(e).showAndWait();
evt.consume();
}
}
if (this.storePreferencesParam.toOptional().isPresent()) {
try {
UserCertStorePreferences storePreferences = this.storePreferencesParam.get();
storePreferences.defaultCRTValidityPeriod.put(validateDefCRTValidityInput().days().count());
storePreferences.defaultCRLUpdatePeriod.put(validateDefCRLUpdateInput().days().count());
storePreferences.defaultKeyPairAlgorithm.put(validateDefKeyAlgInput().algorithm());
storePreferences.defaultKeySize.put(validateDefKeySizeInput());
storePreferences.defaultSignatureAlgorithm.put(validateDefSigAlgInput().algorithm());
storePreferences.sync();
} catch (ValidationException e) {
ValidationAlerts.error(e).showAndWait();
evt.consume();
} catch (Exception e) {
Alerts.unexpected(e).showAndWait();
evt.consume();
}
}
}
Aggregations