2026-03-17 13:31:18 -07:00

328 lines
15 KiB
Java

/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.cert.NX509Certificate
* javax.baja.gx.BImage
* javax.baja.gx.Size
* javax.baja.security.BPassword
* javax.baja.sys.Action
* javax.baja.sys.BComponent
* javax.baja.sys.BValue
* javax.baja.sys.Slot
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BButton
* javax.baja.ui.BCheckBox
* javax.baja.ui.BLabel
* javax.baja.ui.BWidget
* javax.baja.ui.enums.BHalign
* javax.baja.ui.event.BWidgetEvent
* javax.baja.ui.pane.BBorderPane
* javax.baja.ui.pane.BEdgePane
* javax.baja.ui.pane.BGridPane
* javax.baja.ui.util.UiLexicon
* javax.baja.ui.wizard.BWizardHeader
*/
package com.tridium.platcrypto.ui;
import com.tridium.crypto.core.cert.NX509Certificate;
import com.tridium.platcrypto.ui.BCertViewDialog;
import com.tridium.platcrypto.ui.BExportResponse;
import com.tridium.platcrypto.ui.BPasswordField;
import javax.baja.gx.BImage;
import javax.baja.gx.Size;
import javax.baja.security.BPassword;
import javax.baja.sys.Action;
import javax.baja.sys.BComponent;
import javax.baja.sys.BValue;
import javax.baja.sys.Slot;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BButton;
import javax.baja.ui.BCheckBox;
import javax.baja.ui.BLabel;
import javax.baja.ui.BWidget;
import javax.baja.ui.enums.BHalign;
import javax.baja.ui.event.BWidgetEvent;
import javax.baja.ui.pane.BBorderPane;
import javax.baja.ui.pane.BEdgePane;
import javax.baja.ui.pane.BGridPane;
import javax.baja.ui.util.UiLexicon;
import javax.baja.ui.wizard.BWizardHeader;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BCertExportDialog
extends BCertViewDialog {
public static final Action setModified = BCertExportDialog.newAction((int)0, (BValue)new BWidgetEvent(), null);
public static final Action cancelButtonPressed = BCertExportDialog.newAction((int)0, (BValue)new BWidgetEvent(), null);
public static final Type TYPE;
public static final int KEY_MODE_NONE = 0;
public static final int KEY_MODE_SERVER = 1;
public static final int KEY_MODE_CA = 2;
protected static BImage pkLogo;
protected BCheckBox exportCertCheckBox;
protected BCheckBox exportPkCheckBox;
protected BLabel caPasswordLbl;
protected BPasswordField caPassword;
protected BCheckBox reusePasswordCheckBox;
protected BCheckBox encryptPrivateKeyCheckBox;
protected BPasswordField exportedPassword;
protected BPasswordField exportedConfirmPassword;
protected BLabel exportedPasswordLbl;
protected BLabel exportedConfirmPasswordLbl;
protected BButton cancelButton;
protected BExportResponse closeResult;
protected int keyMode;
static /* synthetic */ Class class$com$tridium$platcrypto$ui$BCertExportDialog;
public void setModified(BWidgetEvent bWidgetEvent) {
this.invoke(setModified, (BValue)bWidgetEvent, null);
}
public void cancelButtonPressed(BWidgetEvent bWidgetEvent) {
this.invoke(cancelButtonPressed, (BValue)bWidgetEvent, null);
}
public Type getType() {
return TYPE;
}
public static BExportResponse show(BWidget bWidget, NX509Certificate nX509Certificate, int n) throws Exception {
BCertExportDialog bCertExportDialog = new BCertExportDialog(bWidget, nX509Certificate, n);
bCertExportDialog.setBoundsCenteredOnOwner();
bCertExportDialog.setResizable(false);
bCertExportDialog.open();
return bCertExportDialog.getResult();
}
protected BWidget buildDialog() throws Exception {
BEdgePane bEdgePane = new BEdgePane();
bEdgePane.setTop(this.buildCertPane());
if (this.keyMode != 0) {
bEdgePane.setCenter(this.buildKeyPane());
}
bEdgePane.setBottom(this.buildButtons());
return bEdgePane;
}
protected BWidget buildCertPane() throws Exception {
BEdgePane bEdgePane = new BEdgePane();
bEdgePane.setTop((BWidget)new BWizardHeader(logo, lex.getText("cert.export.dialog.certificate"), ""));
BGridPane bGridPane = new BGridPane(1);
bGridPane.setHalign(BHalign.fill);
this.exportCertCheckBox = new BCheckBox(lex.getText("cert.export.cert.exportcert"), true);
bGridPane.add(null, (BValue)this.exportCertCheckBox);
this.linkTo("linkA", (BComponent)this.exportCertCheckBox, (Slot)BCheckBox.actionPerformed, (Slot)setModified);
bGridPane.add(null, (BValue)super.buildBody());
if (this.keyMode == 0) {
bEdgePane.setCenter((BWidget)new BBorderPane((BWidget)bGridPane, 7.0, 7.0, 0.0, 17.0));
this.exportCertCheckBox.setEnabled(false);
} else {
bEdgePane.setCenter((BWidget)new BBorderPane((BWidget)bGridPane, 7.0, 7.0, 14.0, 17.0));
}
return bEdgePane;
}
protected Size getCertViewSize() {
return new Size(450.0, 170.0);
}
protected BWidget buildKeyPane() throws Exception {
BEdgePane bEdgePane;
BEdgePane bEdgePane2 = new BEdgePane();
bEdgePane2.setTop((BWidget)new BWizardHeader(pkLogo, lex.getText("cert.export.dialog.privatekey"), ""));
BGridPane bGridPane = new BGridPane(1);
bGridPane.setHalign(BHalign.fill);
this.exportPkCheckBox = new BCheckBox(lex.getText("cert.export.cert.exportprivatekey"), false);
bGridPane.add(null, (BValue)this.exportPkCheckBox);
this.linkTo("linkB", (BComponent)this.exportPkCheckBox, (Slot)BCheckBox.actionPerformed, (Slot)setModified);
if (this.keyMode == 2) {
bEdgePane = new BEdgePane();
this.caPasswordLbl = new BLabel(lex.getText("cert.export.password.prompt"), BHalign.left);
bEdgePane.setLeft((BWidget)this.caPasswordLbl);
this.caPasswordLbl.setEnabled(false);
this.caPassword = new BPasswordField();
bEdgePane.setCenter((BWidget)new BBorderPane((BWidget)this.caPassword, 0.0, 0.0, 0.0, (double)5));
this.caPassword.setEnabled(false);
bGridPane.add(null, (BValue)bEdgePane);
}
bEdgePane = new BEdgePane();
this.encryptPrivateKeyCheckBox = new BCheckBox(lex.getText("cert.export.encryptprivatekey"), true);
bEdgePane.setTop((BWidget)this.encryptPrivateKeyCheckBox);
this.encryptPrivateKeyCheckBox.setEnabled(false);
this.linkTo("linkC", (BComponent)this.encryptPrivateKeyCheckBox, (Slot)BCheckBox.actionPerformed, (Slot)setModified);
bEdgePane.setLeft((BWidget)new BLabel(" "));
BGridPane bGridPane2 = new BGridPane(1);
this.reusePasswordCheckBox = new BCheckBox(lex.getText("cert.export.reuse"), true);
if (this.keyMode == 2) {
bGridPane2.add(null, (BValue)this.reusePasswordCheckBox);
this.reusePasswordCheckBox.setEnabled(false);
this.linkTo("linkD", (BComponent)this.reusePasswordCheckBox, (Slot)BCheckBox.actionPerformed, (Slot)setModified);
} else {
this.reusePasswordCheckBox.setVisible(false);
this.reusePasswordCheckBox.setSelected(false);
}
BGridPane bGridPane3 = new BGridPane(2);
bGridPane3.setRowGap((double)5);
bGridPane3.setColumnGap((double)5);
bGridPane3.setColumnAlign(BHalign.left);
bGridPane3.setStretchColumn(1);
this.exportedPasswordLbl = new BLabel(lex.get("password.field.password"), BHalign.left);
bGridPane3.add(null, (BValue)this.exportedPasswordLbl);
this.exportedPasswordLbl.setEnabled(false);
this.exportedPassword = new BPasswordField();
bGridPane3.add(null, (BValue)this.exportedPassword);
this.exportedPassword.setEnabled(false);
this.linkTo("linkE", (BComponent)this.exportedPassword, (Slot)BPasswordField.textModified, (Slot)setModified);
this.exportedConfirmPasswordLbl = new BLabel(lex.get("password.field.confirm"), BHalign.left);
bGridPane3.add(null, (BValue)this.exportedConfirmPasswordLbl);
this.exportedConfirmPasswordLbl.setEnabled(false);
this.exportedConfirmPassword = new BPasswordField();
bGridPane3.add(null, (BValue)this.exportedConfirmPassword);
this.exportedConfirmPassword.setEnabled(false);
this.linkTo("linkF", (BComponent)this.exportedConfirmPassword, (Slot)BPasswordField.textModified, (Slot)setModified);
bGridPane2.add(null, (BValue)bGridPane3);
bEdgePane.setCenter((BWidget)bGridPane2);
bGridPane.add(null, (BValue)new BBorderPane((BWidget)bEdgePane, (double)4, 0.0, 0.0, 0.0));
bEdgePane2.setCenter((BWidget)new BBorderPane((BWidget)bGridPane, 7.0, 7.0, 7.0, 17.0));
return bEdgePane2;
}
protected BWidget buildButtons() {
BGridPane bGridPane = new BGridPane(2);
bGridPane.setColumnAlign(BHalign.fill);
bGridPane.setUniformColumnWidth(true);
this.okButton = new BButton(UiLexicon.bajaui().getText("dialog.ok"));
bGridPane.add(null, (BValue)this.okButton);
this.linkTo("linkY", (BComponent)this.okButton, (Slot)BButton.actionPerformed, (Slot)okButtonPressed);
this.okButton.setEnabled(true);
this.cancelButton = new BButton(UiLexicon.bajaui().getText("dialog.cancel"));
bGridPane.add(null, (BValue)this.cancelButton);
this.linkTo("linkZ", (BComponent)this.cancelButton, (Slot)BButton.actionPerformed, (Slot)cancelButtonPressed);
this.cancelButton.setEnabled(true);
return new BBorderPane((BWidget)bGridPane, 7.0, 7.0, 10.0, 7.0);
}
public void doSetModified(BWidgetEvent bWidgetEvent) {
if (this.exportPkCheckBox.getSelected()) {
if (this.keyMode == 2) {
this.caPasswordLbl.setEnabled(true);
this.caPassword.setEnabled(true);
}
this.encryptPrivateKeyCheckBox.setEnabled(true);
if (this.encryptPrivateKeyCheckBox.getSelected()) {
if (this.keyMode == 2) {
this.reusePasswordCheckBox.setEnabled(true);
}
if (this.reusePasswordCheckBox.getSelected()) {
this.exportedPassword.setEnabled(false);
this.exportedPasswordLbl.setEnabled(false);
this.exportedConfirmPassword.setEnabled(false);
this.exportedConfirmPasswordLbl.setEnabled(false);
this.okButton.setEnabled(true);
} else {
this.exportedPassword.setEnabled(true);
this.exportedPasswordLbl.setEnabled(true);
this.exportedConfirmPassword.setEnabled(true);
this.exportedConfirmPasswordLbl.setEnabled(true);
if (this.exportedPassword.getText().length() == 0 || this.exportedConfirmPassword.getText().length() == 0) {
this.okButton.setEnabled(false);
} else if (this.exportedPassword.getText().equals(this.exportedConfirmPassword.getText())) {
this.okButton.setEnabled(true);
} else {
this.okButton.setEnabled(false);
}
}
} else {
this.reusePasswordCheckBox.setEnabled(false);
this.exportedPassword.setEnabled(false);
this.exportedPasswordLbl.setEnabled(false);
this.exportedConfirmPassword.setEnabled(false);
this.exportedConfirmPasswordLbl.setEnabled(false);
this.okButton.setEnabled(true);
}
} else {
if (this.keyMode == 2) {
this.caPasswordLbl.setEnabled(false);
this.caPassword.setEnabled(false);
}
this.reusePasswordCheckBox.setEnabled(false);
this.encryptPrivateKeyCheckBox.setEnabled(false);
this.exportedPassword.setEnabled(false);
this.exportedPasswordLbl.setEnabled(false);
this.exportedConfirmPassword.setEnabled(false);
this.exportedConfirmPasswordLbl.setEnabled(false);
this.okButton.setEnabled(true);
}
if (!this.exportPkCheckBox.getSelected() && !this.exportCertCheckBox.getSelected()) {
this.okButton.setEnabled(false);
}
}
public void doOkButtonPressed(BWidgetEvent bWidgetEvent) {
switch (this.keyMode) {
case 2: {
this.closeResult = BExportResponse.make(this.exportCertCheckBox.getSelected(), this.exportPkCheckBox.getSelected(), BPassword.make((String)this.caPassword.getText()), this.encryptPrivateKeyCheckBox.getSelected(), this.reusePasswordCheckBox.getSelected(), BPassword.make((String)this.exportedPassword.getText()));
break;
}
case 1: {
this.closeResult = BExportResponse.make(this.exportCertCheckBox.getSelected(), this.exportPkCheckBox.getSelected(), BPassword.DEFAULT, this.encryptPrivateKeyCheckBox.getSelected(), this.reusePasswordCheckBox.getSelected(), BPassword.make((String)this.exportedPassword.getText()));
break;
}
default: {
this.closeResult = BExportResponse.make(this.exportCertCheckBox.getSelected(), false, BPassword.DEFAULT, false, false, BPassword.DEFAULT);
}
}
this.close();
}
public void doCancelButtonPressed(BWidgetEvent bWidgetEvent) {
this.closeResult = null;
this.close();
}
public BExportResponse getResult() {
return this.closeResult;
}
static /* synthetic */ Class class(String string, boolean bl) {
try {
Class<?> clazz = Class.forName(string);
if (!bl) {
clazz = clazz.getComponentType();
}
return clazz;
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
private final /* synthetic */ void this() {
this.closeResult = null;
this.keyMode = 0;
}
protected BCertExportDialog(BWidget bWidget, NX509Certificate nX509Certificate, int n) throws Exception {
super(bWidget, lex.getText("cert.export.dialog.title"));
this.this();
this.cert = nX509Certificate;
this.keyMode = n;
this.setContent(this.buildDialog());
this.setDefaultButton(this.okButton);
}
static {
Class clazz = class$com$tridium$platcrypto$ui$BCertExportDialog;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$ui$BCertExportDialog = BCertExportDialog.class("[Lcom.tridium.platcrypto.ui.BCertExportDialog;", false);
}
TYPE = Sys.loadType((Class)clazz);
pkLogo = BImage.make((String)lex.get("key.x32.icon", "module://icons/x32/lock.png"));
}
}