use of de.carne.certmgr.certs.x509.CRLDistributionPointsExtensionData in project certmgr by hdecarne.
the class CRLDistributionPointsController method init.
/**
* Initialize the dialog with existing extension data.
*
* @param data The extension data to use.
* @param expertMode Whether to run in expert mode ({@code true}) or not ({@code false}).
* @return This controller.
*/
public CRLDistributionPointsController init(CRLDistributionPointsExtensionData data, boolean expertMode) {
init(expertMode);
this.ctlCritical.setSelected(data.getCritical());
ObservableList<GeneralName> nameItems = this.ctlNames.getItems();
for (DistributionPoint distributionPoint : data) {
DistributionPointName distributionPointName = distributionPoint.getName();
if (distributionPointName != null) {
GeneralNames names = distributionPointName.getFullName();
if (names != null) {
for (GeneralName name : names) {
nameItems.add(name);
}
}
break;
}
}
return this;
}
use of de.carne.certmgr.certs.x509.CRLDistributionPointsExtensionData in project certmgr by hdecarne.
the class CertOptionsController method onCmdEditCRLDistributionPoints.
@SuppressWarnings("unused")
@FXML
void onCmdEditCRLDistributionPoints(ActionEvent evt) {
try {
CRLDistributionPointsController extensionDialog = CRLDistributionPointsDialog.load(this);
CRLDistributionPointsExtensionData extensionData = this.crlDistributionPointsExtension.get();
if (extensionData != null) {
extensionDialog.init(extensionData, this.expertModeParam);
} else {
extensionDialog.init(this.expertModeParam);
}
Optional<CRLDistributionPointsExtensionData> dialogResult = extensionDialog.showAndWait();
if (dialogResult.isPresent()) {
extensionData = dialogResult.get();
setExtensionData(extensionData);
this.crlDistributionPointsExtension.set(extensionData);
}
} catch (IOException e) {
Alerts.unexpected(e).showAndWait();
}
}
use of de.carne.certmgr.certs.x509.CRLDistributionPointsExtensionData in project certmgr by hdecarne.
the class CRLDistributionPointsController method onApply.
private void onApply(ActionEvent evt) {
try {
boolean critical = this.ctlCritical.isSelected();
DistributionPoint distributionPoint = validateAndGetDistributionPoint();
this.extensionDataResult = new CRLDistributionPointsExtensionData(critical);
this.extensionDataResult.addDistributionPoint(distributionPoint);
} catch (ValidationException e) {
ValidationAlerts.error(e).showAndWait();
evt.consume();
}
}
use of de.carne.certmgr.certs.x509.CRLDistributionPointsExtensionData in project certmgr by hdecarne.
the class CertOptionsController method onCmdDeleteExtension.
@SuppressWarnings("unused")
@FXML
void onCmdDeleteExtension(ActionEvent evt) {
ExtensionDataModel extensionDataItem = this.ctlExtensionData.getSelectionModel().getSelectedItem();
if (extensionDataItem != null) {
X509ExtensionData extensionData = extensionDataItem.getExtensionData();
if (extensionData instanceof BasicConstraintsExtensionData) {
this.basicConstraintsExtension.set(null);
} else if (extensionData instanceof KeyUsageExtensionData) {
this.keyUsageExtension.set(null);
} else if (extensionData instanceof ExtendedKeyUsageExtensionData) {
this.extendedKeyUsageExtension.set(null);
} else if (extensionData instanceof SubjectAlternativeNameExtensionData) {
this.subjectAlternativeExtension.set(null);
} else if (extensionData instanceof CRLDistributionPointsExtensionData) {
this.crlDistributionPointsExtension.set(null);
}
this.ctlExtensionData.getItems().remove(extensionDataItem);
}
}
use of de.carne.certmgr.certs.x509.CRLDistributionPointsExtensionData in project certmgr by hdecarne.
the class CertOptionsController method applyPreset.
private void applyPreset(CertOptionsPreset preset) {
this.ctlAliasInput.setText(preset.aliasInput());
this.ctlDNInput.setText(preset.dnInput());
KeyPairAlgorithm keyAlg = preset.getKeyAlg();
if (keyAlg != null) {
this.ctlKeyAlgOption.setValue(preset.getKeyAlg());
}
Integer keySize = preset.getKeySize();
if (keySize != null) {
this.ctlKeySizeOption.setValue(preset.getKeySize());
}
this.basicConstraintsExtension.set(null);
this.keyUsageExtension.set(null);
this.extendedKeyUsageExtension.set(null);
this.subjectAlternativeExtension.set(null);
this.crlDistributionPointsExtension.set(null);
this.ctlExtensionData.getItems().clear();
for (X509ExtensionData extensionData : preset.getExtensions()) {
if (extensionData instanceof BasicConstraintsExtensionData) {
this.basicConstraintsExtension.set((BasicConstraintsExtensionData) extensionData);
} else if (extensionData instanceof KeyUsageExtensionData) {
this.keyUsageExtension.set((KeyUsageExtensionData) extensionData);
} else if (extensionData instanceof ExtendedKeyUsageExtensionData) {
this.extendedKeyUsageExtension.set((ExtendedKeyUsageExtensionData) extensionData);
} else if (extensionData instanceof SubjectAlternativeNameExtensionData) {
this.subjectAlternativeExtension.set((SubjectAlternativeNameExtensionData) extensionData);
} else if (extensionData instanceof CRLDistributionPointsExtensionData) {
this.crlDistributionPointsExtension.set((CRLDistributionPointsExtensionData) extensionData);
}
this.ctlExtensionData.getItems().add(new ExtensionDataModel(extensionData));
}
}
Aggregations