link start!

This commit is contained in:
cherubin
2026-03-17 13:31:18 -07:00
commit 08abe87cfb
5910 changed files with 386288 additions and 0 deletions
@@ -0,0 +1,82 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.cert.NX509CertificateEntry
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BWidget
* javax.baja.ui.wizard.BWizardHeader
*/
package com.tridium.platcrypto.ui;
import com.tridium.crypto.core.cert.NX509CertificateEntry;
import com.tridium.platcrypto.ui.BCertViewDialog;
import com.tridium.platcrypto.ui.BX509CertificatePane;
import java.util.Properties;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BWidget;
import javax.baja.ui.wizard.BWizardHeader;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BCertEntryViewDialog
extends BCertViewDialog {
public static final Type TYPE;
private NX509CertificateEntry entry;
static /* synthetic */ Class class$com$tridium$platcrypto$ui$BCertEntryViewDialog;
public Type getType() {
return TYPE;
}
public static void show(BWidget bWidget, NX509CertificateEntry nX509CertificateEntry) throws Exception {
BCertEntryViewDialog bCertEntryViewDialog = new BCertEntryViewDialog(bWidget, nX509CertificateEntry);
bCertEntryViewDialog.setBoundsCenteredOnOwner();
bCertEntryViewDialog.setResizable(false);
bCertEntryViewDialog.open();
}
protected BWidget buildHeader() {
return new BWizardHeader(logo, this.entry.getAlias(), lex.getText("cert.view.dialog.info", new Object[]{this.cert.getSubject()}));
}
protected BWidget buildProperties() {
Properties properties = new Properties();
properties.setProperty("cert.field.alias", this.entry.getAlias());
BX509CertificatePane bX509CertificatePane = new BX509CertificatePane(this.cert, properties, null);
return bX509CertificatePane;
}
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 BCertEntryViewDialog(BWidget bWidget, NX509CertificateEntry nX509CertificateEntry) throws Exception {
super(bWidget, lex.getText("cert.view.dialog.title"));
this.entry = nX509CertificateEntry;
this.cert = nX509CertificateEntry.getCertificate(0);
this.setContent(this.buildDialog());
this.setDefaultButton(this.okButton);
}
static {
Class clazz = class$com$tridium$platcrypto$ui$BCertEntryViewDialog;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$ui$BCertEntryViewDialog = BCertEntryViewDialog.class("[Lcom.tridium.platcrypto.ui.BCertEntryViewDialog;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,327 @@
/*
* 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"));
}
}
@@ -0,0 +1,192 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.cert.NX509Certificate
* javax.baja.gx.BImage
* 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.BTextField
* javax.baja.ui.BWidget
* javax.baja.ui.enums.BHalign
* javax.baja.ui.event.BWidgetEvent
* javax.baja.ui.event.BWindowEvent
* 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 javax.baja.gx.BImage;
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.BTextField;
import javax.baja.ui.BWidget;
import javax.baja.ui.enums.BHalign;
import javax.baja.ui.event.BWidgetEvent;
import javax.baja.ui.event.BWindowEvent;
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 BCertImportDialog
extends BCertViewDialog {
public static final Action cancelButtonPressed = BCertImportDialog.newAction((int)0, (BValue)new BWidgetEvent(), null);
public static final Action setModified = BCertImportDialog.newAction((int)0, (BValue)new BWidgetEvent(), null);
public static final Type TYPE;
static final BImage logo;
private BButton cancelButton;
private BTextField aliasTextField;
private String alias;
private boolean readonly;
static /* synthetic */ Class class$com$tridium$platcrypto$ui$BCertImportDialog;
public void cancelButtonPressed(BWidgetEvent bWidgetEvent) {
this.invoke(cancelButtonPressed, (BValue)bWidgetEvent, null);
}
public void setModified(BWidgetEvent bWidgetEvent) {
this.invoke(setModified, (BValue)bWidgetEvent, null);
}
public Type getType() {
return TYPE;
}
public static String prompt(BWidget bWidget, NX509Certificate nX509Certificate, String string, boolean bl) throws Exception {
BCertImportDialog bCertImportDialog = new BCertImportDialog(bWidget, nX509Certificate, string, bl);
bCertImportDialog.setBoundsCenteredOnOwner();
bCertImportDialog.setResizable(false);
bCertImportDialog.open();
return bCertImportDialog.getAlias();
}
protected BWidget buildHeader() {
return new BWizardHeader(logo, this.getTitle(), lex.getText("cert.import.dialog.info", new Object[]{this.cert.getSubject()}));
}
protected BWidget buildContent() throws Exception {
BEdgePane bEdgePane = new BEdgePane();
bEdgePane.setTop(this.buildAliasPrompt());
bEdgePane.setCenter(super.buildContent());
return bEdgePane;
}
private final BWidget buildAliasPrompt() {
BEdgePane bEdgePane = new BEdgePane();
bEdgePane.setLeft(BCertImportDialog.createPaddedLabel(lex.getText("cert.field.aliasPrompt")));
this.aliasTextField = new BTextField(this.alias == null ? "" : this.alias, 30, true);
bEdgePane.setCenter((BWidget)this.aliasTextField);
this.aliasTextField.setEditable(this.readonly ^ true);
this.linkTo(null, (BComponent)this.aliasTextField, (Slot)BTextField.textModified, (Slot)setModified);
BBorderPane bBorderPane = new BBorderPane((BWidget)bEdgePane, 20.0, 20.0, 20.0, 0.0);
return bBorderPane;
}
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("linkA", (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("linkB", (BComponent)this.cancelButton, (Slot)BButton.actionPerformed, (Slot)cancelButtonPressed);
this.cancelButton.setEnabled(true);
return new BBorderPane((BWidget)bGridPane, 7.0, 0.0, 0.0, 0.0);
}
public void windowClosing(BWindowEvent bWindowEvent) {
this.close();
}
public String getAlias() {
return this.alias;
}
public void doOkButtonPressed(BWidgetEvent bWidgetEvent) {
this.close();
this.alias = this.aliasTextField.getText();
}
public void doCancelButtonPressed(BWidgetEvent bWidgetEvent) {
this.close();
this.alias = null;
}
public void doSetModified(BWidgetEvent bWidgetEvent) {
try {
if (this.aliasTextField.getText().length() > 0) {
this.okButton.setEnabled(true);
} else {
this.okButton.setEnabled(false);
}
}
catch (Exception exception) {
exception.printStackTrace();
}
}
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.alias = null;
}
private BCertImportDialog(BWidget bWidget, NX509Certificate nX509Certificate, String string, boolean bl) throws Exception {
super(bWidget, lex.getText("cert.import.dialog.title"));
this.this();
this.cert = nX509Certificate;
this.alias = string;
this.readonly = bl;
this.setContent(this.buildDialog());
this.setDefaultButton(this.okButton);
if (this.aliasTextField.getText().length() > 0) {
this.okButton.setEnabled(true);
} else {
this.okButton.setEnabled(false);
}
}
static {
Class clazz = class$com$tridium$platcrypto$ui$BCertImportDialog;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$ui$BCertImportDialog = BCertImportDialog.class("[Lcom.tridium.platcrypto.ui.BCertImportDialog;", false);
}
TYPE = Sys.loadType((Class)clazz);
logo = BImage.make((String)lex.get("cert.x32.icon", "module://icons/x32/lock.png"));
}
}
@@ -0,0 +1,74 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.io.ICoreCryptoManager
* javax.baja.security.crypto.CertManagerFactory
* javax.baja.security.crypto.ICryptoManagerEx
* javax.baja.sys.BIcon
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.workbench.tool.BWbNavNodeTool
*/
package com.tridium.platcrypto.ui;
import com.tridium.crypto.core.io.ICoreCryptoManager;
import com.tridium.platcrypto.core.ICryptoManagerProvider;
import com.tridium.platcrypto.core.IExtCryptoManager;
import javax.baja.security.crypto.CertManagerFactory;
import javax.baja.security.crypto.ICryptoManagerEx;
import javax.baja.sys.BIcon;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.workbench.tool.BWbNavNodeTool;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BCertManagerTool
extends BWbNavNodeTool
implements ICryptoManagerProvider {
public static final Type TYPE;
private static final BIcon icon;
static /* synthetic */ Class class$com$tridium$platcrypto$ui$BCertManagerTool;
public Type getType() {
return TYPE;
}
public ICryptoManagerEx getCryptoManager() throws Exception {
return CertManagerFactory.getInstanceEx();
}
public ICoreCryptoManager getCoreCryptoManager() throws Exception {
IExtCryptoManager iExtCryptoManager = (IExtCryptoManager)this.getCryptoManager();
return iExtCryptoManager.getCoreCryptoManager();
}
public BIcon getIcon() {
return icon;
}
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());
}
}
static {
Class clazz = class$com$tridium$platcrypto$ui$BCertManagerTool;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$ui$BCertManagerTool = BCertManagerTool.class("[Lcom.tridium.platcrypto.ui.BCertManagerTool;", false);
}
TYPE = Sys.loadType((Class)clazz);
icon = BIcon.std((String)"files/certificate.png");
}
}
@@ -0,0 +1,241 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.cert.CertUtils
* com.tridium.crypto.core.io.ICoreCryptoManager
* com.tridium.platform.daemon.BDaemonSession
* com.tridium.platform.ui.util.BButtonPane
* com.tridium.platform.ui.util.BCommandBoundTable
* com.tridium.ui.theme.Theme
* com.tridium.workbench.shell.BScrollingWidgetPane
* com.tridium.workbench.shell.WbMain
* javax.baja.gx.BImage
* javax.baja.gx.BInsets
* javax.baja.sys.BComponent
* javax.baja.sys.BObject
* javax.baja.sys.BValue
* javax.baja.sys.Context
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BDialog
* javax.baja.ui.BLabel
* javax.baja.ui.BWidget
* javax.baja.ui.Command
* javax.baja.ui.enums.BHalign
* javax.baja.ui.pane.BBorderPane
* javax.baja.ui.pane.BEdgePane
* javax.baja.ui.pane.BGridPane
* javax.baja.ui.pane.BTabbedPane
* javax.baja.ui.table.BTable
* javax.baja.ui.util.BTitlePane
* javax.baja.util.Lexicon
* javax.baja.util.LexiconText
* javax.baja.workbench.tool.BWbTool
* javax.baja.workbench.view.BWbComponentView
*/
package com.tridium.platcrypto.ui;
import com.tridium.crypto.core.cert.CertUtils;
import com.tridium.crypto.core.io.ICoreCryptoManager;
import com.tridium.platcrypto.core.BCertManagerService;
import com.tridium.platcrypto.core.ICryptoManagerProvider;
import com.tridium.platcrypto.daemon.BPlatCryptoManager;
import com.tridium.platcrypto.ui.BCertsTable;
import com.tridium.platcrypto.ui.BExemptionTable;
import com.tridium.platcrypto.ui.BLocalCertsTable;
import com.tridium.platcrypto.ui.BTrustCertsTable;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.ui.util.BButtonPane;
import com.tridium.platform.ui.util.BCommandBoundTable;
import com.tridium.ui.theme.Theme;
import com.tridium.workbench.shell.BScrollingWidgetPane;
import com.tridium.workbench.shell.WbMain;
import javax.baja.gx.BImage;
import javax.baja.gx.BInsets;
import javax.baja.sys.BComponent;
import javax.baja.sys.BObject;
import javax.baja.sys.BValue;
import javax.baja.sys.Context;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BDialog;
import javax.baja.ui.BLabel;
import javax.baja.ui.BWidget;
import javax.baja.ui.Command;
import javax.baja.ui.enums.BHalign;
import javax.baja.ui.pane.BBorderPane;
import javax.baja.ui.pane.BEdgePane;
import javax.baja.ui.pane.BGridPane;
import javax.baja.ui.pane.BTabbedPane;
import javax.baja.ui.table.BTable;
import javax.baja.ui.util.BTitlePane;
import javax.baja.util.Lexicon;
import javax.baja.util.LexiconText;
import javax.baja.workbench.tool.BWbTool;
import javax.baja.workbench.view.BWbComponentView;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BCertManagerView
extends BWbComponentView {
public static final Type TYPE;
private static final int BUTTONS_PER_ROW = 4;
public static final Lexicon lex;
protected BLabel titleLabel;
protected BLabel caDescription;
protected BEdgePane caCertsPane;
protected BGridPane caCertsButtons;
protected BLabel serverCertsDescription;
protected BEdgePane serverCertsPane;
protected BGridPane serverCertsButtons;
protected BEdgePane exemptionsPane;
protected BLabel exemptionsDescription;
protected BGridPane exemptionsButtons;
protected BLabel clientKeysDescription;
protected BEdgePane clientKeysPane;
protected BGridPane clientKeysButtons;
protected BTabbedPane tabbedPane;
ICoreCryptoManager mgr;
static /* synthetic */ Class class$com$tridium$platcrypto$ui$BCertManagerView;
public Type getType() {
return TYPE;
}
protected void doLoadValue(BObject bObject, Context context) throws Exception {
int n;
Object object;
Object object2;
String string = "";
if (bObject instanceof ICryptoManagerProvider) {
object2 = (ICryptoManagerProvider)bObject;
this.mgr = object2.getCoreCryptoManager();
if (bObject instanceof BCertManagerService) {
((BCertManagerService)bObject).poll();
}
if (object2 instanceof BWbTool) {
string = lex.get("CertManagerView.longTitle") + ' ' + WbMain.brandTitle;
} else if (object2 instanceof BComponent) {
object = ((BComponent)object2).getSession();
string = lex.get("CertManagerView.longTitle") + " \"" + object.getHost() + '\"';
} else {
string = lex.get("CertManagerView.shortTitle");
}
} else if (bObject instanceof BDaemonSession) {
this.mgr = new BPlatCryptoManager((BDaemonSession)bObject);
string = lex.get("CertManagerView.longTitle") + " \"" + ((BDaemonSession)bObject).getHost() + '\"';
}
if (!this.mgr.isSecure() && (n = BDialog.open((BWidget)this, (String)lex.getText("nonsecure.warning.dialog.title"), (Object)lex.getText("nonsecure.warning.dialog.msg"), (int)12, (BImage)BDialog.WARNING_ICON, null)) == 8) {
throw new Exception("non-secure connection aborted");
}
if (!CertUtils.hasUnrestrictedPolicyFiles()) {
BDialog.warning((BWidget)this, (String)lex.getText("unlimited.strength.title"), (Object)lex.getText("unlimited.strength.msg"));
}
this.titleLabel.setText(string);
object2 = new BLocalCertsTable(this.mgr.getKeyStore());
this.loadPane(this.serverCertsPane, (BCommandBoundTable)object2, this.serverCertsButtons, this.tabbedPane, "cert.view.tab.title", context);
((BCertsTable)((Object)object2)).load();
object = new BTrustCertsTable(this.mgr.getTrustStore());
this.loadPane(this.caCertsPane, (BCommandBoundTable)object, this.caCertsButtons, this.tabbedPane, "cacert.view.tab.title", context);
((BCertsTable)((Object)object)).load();
BExemptionTable bExemptionTable = new BExemptionTable(this.mgr.getExemptionStore());
this.loadPane(this.exemptionsPane, bExemptionTable, this.exemptionsButtons, this.tabbedPane, "exempt.view.tab.title", context);
bExemptionTable.load();
}
private final void loadPane(BEdgePane bEdgePane, BCommandBoundTable bCommandBoundTable, BGridPane bGridPane, BTabbedPane bTabbedPane, String string, Context context) throws Exception {
BGridPane bGridPane2 = this.buildCommandPane(bGridPane, bCommandBoundTable.getCommands());
BTitlePane bTitlePane = BTitlePane.makePane((String)lex.getText(string), (BTable)bCommandBoundTable);
this.makeButtonBorder(bTitlePane, bGridPane2);
bEdgePane.setCenter((BWidget)new BBorderPane((BWidget)bTitlePane, BInsets.make((double)0.0, (double)7.0, (double)7.0, (double)7.0)));
this.addTab(bTabbedPane, (BWidget)bEdgePane, string, context);
}
private final void addTab(BTabbedPane bTabbedPane, BWidget bWidget, String string, Context context) {
bTabbedPane.addPane(new BLabel(LexiconText.make((Type)TYPE, (String)string).getText(context), Theme.widget().getBoldText()), bWidget);
}
private final void makeButtonBorder(BTitlePane bTitlePane, BGridPane bGridPane) {
BBorderPane bBorderPane = new BBorderPane((BWidget)bGridPane);
bBorderPane.setPadding(BInsets.make((double)5, (double)0.0, (double)5, (double)0.0));
bTitlePane.setBottom((BWidget)new BScrollingWidgetPane((BWidget)bBorderPane));
}
private final BGridPane buildCommandPane(BGridPane bGridPane, Command[] commandArray) {
bGridPane.removeAll();
BButtonPane bButtonPane = new BButtonPane();
bGridPane.setColumnAlign(BHalign.center);
bGridPane.add("buttons0", (BValue)bButtonPane);
int n = 0;
while (n < commandArray.length) {
if (n > 0 && n % 4 == 0) {
bButtonPane = new BButtonPane();
bGridPane.add("buttons" + n, (BValue)bButtonPane);
}
bButtonPane.add(commandArray[n]);
++n;
}
return bGridPane;
}
private final BWidget left(BWidget bWidget) {
BGridPane bGridPane = new BGridPane(1);
bGridPane.setHalign(BHalign.left);
bGridPane.setColumnAlign(BHalign.left);
bGridPane.add(null, (BValue)bWidget);
return bGridPane;
}
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.tabbedPane = null;
this.mgr = null;
}
public BCertManagerView() {
this.this();
this.tabbedPane = new BTabbedPane();
this.caCertsButtons = new BGridPane(1);
this.serverCertsButtons = new BGridPane(1);
this.exemptionsButtons = new BGridPane(1);
this.caDescription = new BLabel(lex.getText("cacert.view.tab.description"), Theme.widget().getBoldText());
this.caCertsPane = new BEdgePane();
this.caCertsPane.setTop((BWidget)new BBorderPane(this.left((BWidget)this.caDescription)));
this.serverCertsDescription = new BLabel(lex.getText("cert.view.tab.description"), Theme.widget().getBoldText());
this.serverCertsPane = new BEdgePane();
this.serverCertsPane.setTop((BWidget)new BBorderPane(this.left((BWidget)this.serverCertsDescription)));
this.exemptionsDescription = new BLabel(lex.getText("exempt.view.tab.description"), Theme.widget().getBoldText());
this.exemptionsPane = new BEdgePane();
this.exemptionsPane.setTop((BWidget)new BBorderPane(this.left((BWidget)this.exemptionsDescription)));
BEdgePane bEdgePane = new BEdgePane();
this.titleLabel = new BLabel("", BHalign.left);
bEdgePane.setTop((BWidget)new BBorderPane((BWidget)this.titleLabel, 0.0, 0.0, 10.0, 0.0));
this.titleLabel.setFont(Theme.label().getLargeBoldFont());
bEdgePane.setCenter((BWidget)this.tabbedPane);
this.setContent((BWidget)new BBorderPane((BWidget)bEdgePane));
}
static {
Class clazz = class$com$tridium$platcrypto$ui$BCertManagerView;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$ui$BCertManagerView = BCertManagerView.class("[Lcom.tridium.platcrypto.ui.BCertManagerView;", false);
}
TYPE = Sys.loadType((Class)clazz);
lex = Lexicon.make((String)"platCrypto");
}
}
@@ -0,0 +1,201 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.cert.NX509Certificate
* com.tridium.ui.theme.custom.nss.StyleUtils
* javax.baja.gx.BImage
* 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.BLabel
* javax.baja.ui.BWidget
* javax.baja.ui.enums.BHalign
* javax.baja.ui.event.BWidgetEvent
* javax.baja.ui.event.BWindowEvent
* javax.baja.ui.pane.BBorderPane
* javax.baja.ui.pane.BEdgePane
* javax.baja.ui.pane.BGridPane
* javax.baja.ui.style.IStylable
* javax.baja.ui.util.UiLexicon
* javax.baja.ui.wizard.BWizardHeader
* javax.baja.util.Lexicon
* org.bouncycastle.asn1.x500.X500Name
* org.bouncycastle.asn1.x500.style.BCStyle
*/
package com.tridium.platcrypto.ui;
import com.tridium.crypto.core.cert.NX509Certificate;
import com.tridium.platcrypto.ui.BCertViewDialog;
import com.tridium.ui.theme.custom.nss.StyleUtils;
import java.security.cert.CertificateEncodingException;
import javax.baja.gx.BImage;
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.BLabel;
import javax.baja.ui.BWidget;
import javax.baja.ui.enums.BHalign;
import javax.baja.ui.event.BWidgetEvent;
import javax.baja.ui.event.BWindowEvent;
import javax.baja.ui.pane.BBorderPane;
import javax.baja.ui.pane.BEdgePane;
import javax.baja.ui.pane.BGridPane;
import javax.baja.ui.style.IStylable;
import javax.baja.ui.util.UiLexicon;
import javax.baja.ui.wizard.BWizardHeader;
import javax.baja.util.Lexicon;
import org.bouncycastle.asn1.x500.X500Name;
import org.bouncycastle.asn1.x500.style.BCStyle;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BCertRequestDialog
extends BCertViewDialog {
public static final Action cancelButtonPressed = BCertRequestDialog.newAction((int)0, (BValue)new BWidgetEvent(), null);
public static final Type TYPE;
static Lexicon lex;
static final BImage logo;
private BButton okButton;
protected BButton cancelButton;
protected boolean closeResult;
static /* synthetic */ Class class$com$tridium$platcrypto$ui$BCertRequestDialog;
public void cancelButtonPressed(BWidgetEvent bWidgetEvent) {
this.invoke(cancelButtonPressed, (BValue)bWidgetEvent, null);
}
public Type getType() {
return TYPE;
}
public static boolean request(BWidget bWidget, NX509Certificate nX509Certificate) throws Exception {
BCertRequestDialog bCertRequestDialog = new BCertRequestDialog(bWidget, nX509Certificate);
bCertRequestDialog.setBoundsCenteredOnOwner();
bCertRequestDialog.setResizable(false);
bCertRequestDialog.open();
return bCertRequestDialog.getResult();
}
protected BWidget buildHeader() {
return new BWizardHeader(logo, this.cert.getSubject(), lex.getText("csr.view.dialog.info", new Object[]{this.cert.getSubject()}));
}
protected BWidget buildContent() throws Exception {
BEdgePane bEdgePane = new BEdgePane();
String string = this.certCheck();
if (string != null && string.trim().length() > 0) {
bEdgePane.setTop(this.buildInfo(this.certCheck()));
}
bEdgePane.setCenter(super.buildContent());
return bEdgePane;
}
private final BWidget buildInfo(String string) {
BLabel bLabel = new BLabel(lex.getText("cert.request.dialog.warnings") + System.getProperty("line.separator") + string, BHalign.left);
StyleUtils.addStyleClass((IStylable)bLabel, (String)"warning");
return new BBorderPane((BWidget)bLabel, 0.0, 0.0, (double)5, 0.0);
}
private final String certCheck() throws CertificateEncodingException {
StringBuffer stringBuffer = new StringBuffer();
X500Name x500Name = this.cert.getSubjectDN();
if (x500Name.getRDNs(BCStyle.CN).length <= 0) {
stringBuffer.append(lex.getText("cert.request.dialog.common.name.warning")).append(System.getProperty("line.separator"));
}
if (x500Name.getRDNs(BCStyle.O).length <= 0) {
stringBuffer.append(lex.getText("cert.request.dialog.organisation.warning")).append(System.getProperty("line.separator"));
}
if (x500Name.getRDNs(BCStyle.L).length <= 0) {
stringBuffer.append(lex.getText("cert.request.dialog.city.warning")).append(System.getProperty("line.separator"));
}
if (x500Name.getRDNs(BCStyle.ST).length <= 0) {
stringBuffer.append(lex.getText("cert.request.dialog.state.warning")).append(System.getProperty("line.separator"));
}
if (x500Name.getRDNs(BCStyle.C).length <= 0) {
stringBuffer.append(lex.getText("cert.request.dialog.country.warning")).append(System.getProperty("line.separator"));
}
if (this.cert.getKeySize() < 2048) {
stringBuffer.append(lex.getText("cert.request.dialog.keysize.warning")).append(System.getProperty("line.separator"));
}
return stringBuffer.toString();
}
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("linkA", (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("linkB", (BComponent)this.cancelButton, (Slot)BButton.actionPerformed, (Slot)cancelButtonPressed);
this.cancelButton.setEnabled(true);
return new BBorderPane((BWidget)bGridPane, 7.0, 0.0, 0.0, 0.0);
}
public void windowClosing(BWindowEvent bWindowEvent) {
this.close();
}
public void doOkButtonPressed(BWidgetEvent bWidgetEvent) {
this.closeResult = true;
this.close();
}
public void doCancelButtonPressed(BWidgetEvent bWidgetEvent) {
this.closeResult = false;
this.close();
}
public boolean 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 = false;
}
private BCertRequestDialog(BWidget bWidget, NX509Certificate nX509Certificate) throws Exception {
super(bWidget, lex.getText("csr.view.dialog.title"));
this.this();
this.cert = nX509Certificate;
this.setContent(this.buildDialog());
this.setDefaultButton(this.okButton);
}
static {
Class clazz = class$com$tridium$platcrypto$ui$BCertRequestDialog;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$ui$BCertRequestDialog = BCertRequestDialog.class("[Lcom.tridium.platcrypto.ui.BCertRequestDialog;", false);
}
TYPE = Sys.loadType((Class)clazz);
lex = Lexicon.make((String)"platCrypto");
logo = BImage.make((String)lex.get("cert.x32.icon", "module://icons/x32/lock.png"));
}
}
@@ -0,0 +1,168 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.cert.NX509Certificate
* com.tridium.crypto.core.cert.NX509Extension
* javax.baja.gx.BImage
* javax.baja.gx.Size
* 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.BWidget
* javax.baja.ui.enums.BHalign
* javax.baja.ui.event.BWidgetEvent
* javax.baja.ui.event.BWindowEvent
* javax.baja.ui.pane.BBorderPane
* javax.baja.ui.pane.BConstrainedPane
* javax.baja.ui.pane.BGridPane
* javax.baja.ui.pane.BScrollPane
* javax.baja.ui.util.UiLexicon
* javax.baja.ui.wizard.BWizardHeader
* javax.baja.util.Lexicon
*/
package com.tridium.platcrypto.ui;
import com.tridium.crypto.core.cert.NX509Certificate;
import com.tridium.crypto.core.cert.NX509Extension;
import com.tridium.platcrypto.ui.BCryptoDialog;
import com.tridium.platcrypto.ui.BX509CertificatePane;
import com.tridium.platcrypto.ui.BX509ExtensionPane;
import javax.baja.gx.BImage;
import javax.baja.gx.Size;
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.BWidget;
import javax.baja.ui.enums.BHalign;
import javax.baja.ui.event.BWidgetEvent;
import javax.baja.ui.event.BWindowEvent;
import javax.baja.ui.pane.BBorderPane;
import javax.baja.ui.pane.BConstrainedPane;
import javax.baja.ui.pane.BGridPane;
import javax.baja.ui.pane.BScrollPane;
import javax.baja.ui.util.UiLexicon;
import javax.baja.ui.wizard.BWizardHeader;
import javax.baja.util.Lexicon;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BCertViewDialog
extends BCryptoDialog {
public static final Type TYPE;
protected static Lexicon lex;
protected static BImage logo;
protected NX509Certificate cert;
protected BButton okButton;
static /* synthetic */ Class class$com$tridium$platcrypto$ui$BCertViewDialog;
public Type getType() {
return TYPE;
}
public static void show(BWidget bWidget, NX509Certificate nX509Certificate) throws Exception {
BCertViewDialog bCertViewDialog = new BCertViewDialog(bWidget, nX509Certificate);
bCertViewDialog.setBoundsCenteredOnOwner();
bCertViewDialog.setResizable(false);
bCertViewDialog.open();
}
protected BWidget buildHeader() {
return new BWizardHeader(logo, this.cert.getSubject(), lex.getText("cert.view.dialog.info", new Object[]{this.cert.getSubject()}));
}
protected BWidget buildBody() throws Exception {
BGridPane bGridPane = new BGridPane(1);
bGridPane.setStyleClasses("scrolled");
bGridPane.setStretchColumn(0);
bGridPane.setColumnAlign(BHalign.fill);
bGridPane.add(null, (BValue)new BBorderPane(this.createHeaderLabel(lex.getText("cert.dialog.properties") + ':')));
bGridPane.add(null, (BValue)new BBorderPane(this.buildProperties(), 0.0, 0.0, 0.0, 0.0));
NX509Extension[] nX509ExtensionArray = this.cert.getExtensions();
if (nX509ExtensionArray.length > 0) {
bGridPane.add(null, (BValue)new BBorderPane(this.createHeaderLabel(lex.getText("cert.dialog.extensions") + ':')));
bGridPane.add(null, (BValue)new BBorderPane(this.buildExtensions(), 0.0, 0.0, 0.0, 0.0));
}
BScrollPane bScrollPane = new BScrollPane((BWidget)bGridPane);
Size size = this.getCertViewSize();
BConstrainedPane bConstrainedPane = new BConstrainedPane((BWidget)bScrollPane, size.width, size.height);
bConstrainedPane.setMinWidth(500.0);
return bConstrainedPane;
}
protected Size getCertViewSize() {
return new Size(600.0, 400.0);
}
protected BWidget buildProperties() {
BX509CertificatePane bX509CertificatePane = new BX509CertificatePane(this.cert);
return bX509CertificatePane;
}
protected BWidget buildExtensions() throws Exception {
BX509ExtensionPane bX509ExtensionPane = new BX509ExtensionPane();
bX509ExtensionPane.setExtensions(this.cert.getExtensions(), false);
return bX509ExtensionPane;
}
protected BWidget buildButtons() {
BGridPane bGridPane = new BGridPane(1);
bGridPane.setColumnAlign(BHalign.fill);
bGridPane.setUniformColumnWidth(true);
this.okButton = new BButton(UiLexicon.bajaui().getText("dialog.ok"));
bGridPane.add(null, (BValue)this.okButton);
this.linkTo("linkA", (BComponent)this.okButton, (Slot)BButton.actionPerformed, (Slot)okButtonPressed);
this.okButton.setEnabled(true);
return new BBorderPane((BWidget)bGridPane, 7.0, 0.0, 0.0, 0.0);
}
public void windowClosing(BWindowEvent bWindowEvent) {
this.close();
}
public void doOkButtonPressed(BWidgetEvent bWidgetEvent) {
this.close();
}
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());
}
}
protected BCertViewDialog(BWidget bWidget, String string) throws Exception {
super(bWidget, string);
}
protected BCertViewDialog(BWidget bWidget, NX509Certificate nX509Certificate) throws Exception {
this(bWidget, lex.getText("cert.view.dialog.title"));
this.cert = nX509Certificate;
this.setContent(this.buildDialog());
this.setDefaultButton(this.okButton);
}
static {
Class clazz = class$com$tridium$platcrypto$ui$BCertViewDialog;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$ui$BCertViewDialog = BCertViewDialog.class("[Lcom.tridium.platcrypto.ui.BCertViewDialog;", false);
}
TYPE = Sys.loadType((Class)clazz);
lex = Lexicon.make((String)"platCrypto");
logo = BImage.make((String)lex.get("cert.x32.icon", "module://icons/x32/lock.png"));
}
}
@@ -0,0 +1,513 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.cert.CertUtils
* com.tridium.crypto.core.cert.NPKCS10CertificationRequest
* com.tridium.crypto.core.cert.NSigningParameters
* com.tridium.crypto.core.cert.NX509Certificate
* com.tridium.crypto.core.cert.NX509CertificateEntry
* com.tridium.crypto.core.cert.NX509Extension
* com.tridium.crypto.core.util.FriendlyPemReader
* com.tridium.platform.ui.util.CommandUtil
* com.tridium.ui.theme.custom.nss.StyleUtils
* com.tridium.workbench.fieldeditors.BAbsTimeFE
* javax.baja.file.BAbstractFile
* javax.baja.file.FileUtil
* javax.baja.file.IFileFilter
* javax.baja.gx.BImage
* javax.baja.naming.BOrd
* javax.baja.security.crypto.CertManagerFactory
* javax.baja.security.crypto.ICryptoManagerEx
* javax.baja.security.crypto.IKeyStore
* javax.baja.sys.Action
* javax.baja.sys.BAbsTime
* javax.baja.sys.BComponent
* javax.baja.sys.BIcon
* javax.baja.sys.BValue
* javax.baja.sys.Clock
* javax.baja.sys.Slot
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BButton
* javax.baja.ui.BDialog
* javax.baja.ui.BLabel
* javax.baja.ui.BTextDropDown
* javax.baja.ui.BTextField
* javax.baja.ui.BWidget
* javax.baja.ui.Command
* javax.baja.ui.CommandArtifact
* javax.baja.ui.enums.BButtonStyle
* javax.baja.ui.enums.BHalign
* javax.baja.ui.event.BWidgetEvent
* javax.baja.ui.event.BWindowEvent
* javax.baja.ui.file.BFileChooser
* javax.baja.ui.file.ExtFileFilter
* javax.baja.ui.pane.BBorderPane
* javax.baja.ui.pane.BConstrainedPane
* javax.baja.ui.pane.BEdgePane
* javax.baja.ui.pane.BGridPane
* javax.baja.ui.pane.BScrollPane
* javax.baja.ui.style.IStylable
* javax.baja.ui.util.UiLexicon
* javax.baja.ui.wizard.BWizardHeader
* javax.baja.util.Lexicon
* org.bouncycastle.openssl.PEMParser
* org.bouncycastle.openssl.PEMWriter
* org.bouncycastle.pkcs.PKCS10CertificationRequest
* org.bouncycastle.pkcs.jcajce.JcaPKCS10CertificationRequest
*/
package com.tridium.platcrypto.ui;
import com.tridium.crypto.core.cert.CertUtils;
import com.tridium.crypto.core.cert.NPKCS10CertificationRequest;
import com.tridium.crypto.core.cert.NSigningParameters;
import com.tridium.crypto.core.cert.NX509Certificate;
import com.tridium.crypto.core.cert.NX509CertificateEntry;
import com.tridium.crypto.core.cert.NX509Extension;
import com.tridium.crypto.core.util.FriendlyPemReader;
import com.tridium.platcrypto.ui.BCertsTable;
import com.tridium.platcrypto.ui.BCryptoDialog;
import com.tridium.platcrypto.ui.BPasswordField;
import com.tridium.platcrypto.ui.BX509ExtensionPane;
import com.tridium.platform.ui.util.CommandUtil;
import com.tridium.ui.theme.custom.nss.StyleUtils;
import com.tridium.workbench.fieldeditors.BAbsTimeFE;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
import java.security.PrivateKey;
import java.security.UnrecoverableKeyException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Date;
import java.util.Enumeration;
import java.util.List;
import javax.baja.file.BAbstractFile;
import javax.baja.file.FileUtil;
import javax.baja.file.IFileFilter;
import javax.baja.gx.BImage;
import javax.baja.naming.BOrd;
import javax.baja.security.crypto.CertManagerFactory;
import javax.baja.security.crypto.ICryptoManagerEx;
import javax.baja.security.crypto.IKeyStore;
import javax.baja.sys.Action;
import javax.baja.sys.BAbsTime;
import javax.baja.sys.BComponent;
import javax.baja.sys.BIcon;
import javax.baja.sys.BValue;
import javax.baja.sys.Clock;
import javax.baja.sys.Slot;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BButton;
import javax.baja.ui.BDialog;
import javax.baja.ui.BLabel;
import javax.baja.ui.BTextDropDown;
import javax.baja.ui.BTextField;
import javax.baja.ui.BWidget;
import javax.baja.ui.Command;
import javax.baja.ui.CommandArtifact;
import javax.baja.ui.enums.BButtonStyle;
import javax.baja.ui.enums.BHalign;
import javax.baja.ui.event.BWidgetEvent;
import javax.baja.ui.event.BWindowEvent;
import javax.baja.ui.file.BFileChooser;
import javax.baja.ui.file.ExtFileFilter;
import javax.baja.ui.pane.BBorderPane;
import javax.baja.ui.pane.BConstrainedPane;
import javax.baja.ui.pane.BEdgePane;
import javax.baja.ui.pane.BGridPane;
import javax.baja.ui.pane.BScrollPane;
import javax.baja.ui.style.IStylable;
import javax.baja.ui.util.UiLexicon;
import javax.baja.ui.wizard.BWizardHeader;
import javax.baja.util.Lexicon;
import org.bouncycastle.openssl.PEMParser;
import org.bouncycastle.openssl.PEMWriter;
import org.bouncycastle.pkcs.PKCS10CertificationRequest;
import org.bouncycastle.pkcs.jcajce.JcaPKCS10CertificationRequest;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BCertificateSignerDialog
extends BCryptoDialog {
public static final Action cancelButtonPressed = BCertificateSignerDialog.newAction((int)0, (BValue)new BWidgetEvent(), null);
public static final Type TYPE;
static Lexicon lex;
static final BImage logo;
private static final BImage open;
ICryptoManagerEx mgr;
IKeyStore store;
private BTextField csrFileText;
BButton openBtn;
private BLabel subject;
private BLabel subjectDN;
private BLabel keyAlg;
private BLabel keySize;
private BLabel sigAlg;
private BLabel sigSize;
private BLabel verified;
BGridPane csrPane;
BEdgePane csrPropPane;
BEdgePane extensionsPane;
private BAbsTimeFE notBeforeFE;
private BAbsTimeFE notAfterFE;
private BX509ExtensionPane extensionPane;
private BTextDropDown ca;
private BPasswordField caPassword;
NPKCS10CertificationRequest csr;
String baseFileName;
private BAbsTime notBefore;
private BAbsTime notAfter;
private BButton okButton;
protected BButton cancelButton;
static /* synthetic */ Class class$com$tridium$platcrypto$ui$BCertificateSignerDialog;
public void cancelButtonPressed(BWidgetEvent bWidgetEvent) {
this.invoke(cancelButtonPressed, (BValue)bWidgetEvent, null);
}
public Type getType() {
return TYPE;
}
public static void show(BWidget bWidget) throws Exception {
BCertificateSignerDialog bCertificateSignerDialog = new BCertificateSignerDialog(bWidget);
bCertificateSignerDialog.setBoundsCenteredOnOwner();
bCertificateSignerDialog.setResizable(false);
bCertificateSignerDialog.open();
}
protected BWidget buildHeader() {
return new BWizardHeader(logo, lex.getText("cert.signer.dialog.title"), lex.getText("cert.signer.dialog.info"));
}
protected BWidget buildBody() {
BGridPane bGridPane = new BGridPane(1);
bGridPane.setStretchColumn(0);
bGridPane.setColumnAlign(BHalign.fill);
BEdgePane bEdgePane = new BEdgePane();
bEdgePane.setTop((BWidget)new BLabel(lex.getText("cert.signer.dialog.selectcsr") + ':', BHalign.left));
BGridPane bGridPane2 = new BGridPane(2);
this.csrFileText = new BTextField("", 60, false);
bGridPane2.add(null, (BValue)this.csrFileText);
this.openBtn = new BButton((Command)new OpenCsrCommand());
this.openBtn.setButtonStyle(BButtonStyle.toolBar);
bGridPane2.add(null, (BValue)this.openBtn);
bEdgePane.setCenter((BWidget)bGridPane2);
bGridPane.add(null, (BValue)bEdgePane);
this.csrPane = new BGridPane(1);
this.csrPane.setVisible(false);
this.csrPane.setStretchColumn(0);
this.csrPane.setColumnAlign(BHalign.fill);
this.csrPane.setRowGap(7.0);
this.csrPropPane = new BEdgePane();
BEdgePane bEdgePane2 = new BEdgePane();
bEdgePane2.setLeft((BWidget)new BLabel(lex.getText("cert.dialog.properties") + ':'));
this.csrPropPane.setTop((BWidget)bEdgePane2);
BGridPane bGridPane3 = new BGridPane(2);
bGridPane3.setStretchColumn(1);
bGridPane3.setColorRows(true);
StyleUtils.addStyleClass((IStylable)bGridPane3, (String)"scrolled");
bGridPane3.setColumnAlign(BHalign.left);
BCertificateSignerDialog.addPaddedLabelRow(bGridPane3, "cert.field.subject", this.subject);
BCertificateSignerDialog.addPaddedLabelRow(bGridPane3, "cert.field.subjectDn", this.subjectDN);
BCertificateSignerDialog.addPaddedLabelRow(bGridPane3, "cert.field.keyAlgorithm", this.keyAlg);
BCertificateSignerDialog.addPaddedLabelRow(bGridPane3, "cert.field.keySize", this.keySize);
BCertificateSignerDialog.addPaddedLabelRow(bGridPane3, "cert.field.signatureAlgorithm", this.sigAlg);
BCertificateSignerDialog.addPaddedLabelRow(bGridPane3, "cert.field.signatureSize", this.sigSize);
BCertificateSignerDialog.addPaddedLabelRow(bGridPane3, "cert.field.verify", this.verified);
BScrollPane bScrollPane = new BScrollPane((BWidget)bGridPane3);
BConstrainedPane bConstrainedPane = new BConstrainedPane((BWidget)bScrollPane, 500.0, 150.0);
this.csrPropPane.setCenter((BWidget)bConstrainedPane);
this.csrPane.add(null, (BValue)this.csrPropPane);
this.extensionsPane = new BEdgePane();
this.extensionsPane.setVisible(false);
BEdgePane bEdgePane3 = new BEdgePane();
bEdgePane3.setLeft((BWidget)new BLabel(lex.getText("cert.dialog.extensions") + ':'));
this.extensionsPane.setTop((BWidget)bEdgePane3);
this.extensionPane = new BX509ExtensionPane();
bScrollPane = new BScrollPane((BWidget)this.extensionPane);
BConstrainedPane bConstrainedPane2 = new BConstrainedPane((BWidget)bScrollPane, 500.0, 150.0);
this.extensionsPane.setCenter((BWidget)bConstrainedPane2);
this.csrPane.add(null, (BValue)this.extensionsPane);
bGridPane.add(null, (BValue)this.csrPane);
BEdgePane bEdgePane4 = new BEdgePane();
BGridPane bGridPane4 = new BGridPane(2);
bGridPane4.setRowGap(7.0);
this.notBeforeFE = new BAbsTimeFE(this.notBefore);
BCertificateSignerDialog.addLabelRow(bGridPane4, "cert.field.notBefore", (BValue)this.notBeforeFE);
this.notAfterFE = new BAbsTimeFE(this.notAfter);
BCertificateSignerDialog.addLabelRow(bGridPane4, "cert.field.notAfter", (BValue)this.notAfterFE);
this.ca = new BTextDropDown(this.getCaAliases(), 30, false);
BCertificateSignerDialog.addLabelRow(bGridPane4, "cert.signer.dialog.caalias", (BValue)this.ca);
this.caPassword = new BPasswordField("", 20);
BCertificateSignerDialog.addLabelRow(bGridPane4, "cert.signer.dialog.capassword", (BValue)this.caPassword);
bEdgePane4.setLeft((BWidget)bGridPane4);
bGridPane.add(null, (BValue)bEdgePane4);
bGridPane.setRowGap(7.0);
return bGridPane;
}
private static final void addLabelRow(BGridPane bGridPane, String string, BValue bValue) {
BCertificateSignerDialog.addRow(bGridPane, (BWidget)new BLabel(lex.getText(string) + ':'), bValue);
}
private static final void addPaddedLabelRow(BGridPane bGridPane, String string, BLabel bLabel) {
BCertificateSignerDialog.addRow(bGridPane, BCertificateSignerDialog.createPaddedLabel(lex.getText(string)), (BValue)BCertificateSignerDialog.createPaddedLabel(bLabel));
}
private static final void addRow(BGridPane bGridPane, BWidget bWidget, BValue bValue) {
bGridPane.add(null, (BValue)bWidget);
bGridPane.add(null, bValue);
}
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("linkA", (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("linkB", (BComponent)this.cancelButton, (Slot)BButton.actionPerformed, (Slot)cancelButtonPressed);
this.cancelButton.setEnabled(true);
return new BBorderPane((BWidget)bGridPane, 7.0, 0.0, 0.0, 0.0);
}
private final List getCaAliases() {
ArrayList<String> arrayList = new ArrayList<String>();
try {
Enumeration enumeration = this.store.aliases();
while (enumeration.hasMoreElements()) {
String string = (String)enumeration.nextElement();
if (!this.store.isKeyEntry(string)) continue;
X509Certificate x509Certificate = this.store.getCertificate(string);
if (x509Certificate != null && x509Certificate.getBasicConstraints() != -1) {
arrayList.add(string);
continue;
}
if (x509Certificate == null || x509Certificate.getKeyUsage() == null || !x509Certificate.getKeyUsage()[5]) continue;
arrayList.add(string);
}
}
catch (Exception exception) {
exception.printStackTrace();
}
return arrayList;
}
public void doOkButtonPressed(BWidgetEvent bWidgetEvent) {
try {
X509Certificate[] x509CertificateArray;
String string = this.ca.getText();
String string2 = this.caPassword.getText();
X509Certificate x509Certificate = this.store.getCertificate(string);
PrivateKey privateKey = (PrivateKey)this.store.getKey(string, string2.toCharArray());
NX509CertificateEntry nX509CertificateEntry = NX509CertificateEntry.make(null, (X509Certificate[])new X509Certificate[]{x509Certificate}, (PrivateKey)privateKey);
Date date = new Date(((BAbsTime)this.notBeforeFE.saveValue()).getMillis());
Date date2 = new Date(((BAbsTime)this.notAfterFE.saveValue()).getMillis());
NSigningParameters nSigningParameters = NSigningParameters.make((Date)date, (Date)date2);
int n = 0;
while (n < this.extensionPane.getExtensionCount()) {
if (this.extensionPane.isSelected(n)) {
x509CertificateArray = this.extensionPane.getExtension(n);
nSigningParameters.addExtension((NX509Extension)x509CertificateArray);
}
++n;
}
NX509Certificate nX509Certificate = CertUtils.signCertificate((NPKCS10CertificationRequest)this.csr, (NX509CertificateEntry)nX509CertificateEntry, (NSigningParameters)nSigningParameters);
x509CertificateArray = this.store.getCertificateChain(string);
NX509Certificate[] nX509CertificateArray = new NX509Certificate[x509CertificateArray.length + 1];
nX509CertificateArray[0] = nX509Certificate;
int n2 = 0;
while (n2 < x509CertificateArray.length) {
nX509CertificateArray[n2 + 1] = NX509Certificate.make((X509Certificate)x509CertificateArray[n2]);
++n2;
}
BFileChooser bFileChooser = BFileChooser.makeSave((BWidget)this.getOwner());
bFileChooser.addFilter((IFileFilter)new ExtFileFilter(lex.getText("cert.extension.info"), "pem,p12,crt,cer,cert"));
bFileChooser.setTitle(lex.getText("cert.signer.save.title"));
bFileChooser.setDefaultFileName(this.baseFileName + ".pem");
bFileChooser.setCurrentDirectory(BOrd.make((String)("file:/" + BCertsTable.getCertsDirectoryPath())));
BOrd bOrd = bFileChooser.show();
if (bOrd == null) {
return;
}
BAbstractFile bAbstractFile = (BAbstractFile)bOrd.get();
if (bAbstractFile != null) {
PEMWriter pEMWriter = new PEMWriter((Writer)new OutputStreamWriter(bAbstractFile.getOutputStream()));
int n3 = 0;
while (n3 < nX509CertificateArray.length) {
pEMWriter.writeObject((Object)nX509CertificateArray[n3].getCertificate());
++n3;
}
pEMWriter.close();
}
this.close();
}
catch (UnrecoverableKeyException unrecoverableKeyException) {
this.badPassword();
}
catch (Exception exception) {
exception.printStackTrace();
this.close();
}
}
private final void badPassword() {
this.caPassword.getModel().setText("");
BDialog.error((BWidget)this, (String)lex.getText("cert.signer.dialog.password.error.title"), (Object)lex.getText("cert.signer.dialog.password.error.message"));
}
public void doCancelButtonPressed(BWidgetEvent bWidgetEvent) {
this.close();
}
public void windowClosing(BWindowEvent bWindowEvent) {
this.close();
}
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.subject = new BLabel("");
this.subjectDN = new BLabel("");
this.keyAlg = new BLabel("");
this.keySize = new BLabel("");
this.sigAlg = new BLabel("");
this.sigSize = new BLabel("");
this.verified = new BLabel("");
this.baseFileName = null;
this.notBefore = BAbsTime.now();
this.notAfter = BAbsTime.make((long)(Clock.millis() + 63072000000L));
}
public BCertificateSignerDialog() throws UnsupportedOperationException {
this.this();
throw new UnsupportedOperationException();
}
public BCertificateSignerDialog(BWidget bWidget) throws Exception {
this(bWidget, lex.getText("cert.signer.dialog.title"));
}
public BCertificateSignerDialog(BWidget bWidget, String string) throws Exception {
super(bWidget, string);
this.this();
this.mgr = CertManagerFactory.getInstanceEx();
this.store = this.mgr.getKeyStore();
this.setContent(this.buildDialog());
this.setDefaultButton(this.okButton);
}
static {
Class clazz = class$com$tridium$platcrypto$ui$BCertificateSignerDialog;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$ui$BCertificateSignerDialog = BCertificateSignerDialog.class("[Lcom.tridium.platcrypto.ui.BCertificateSignerDialog;", false);
}
TYPE = Sys.loadType((Class)clazz);
lex = Lexicon.make((String)"platCrypto");
logo = BImage.make((String)lex.get("cert.green.x32.icon", "module://icons/x32/lock.png"));
open = BImage.make((BIcon)BIcon.std((String)"open.png"));
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
protected class OpenCsrCommand
extends Command {
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public CommandArtifact doInvoke() {
try {
BFileChooser bFileChooser = BFileChooser.makeOpen((BWidget)this.getOwner());
bFileChooser.addFilter((IFileFilter)new ExtFileFilter(lex.getText("csr.extension.info"), "csr"));
bFileChooser.setTitle(lex.getText("cert.signer.csr.select"));
bFileChooser.setCurrentDirectory(BOrd.make((String)("file:/" + BCertsTable.getCertsDirectoryPath())));
BOrd bOrd = bFileChooser.show();
if (bOrd == null) {
return null;
}
BAbstractFile bAbstractFile = (BAbstractFile)bOrd.get();
if (bAbstractFile == null) return null;
InputStreamReader inputStreamReader = new InputStreamReader(bAbstractFile.getInputStream());
FriendlyPemReader friendlyPemReader = new FriendlyPemReader((Reader)inputStreamReader);
PEMParser pEMParser = new PEMParser((Reader)friendlyPemReader);
try {
Object object = pEMParser.readObject();
if (object != null) {
if (object instanceof PKCS10CertificationRequest) {
PKCS10CertificationRequest pKCS10CertificationRequest = (PKCS10CertificationRequest)object;
JcaPKCS10CertificationRequest jcaPKCS10CertificationRequest = new JcaPKCS10CertificationRequest(pKCS10CertificationRequest.getEncoded());
BCertificateSignerDialog.this.csr = NPKCS10CertificationRequest.make((JcaPKCS10CertificationRequest)jcaPKCS10CertificationRequest);
BCertificateSignerDialog.this.csrFileText.setText(bAbstractFile.toPathString());
BCertificateSignerDialog.this.baseFileName = FileUtil.getBase((String)bAbstractFile.getFileName());
BCertificateSignerDialog.this.subject.setText(BCertificateSignerDialog.this.csr.getSubject());
BCertificateSignerDialog.this.subjectDN.setText(BCertificateSignerDialog.this.csr.getSubjectDN().toString());
BCertificateSignerDialog.this.keyAlg.setText(BCertificateSignerDialog.this.csr.getKeyAlgorithm());
BCertificateSignerDialog.this.keySize.setText("" + BCertificateSignerDialog.this.csr.getKeySize());
BCertificateSignerDialog.this.sigAlg.setText(BCertificateSignerDialog.this.csr.getSignatureAlgorithm());
BCertificateSignerDialog.this.sigSize.setText("" + BCertificateSignerDialog.this.csr.getSignatureSize());
BCertificateSignerDialog.this.verified.setText("" + BCertificateSignerDialog.this.csr.verify());
BCertificateSignerDialog.this.csrPane.setVisible(true);
BCertificateSignerDialog.this.extensionPane.setExtensions(BCertificateSignerDialog.this.csr.getExtensions(), true);
if (BCertificateSignerDialog.this.extensionPane.getExtensionCount() > 0) {
BCertificateSignerDialog.this.extensionsPane.setVisible(true);
} else {
BCertificateSignerDialog.this.extensionsPane.setVisible(false);
}
BCertificateSignerDialog.this.setBoundsCenteredOnOwner();
} else {
BDialog.warning((BWidget)this.getOwner(), (String)lex.getText("csr.selection.error.title"), (Object)lex.getText("csr.selection.error.msg", new Object[]{bAbstractFile.getFileName()}));
}
}
Object var8_13 = null;
}
catch (Throwable throwable) {
Object var8_12 = null;
try {
pEMParser.close();
throw throwable;
}
catch (Exception exception) {}
throw throwable;
}
try {}
catch (Exception exception) {
return null;
}
pEMParser.close();
return null;
}
catch (Exception exception) {
CommandUtil.error((Command)this, (Throwable)exception);
}
return null;
}
public OpenCsrCommand() {
super((BWidget)BCertificateSignerDialog.this, null, open, null, null);
}
}
}
@@ -0,0 +1,60 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BWidget
* javax.baja.ui.CommandArtifact
* javax.baja.workbench.BWbShell
* javax.baja.workbench.tool.BWbTool
*/
package com.tridium.platcrypto.ui;
import com.tridium.platcrypto.ui.BCertificateSignerDialog;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BWidget;
import javax.baja.ui.CommandArtifact;
import javax.baja.workbench.BWbShell;
import javax.baja.workbench.tool.BWbTool;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BCertificateSignerTool
extends BWbTool {
public static final Type TYPE;
static /* synthetic */ Class class$com$tridium$platcrypto$ui$BCertificateSignerTool;
public Type getType() {
return TYPE;
}
public CommandArtifact invoke(BWbShell bWbShell) throws Exception {
BCertificateSignerDialog.show((BWidget)bWbShell);
return null;
}
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());
}
}
static {
Class clazz = class$com$tridium$platcrypto$ui$BCertificateSignerTool;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$ui$BCertificateSignerTool = BCertificateSignerTool.class("[Lcom.tridium.platcrypto.ui.BCertificateSignerTool;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,705 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.cert.NX509CertificateEntry
* com.tridium.crypto.core.io.ICoreKeyStore
* com.tridium.crypto.core.util.FriendlyPemReader
* com.tridium.nre.util.PlatformUtil
* com.tridium.platform.ui.util.BCommandBoundTable
* com.tridium.platform.ui.util.CommandBindings$Support
* com.tridium.platform.ui.util.CommandUtil
* com.tridium.ui.theme.Theme
* javax.baja.file.BIFile
* javax.baja.file.IFileFilter
* javax.baja.gx.BImage
* javax.baja.log.Log
* javax.baja.naming.BOrd
* javax.baja.net.NotConnectedException
* javax.baja.nre.util.Array
* javax.baja.nre.util.IntHashMap
* javax.baja.nre.util.IntHashMap$Iterator
* javax.baja.nre.util.SortUtil
* javax.baja.sys.BValue
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BDialog
* javax.baja.ui.BLabel
* javax.baja.ui.BWidget
* javax.baja.ui.Command
* javax.baja.ui.CommandArtifact
* javax.baja.ui.file.BFileChooser
* javax.baja.ui.file.ExtFileFilter
* javax.baja.ui.pane.BGridPane
* javax.baja.ui.table.DynamicTableModel
* javax.baja.ui.table.TableModel
* javax.baja.util.Lexicon
* javax.baja.workbench.util.BNotifyPane
* org.bouncycastle.cert.X509CertificateHolder
* org.bouncycastle.cert.jcajce.JcaX509CertificateConverter
* org.bouncycastle.jce.provider.BouncyCastleProvider
* org.bouncycastle.openssl.EncryptionException
* org.bouncycastle.openssl.PEMDecryptorProvider
* org.bouncycastle.openssl.PEMEncryptedKeyPair
* org.bouncycastle.openssl.PEMKeyPair
* org.bouncycastle.openssl.PEMParser
* org.bouncycastle.openssl.PasswordException
* org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter
* org.bouncycastle.openssl.jcajce.JcePEMDecryptorProviderBuilder
*/
package com.tridium.platcrypto.ui;
import com.tridium.crypto.core.cert.NX509CertificateEntry;
import com.tridium.crypto.core.io.ICoreKeyStore;
import com.tridium.crypto.core.util.FriendlyPemReader;
import com.tridium.nre.util.PlatformUtil;
import com.tridium.platcrypto.ui.BCertEntryViewDialog;
import com.tridium.platcrypto.ui.BTrustCertsTable;
import com.tridium.platcrypto.ui.PrivateKeyPasswordFinder;
import com.tridium.platform.ui.util.BCommandBoundTable;
import com.tridium.platform.ui.util.CommandBindings;
import com.tridium.platform.ui.util.CommandUtil;
import com.tridium.ui.theme.Theme;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.security.KeyPair;
import java.security.PrivateKey;
import java.security.Provider;
import java.security.cert.X509Certificate;
import java.util.Enumeration;
import javax.baja.file.BIFile;
import javax.baja.file.IFileFilter;
import javax.baja.gx.BImage;
import javax.baja.log.Log;
import javax.baja.naming.BOrd;
import javax.baja.net.NotConnectedException;
import javax.baja.nre.util.Array;
import javax.baja.nre.util.IntHashMap;
import javax.baja.nre.util.SortUtil;
import javax.baja.sys.BValue;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BDialog;
import javax.baja.ui.BLabel;
import javax.baja.ui.BWidget;
import javax.baja.ui.Command;
import javax.baja.ui.CommandArtifact;
import javax.baja.ui.file.BFileChooser;
import javax.baja.ui.file.ExtFileFilter;
import javax.baja.ui.pane.BGridPane;
import javax.baja.ui.table.DynamicTableModel;
import javax.baja.ui.table.TableModel;
import javax.baja.util.Lexicon;
import javax.baja.workbench.util.BNotifyPane;
import org.bouncycastle.cert.X509CertificateHolder;
import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.openssl.EncryptionException;
import org.bouncycastle.openssl.PEMDecryptorProvider;
import org.bouncycastle.openssl.PEMEncryptedKeyPair;
import org.bouncycastle.openssl.PEMKeyPair;
import org.bouncycastle.openssl.PEMParser;
import org.bouncycastle.openssl.PasswordException;
import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter;
import org.bouncycastle.openssl.jcajce.JcePEMDecryptorProviderBuilder;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public abstract class BCertsTable
extends BCommandBoundTable
implements CommandBindings.Support {
public static final Type TYPE;
public static final int COL_ALIAS = 0;
public static final int COL_ISSUER = 1;
public static final int COL_SUBJECT = 2;
public static final int COL_NOT_BEFORE = 3;
public static final int COL_NOT_AFTER = 4;
public static final int COL_KEY_ALG = 5;
public static final int COL_KEY_SIZE = 6;
public static final int COL_SIG_ALG = 7;
public static final int COL_SIG_SIZE = 8;
public static final int COL_VALID = 9;
public static final int COL_SELF_SIGNED = 10;
protected static Log log;
public static final Lexicon lex;
public static final ExtFileFilter PEM_FILTER;
private static String certsDirectoryPath;
static final BImage securityHigh;
static final BImage securityMedium;
static final BImage securityLow;
static final BImage jobIcon;
static final BImage successIcon;
static final BImage failedIcon;
static final BImage unknownIcon;
protected IntHashMap certGenRequests;
protected CertGenMonitor certGenMonitor;
protected ICoreKeyStore mgr;
protected boolean readonly;
static /* synthetic */ Class class$com$tridium$platcrypto$ui$BCertsTable;
static /* synthetic */ Class class$java$security$cert$X509Certificate;
public Type getType() {
return TYPE;
}
public void load() throws Exception {
this.certModel().load();
}
private static final void initCertDirectory() {
File file = Sys.getBajaHome();
if (file.getPath().contains("wbapplet")) {
file = file.getParentFile().getParentFile();
}
file = new File(file, "certManagement");
file.mkdir();
certsDirectoryPath = file.toString().replace("\\", "/");
}
protected static String getCertsDirectoryPath() {
if (certsDirectoryPath == null) {
BCertsTable.initCertDirectory();
}
return certsDirectoryPath;
}
protected abstract void initCommands();
protected CertModel certModel() {
DynamicTableModel dynamicTableModel = (DynamicTableModel)this.getModel();
return (CertModel)dynamicTableModel.getRootModel();
}
public boolean isReadonly() {
return this.readonly;
}
public void setReadonly(boolean bl) {
this.readonly = bl;
this.setCommandEnabledStates();
}
public void setBoundCommandEnabled(Command command, boolean bl) {
if (this.readonly && (command instanceof ImportCommand || command instanceof DeleteCommand)) {
command.setEnabled(false);
} else {
command.setEnabled(bl);
}
}
protected synchronized void checkCertMonitorThread() {
if (this.certGenMonitor == null || !this.certGenMonitor.isAlive()) {
this.certGenMonitor = new CertGenMonitor();
this.certGenMonitor.start();
}
}
protected void notify(String string, BImage bImage, String string2, String string3) {
BLabel bLabel = new BLabel(jobIcon, string);
bLabel.setFont(Theme.widget().getBoldText());
BLabel bLabel2 = new BLabel(bImage, string2);
BLabel bLabel3 = new BLabel(string3);
bLabel3.setForeground(Theme.widget().getControlShadow());
BGridPane bGridPane = new BGridPane(1);
bGridPane.add(null, (BValue)bLabel);
bGridPane.add(null, (BValue)bLabel2);
bGridPane.add(null, (BValue)bLabel3);
BNotifyPane bNotifyPane = new BNotifyPane();
bNotifyPane.setCenter((BWidget)bGridPane);
bNotifyPane.open();
}
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.certGenRequests = new IntHashMap();
this.certGenMonitor = null;
this.mgr = null;
this.readonly = false;
}
public BCertsTable() throws UnsupportedOperationException {
this.this();
throw new UnsupportedOperationException();
}
public BCertsTable(ICoreKeyStore iCoreKeyStore) throws Exception {
int[] nArray = new int[6];
nArray[1] = 2;
nArray[2] = 4;
nArray[3] = 5;
nArray[4] = 6;
nArray[5] = 9;
super((TableModel)new DynamicTableModel((TableModel)new CertModel(iCoreKeyStore), nArray));
this.this();
this.mgr = iCoreKeyStore;
this.initCommands();
BCertsTable.initCertDirectory();
}
static {
Class clazz = class$com$tridium$platcrypto$ui$BCertsTable;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$ui$BCertsTable = BCertsTable.class("[Lcom.tridium.platcrypto.ui.BCertsTable;", false);
}
TYPE = Sys.loadType((Class)clazz);
log = Log.getLog((String)"crypto");
lex = Lexicon.make((String)"platCrypto");
PEM_FILTER = new ExtFileFilter("", "pem,crt,cer");
certsDirectoryPath = null;
securityHigh = BImage.make((String)lex.get("security.high.x16.icon", "module://icons/x16/security-high.png"));
securityMedium = BImage.make((String)lex.get("security.medium.x16.icon", "module://icons/x16/security-medium.png"));
securityLow = BImage.make((String)lex.get("security.low.x16.icon", "module://icons/x16/security-low.png"));
jobIcon = BImage.make((String)"module://icons/x16/doc.png");
successIcon = BImage.make((String)"module://icons/x16/job/success.png");
failedIcon = BImage.make((String)"module://icons/x16/job/failed.png");
unknownIcon = BImage.make((String)"module://icons/x16/job/unknown.png");
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
protected static class CertModel
extends TableModel {
protected Array certs;
protected ICoreKeyStore mgr;
static /* synthetic */ Class class$com$tridium$crypto$core$cert$NX509CertificateEntry;
public BImage getRowIcon(int n) {
if (this.getTable() instanceof BTrustCertsTable) {
return securityHigh;
}
try {
if (!this.cert(n).getCertificate(0).isSelfSigned()) {
return securityHigh;
}
return securityMedium;
}
catch (Exception exception) {
exception.printStackTrace();
return securityLow;
}
}
public void load() throws Exception {
Enumeration enumeration = this.mgr.getCertificates();
Class clazz = class$com$tridium$crypto$core$cert$NX509CertificateEntry;
if (clazz == null) {
clazz = class$com$tridium$crypto$core$cert$NX509CertificateEntry = CertModel.class("[Lcom.tridium.crypto.core.cert.NX509CertificateEntry;", false);
}
this.certs = new Array(clazz);
while (enumeration.hasMoreElements()) {
this.certs.add(enumeration.nextElement());
}
this.updateTable(true);
}
public int getColumnCount() {
return 11;
}
public String getColumnName(int n) {
switch (n) {
case 0: {
return lex.getText("cert.field.alias");
}
case 1: {
return lex.getText("cert.field.issuedBy");
}
case 2: {
return lex.getText("cert.field.subject");
}
case 3: {
return lex.getText("cert.field.notBefore");
}
case 4: {
return lex.getText("cert.field.notAfter");
}
case 5: {
return lex.getText("cert.field.keyAlgorithm");
}
case 6: {
return lex.getText("cert.field.keySize");
}
case 7: {
return lex.getText("cert.field.signatureAlgorithm");
}
case 8: {
return lex.getText("cert.field.signatureSize");
}
case 10: {
return lex.getText("cert.field.selfSigned");
}
case 9: {
return lex.getText("cert.field.valid");
}
}
throw new IndexOutOfBoundsException();
}
public boolean isColumnSortable(int n) {
return true;
}
public synchronized void sortByColumn(int n, boolean bl) {
Object[] objectArray = this.getColumnValues(n);
Object[] objectArray2 = this.certs.trim();
SortUtil.sort((Object[])objectArray, (Object[])objectArray2, (boolean)bl);
this.certs.clear();
this.certs.addAll(objectArray2);
}
public int getRowCount() {
int n = 0;
if (this.certs != null) {
n = this.certs.size();
}
return n;
}
public NX509CertificateEntry cert(int n) {
return (NX509CertificateEntry)this.certs.get(n);
}
public Object getValueAt(int n, int n2) {
switch (n2) {
case 0: {
return this.cert(n).getAlias();
}
case 1: {
return this.cert(n).getCertificate(0).getIssuer();
}
case 2: {
return this.cert(n).getCertificate(0).getSubject();
}
case 3: {
return this.cert(n).getCertificate(0).getNotBefore();
}
case 4: {
return this.cert(n).getCertificate(0).getNotAfter();
}
case 5: {
return this.cert(n).getCertificate(0).getKeyAlgorithm();
}
case 6: {
return "" + this.cert(n).getCertificate(0).getKeySize();
}
case 7: {
return this.cert(n).getCertificate(0).getSignatureAlgorithm();
}
case 8: {
return "" + this.cert(n).getCertificate(0).getSignatureSize();
}
case 10: {
return this.cert(n).getCertificate(0).isSelfSigned() ? lex.getText("cert.field.valid.true") : lex.getText("cert.field.valid.false");
}
case 9: {
return this.cert(n).getCertificate(0).checkValidity() ? lex.getText("cert.field.valid.true") : lex.getText("cert.field.valid.false");
}
}
throw new IndexOutOfBoundsException();
}
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());
}
}
public CertModel(ICoreKeyStore iCoreKeyStore) {
this.mgr = iCoreKeyStore;
}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
protected abstract class ImportCommand
extends Command {
/*
* WARNING - Removed try catching itself - possible behaviour change.
* WARNING - Removed back jump from a try to a catch block - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public CommandArtifact doInvoke() {
try {
BFileChooser bFileChooser = BFileChooser.makeOpen((BWidget)this.getOwner());
bFileChooser.setTitle(lex.getText("cert.import.chooser.title"));
bFileChooser.addFilter((IFileFilter)new ExtFileFilter(lex.getText("cert.extension.info"), "pem,p12,crt,cer,cert"));
bFileChooser.setCurrentDirectory(BOrd.make((String)("file:/" + certsDirectoryPath)));
BOrd bOrd = bFileChooser.show();
if (bOrd == null) {
return null;
}
BIFile bIFile = (BIFile)bOrd.get();
if (bIFile == null) return null;
Class clazz = class$java$security$cert$X509Certificate;
if (clazz == null) {
clazz = class$java$security$cert$X509Certificate = BCertsTable.class("[Ljava.security.cert.X509Certificate;", false);
}
Array array = new Array(clazz);
PrivateKey privateKey = null;
InputStreamReader inputStreamReader = new InputStreamReader(bIFile.getInputStream());
FriendlyPemReader friendlyPemReader = new FriendlyPemReader((Reader)inputStreamReader);
PEMParser pEMParser = new PEMParser((Reader)friendlyPemReader);
try {
try {
Object object = pEMParser.readObject();
while (object != null) {
X509Certificate x509Certificate;
if (object instanceof X509Certificate) {
array.add(object);
} else if (object instanceof X509CertificateHolder) {
x509Certificate = new JcaX509CertificateConverter().getCertificate((X509CertificateHolder)object);
array.add((Object)x509Certificate);
} else if (object instanceof PrivateKey) {
if (privateKey != null) throw new IOException("can't import multiple private keys from one file");
privateKey = (PrivateKey)object;
} else if (object instanceof KeyPair) {
if (privateKey != null) throw new IOException("can't import multiple private keys from one file");
privateKey = ((KeyPair)object).getPrivate();
} else if (object instanceof PEMKeyPair) {
if (privateKey != null) throw new IOException("can't import multiple private keys from one file");
privateKey = new JcaPEMKeyConverter().setProvider((Provider)new BouncyCastleProvider()).getPrivateKey(((PEMKeyPair)object).getPrivateKeyInfo());
} else {
if (!(object instanceof PEMEncryptedKeyPair)) throw new IOException("unsupported object type: " + object.getClass().getName());
if (privateKey != null) throw new IOException("can't import multiple private keys from one file");
x509Certificate = new JcePEMDecryptorProviderBuilder().setProvider((Provider)new BouncyCastleProvider());
PEMDecryptorProvider pEMDecryptorProvider = x509Certificate.build(new PrivateKeyPasswordFinder(this.getOwner()).getPassword());
JcaPEMKeyConverter jcaPEMKeyConverter = new JcaPEMKeyConverter().setProvider((Provider)new BouncyCastleProvider());
privateKey = jcaPEMKeyConverter.getPrivateKey(((PEMEncryptedKeyPair)object).decryptKeyPair(pEMDecryptorProvider).getPrivateKeyInfo());
}
object = pEMParser.readObject();
}
}
catch (PasswordException passwordException) {
BDialog.error((BWidget)this.getOwner(), (Object)lex.get("cert.import.privatekey.badpassword"));
CommandArtifact commandArtifact = null;
Object var10_17 = null;
try {
pEMParser.close();
return commandArtifact;
}
catch (Exception exception) {}
return commandArtifact;
}
}
catch (Throwable throwable) {
Object var10_18 = null;
try {}
catch (Exception exception) {}
pEMParser.close();
throw throwable;
throw throwable;
}
{
Object var10_19 = null;
}
try {}
catch (Exception exception) {}
pEMParser.close();
String string = bIFile.getFileName();
string = string.substring(0, string.length() - bIFile.getExtension().length() - 1);
this.importCertData(array, privateKey, string);
BCertsTable.this.mgr.save();
BCertsTable.this.certModel().load();
return null;
}
catch (EncryptionException encryptionException) {
BDialog.error((BWidget)this.getOwner(), (Object)lex.get("cert.import.privatekey.badpassword"));
return null;
}
catch (Exception exception) {
CommandUtil.error((Command)this, (Throwable)exception);
}
return null;
}
protected abstract void importCertData(Array var1, PrivateKey var2, String var3) throws Exception;
public ImportCommand() {
super((BWidget)BCertsTable.this, lex, "cert.button.import");
}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
protected class DeleteCommand
extends Command {
public CommandArtifact doInvoke() {
try {
if (4 == BDialog.confirm((BWidget)BCertsTable.this, (String)lex.getText("cert.delete.dialog.title"), (Object)lex.getText("cert.delete.dialog.info"), (int)12)) {
int[] nArray = BCertsTable.this.getSelection().getRows();
String[] stringArray = new String[nArray.length];
int n = 0;
while (n < nArray.length) {
stringArray[n] = BCertsTable.this.certModel().cert(nArray[n]).getAlias();
log.trace("request to delete alias " + stringArray[n]);
++n;
}
BCertsTable.this.mgr.deleteEntries(stringArray);
BCertsTable.this.mgr.save();
BCertsTable.this.certModel().load();
}
}
catch (Exception exception) {
CommandUtil.error((Command)this, (Throwable)exception);
}
return null;
}
public DeleteCommand() {
super((BWidget)BCertsTable.this, lex, "cert.button.delete");
}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
protected class CertGenMonitor
extends Thread {
public void run() {
do {
IntHashMap.Iterator iterator = BCertsTable.this.certGenRequests.iterator();
while (iterator.hasNext()) {
try {
CertGenRequest certGenRequest = (CertGenRequest)iterator.next();
int n = BCertsTable.this.mgr.getCertGenerationStatus(certGenRequest.requestId);
if (n == -1) {
BCertsTable.this.certGenRequests.remove(certGenRequest.requestId);
log.message("cert generation failed for " + certGenRequest.getAlias());
BCertsTable.this.notify(lex.get("cert.generate.title"), failedIcon, lex.get("cert.generate.failed"), lex.getText("cert.generate.failed.msg", (Object[])new String[]{certGenRequest.getAlias()}));
continue;
}
if (n == 2) {
BCertsTable.this.certGenRequests.remove(certGenRequest.requestId);
log.message("cert generation succeeded for " + certGenRequest.getAlias());
BCertsTable.this.notify(lex.get("cert.generate.title"), successIcon, lex.get("cert.generate.success"), lex.getText("cert.generate.success.msg", (Object[])new String[]{certGenRequest.getAlias()}));
BCertsTable.this.certModel().load();
continue;
}
long l = PlatformUtil.ticks();
if (l - certGenRequest.submitted <= 3600000L) continue;
BCertsTable.this.certModel().load();
}
catch (NotConnectedException notConnectedException) {
break;
}
catch (Exception exception) {
exception.printStackTrace();
}
}
try {
Thread.sleep(2500L);
}
catch (Exception exception) {}
} while (!BCertsTable.this.certGenRequests.isEmpty());
}
public CertGenMonitor() {
super("tCertGenMonitor");
}
}
static class CertGenRequest {
private int requestId;
private String alias;
private long submitted;
public int getRequestId() {
return this.requestId;
}
public String getAlias() {
return this.alias;
}
public CertGenRequest(int n, String string) {
this.requestId = n;
this.alias = string;
this.submitted = PlatformUtil.ticks();
}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
protected class ViewCommand
extends Command {
public CommandArtifact doInvoke() {
try {
int n = BCertsTable.this.certModel().getSelection().getRow();
BCertEntryViewDialog.show((BWidget)BCertsTable.this, BCertsTable.this.certModel().cert(n));
}
catch (Exception exception) {
CommandUtil.error((Command)this, (Throwable)exception);
}
return null;
}
public ViewCommand() {
super((BWidget)BCertsTable.this, lex, "cert.button.view");
}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
protected class ExportCommand
extends Command {
/*
* Exception decompiling
*/
public CommandArtifact doInvoke() {
/*
* This method has failed to decompile. When submitting a bug report, please provide this stack trace, and (if you hold appropriate legal rights) the relevant class file.
*
* org.benf.cfr.reader.util.ConfusedCFRException: Back jump on a try block [egrp 9[TRYBLOCK] [11 : 615->618)] java.lang.Throwable
* at org.benf.cfr.reader.bytecode.analysis.opgraph.Op02WithProcessedDataAndRefs.insertExceptionBlocks(Op02WithProcessedDataAndRefs.java:2283)
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisInner(CodeAnalyser.java:415)
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisOrWrapFail(CodeAnalyser.java:278)
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysis(CodeAnalyser.java:201)
* at org.benf.cfr.reader.entities.attributes.AttributeCode.analyse(AttributeCode.java:94)
* at org.benf.cfr.reader.entities.Method.analyse(Method.java:531)
* at org.benf.cfr.reader.entities.ClassFile.analyseMid(ClassFile.java:1055)
* at org.benf.cfr.reader.entities.ClassFile.analyseInnerClassesPass1(ClassFile.java:923)
* at org.benf.cfr.reader.entities.ClassFile.analyseMid(ClassFile.java:1035)
* at org.benf.cfr.reader.entities.ClassFile.analyseTop(ClassFile.java:942)
* at org.benf.cfr.reader.Driver.doJarVersionTypes(Driver.java:257)
* at org.benf.cfr.reader.Driver.doJar(Driver.java:139)
* at org.benf.cfr.reader.CfrDriverImpl.analyse(CfrDriverImpl.java:76)
* at org.benf.cfr.reader.Main.main(Main.java:54)
*/
throw new IllegalStateException("Decompilation failed");
}
public ExportCommand() {
super((BWidget)BCertsTable.this, lex, "cert.button.export");
}
}
}
@@ -0,0 +1,133 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.ui.theme.Theme
* javax.baja.gx.BImage
* javax.baja.sys.Action
* javax.baja.sys.BValue
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BDialog
* 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.style.IStylable
* javax.baja.util.Lexicon
*/
package com.tridium.platcrypto.ui;
import com.tridium.ui.theme.Theme;
import javax.baja.gx.BImage;
import javax.baja.sys.Action;
import javax.baja.sys.BValue;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BDialog;
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.style.IStylable;
import javax.baja.util.Lexicon;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public abstract class BCryptoDialog
extends BDialog {
public static final Action okButtonPressed = BCryptoDialog.newAction((int)0, (BValue)new BWidgetEvent(), null);
public static final Type TYPE;
static Lexicon lex;
static final BImage logo;
static /* synthetic */ Class class$com$tridium$platcrypto$ui$BCryptoDialog;
public void okButtonPressed(BWidgetEvent bWidgetEvent) {
this.invoke(okButtonPressed, (BValue)bWidgetEvent, null);
}
public Type getType() {
return TYPE;
}
protected static BWidget createPaddedLabel(String string) {
BLabel bLabel = new BLabel(string, BHalign.left);
BBorderPane bBorderPane = new BBorderPane((BWidget)bLabel, 0.0, (double)5, 0.0, 15.0);
return bBorderPane;
}
protected static BWidget createPaddedLabel(BLabel bLabel) {
bLabel.setHalign(BHalign.left);
BBorderPane bBorderPane = new BBorderPane((BWidget)bLabel, 0.0, (double)5, 0.0, 15.0);
return bBorderPane;
}
protected BWidget createHeaderLabel(String string) {
BLabel bLabel = new BLabel(string, BHalign.left);
bLabel.setFont(Theme.label().getLargeBoldFont((IStylable)bLabel));
return bLabel;
}
protected BWidget buildDialog() throws Exception {
BEdgePane bEdgePane = new BEdgePane();
bEdgePane.setTop(this.buildHeader());
bEdgePane.setCenter(this.buildContent());
return bEdgePane;
}
protected abstract BWidget buildHeader();
protected BWidget buildContent() throws Exception {
BGridPane bGridPane = new BGridPane(1);
bGridPane.setHalign(BHalign.left);
bGridPane.setColumnAlign(BHalign.fill);
bGridPane.add(null, (BValue)this.buildBody());
bGridPane.add(null, (BValue)this.buildButtons());
return new BBorderPane((BWidget)bGridPane, 7.0, 7.0, 7.0, 7.0);
}
protected abstract BWidget buildBody() throws Exception;
protected abstract BWidget buildButtons();
public abstract void doOkButtonPressed(BWidgetEvent var1);
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());
}
}
public BCryptoDialog() throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
protected BCryptoDialog(BWidget bWidget, String string) throws Exception {
super(bWidget, string, true);
}
static {
Class clazz = class$com$tridium$platcrypto$ui$BCryptoDialog;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$ui$BCryptoDialog = BCryptoDialog.class("[Lcom.tridium.platcrypto.ui.BCryptoDialog;", false);
}
TYPE = Sys.loadType((Class)clazz);
lex = Lexicon.make((String)"platCrypto");
logo = BImage.make((String)lex.get("cert.x32.icon", "module://icons/x32/lock.png"));
}
}
@@ -0,0 +1,192 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.cert.CertValidationResult
* com.tridium.crypto.core.cert.NHostExemption
* com.tridium.crypto.core.cert.NX509Certificate
* javax.baja.gx.BImage
* 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.BWidget
* javax.baja.ui.enums.BHalign
* javax.baja.ui.event.BWidgetEvent
* javax.baja.ui.event.BWindowEvent
* javax.baja.ui.pane.BBorderPane
* javax.baja.ui.pane.BEdgePane
* javax.baja.ui.pane.BGridPane
* javax.baja.ui.wizard.BWizardHeader
*/
package com.tridium.platcrypto.ui;
import com.tridium.crypto.core.cert.CertValidationResult;
import com.tridium.crypto.core.cert.NHostExemption;
import com.tridium.crypto.core.cert.NX509Certificate;
import com.tridium.platcrypto.ui.BCertViewDialog;
import com.tridium.platcrypto.ui.BX509CertificateChangedPane;
import com.tridium.platcrypto.ui.BX509ExtensionChangedPane;
import javax.baja.gx.BImage;
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.BWidget;
import javax.baja.ui.enums.BHalign;
import javax.baja.ui.event.BWidgetEvent;
import javax.baja.ui.event.BWindowEvent;
import javax.baja.ui.pane.BBorderPane;
import javax.baja.ui.pane.BEdgePane;
import javax.baja.ui.pane.BGridPane;
import javax.baja.ui.wizard.BWizardHeader;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BExemptionChangedDialog
extends BCertViewDialog {
public static final Action cancelButtonPressed = BExemptionChangedDialog.newAction((int)0, (BValue)new BWidgetEvent(), null);
public static final Type TYPE;
protected static BImage logo;
protected boolean hostNameMismatch;
protected boolean unknownIdentity;
protected NX509Certificate oldCert;
protected BButton cancelButton;
protected boolean closeResult;
static /* synthetic */ Class class$com$tridium$platcrypto$ui$BExemptionChangedDialog;
public void cancelButtonPressed(BWidgetEvent bWidgetEvent) {
this.invoke(cancelButtonPressed, (BValue)bWidgetEvent, null);
}
public Type getType() {
return TYPE;
}
public static boolean show(BWidget bWidget, CertValidationResult certValidationResult) throws Exception {
BExemptionChangedDialog bExemptionChangedDialog = new BExemptionChangedDialog(bWidget, certValidationResult);
bExemptionChangedDialog.setBoundsCenteredOnOwner();
bExemptionChangedDialog.setResizable(false);
bExemptionChangedDialog.open();
return bExemptionChangedDialog.getResult();
}
public static boolean show(BWidget bWidget, NHostExemption nHostExemption) throws Exception {
BExemptionChangedDialog bExemptionChangedDialog = new BExemptionChangedDialog(bWidget, nHostExemption);
bExemptionChangedDialog.setBoundsCenteredOnOwner();
bExemptionChangedDialog.setResizable(false);
bExemptionChangedDialog.open();
return bExemptionChangedDialog.getResult();
}
protected BWidget buildHeader() {
return new BWizardHeader(logo, this.oldCert.getSubject() + " / " + this.cert.getSubject(), lex.getText("exempt.changed.dialog.info", new Object[]{this.cert.getSubject()}));
}
protected BWidget buildContent() throws Exception {
BEdgePane bEdgePane = new BEdgePane();
bEdgePane.setCenter(super.buildContent());
return bEdgePane;
}
protected BWidget buildProperties() {
BX509CertificateChangedPane bX509CertificateChangedPane = new BX509CertificateChangedPane(this.oldCert, this.cert);
return bX509CertificateChangedPane;
}
protected BWidget buildExtensions() throws Exception {
BX509ExtensionChangedPane bX509ExtensionChangedPane = new BX509ExtensionChangedPane(this.oldCert.getExtensions(), this.cert.getExtensions());
return bX509ExtensionChangedPane;
}
protected BWidget buildButtons() {
BGridPane bGridPane = new BGridPane(2);
bGridPane.setColumnAlign(BHalign.fill);
bGridPane.setUniformColumnWidth(true);
this.okButton = new BButton(lex.getText("exempt.prompt.dialog.accept"));
bGridPane.add(null, (BValue)this.okButton);
this.linkTo("linkA", (BComponent)this.okButton, (Slot)BButton.actionPerformed, (Slot)okButtonPressed);
this.okButton.setEnabled(true);
this.cancelButton = new BButton(lex.getText("exempt.prompt.dialog.reject"));
bGridPane.add(null, (BValue)this.cancelButton);
this.linkTo("linkB", (BComponent)this.cancelButton, (Slot)BButton.actionPerformed, (Slot)cancelButtonPressed);
this.cancelButton.setEnabled(true);
return new BBorderPane((BWidget)bGridPane, 7.0, 0.0, 0.0, 0.0);
}
public void windowClosing(BWindowEvent bWindowEvent) {
this.close();
}
public void doOkButtonPressed(BWidgetEvent bWidgetEvent) {
this.closeResult = true;
this.close();
}
public void doCancelButtonPressed(BWidgetEvent bWidgetEvent) {
this.closeResult = false;
this.close();
}
public boolean 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.hostNameMismatch = false;
this.unknownIdentity = false;
this.closeResult = false;
}
private BExemptionChangedDialog(BWidget bWidget, CertValidationResult certValidationResult) throws Exception {
super(bWidget, lex.getText("exempt.changed.dialog.title"));
this.this();
this.oldCert = certValidationResult.getOrigCert();
this.cert = certValidationResult.getNewCert();
this.hostNameMismatch = certValidationResult.isHostnameVerified() ^ true;
this.unknownIdentity = certValidationResult.isValidCertChain() ^ true;
this.setContent(this.buildDialog());
this.setDefaultButton(this.okButton);
}
private BExemptionChangedDialog(BWidget bWidget, NHostExemption nHostExemption) throws Exception {
super(bWidget, lex.getText("exempt.changed.dialog.title"));
this.this();
this.oldCert = nHostExemption.getCertificate();
this.cert = nHostExemption.getChanged();
this.hostNameMismatch = false;
this.unknownIdentity = false;
this.setContent(this.buildDialog());
this.setDefaultButton(this.okButton);
}
static {
Class clazz = class$com$tridium$platcrypto$ui$BExemptionChangedDialog;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$ui$BExemptionChangedDialog = BExemptionChangedDialog.class("[Lcom.tridium.platcrypto.ui.BExemptionChangedDialog;", false);
}
TYPE = Sys.loadType((Class)clazz);
logo = BImage.make((String)lex.get("cert.warning.x32.icon", "module://icons/x32/warning.png"));
}
}
@@ -0,0 +1,182 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.cert.CertValidationResult
* com.tridium.ui.theme.custom.nss.StyleUtils
* javax.baja.gx.BImage
* 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.BLabel
* javax.baja.ui.BWidget
* javax.baja.ui.enums.BHalign
* javax.baja.ui.event.BWidgetEvent
* javax.baja.ui.event.BWindowEvent
* javax.baja.ui.pane.BBorderPane
* javax.baja.ui.pane.BEdgePane
* javax.baja.ui.pane.BGridPane
* javax.baja.ui.style.IStylable
* javax.baja.ui.wizard.BWizardHeader
*/
package com.tridium.platcrypto.ui;
import com.tridium.crypto.core.cert.CertValidationResult;
import com.tridium.platcrypto.ui.BCertViewDialog;
import com.tridium.ui.theme.custom.nss.StyleUtils;
import javax.baja.gx.BImage;
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.BLabel;
import javax.baja.ui.BWidget;
import javax.baja.ui.enums.BHalign;
import javax.baja.ui.event.BWidgetEvent;
import javax.baja.ui.event.BWindowEvent;
import javax.baja.ui.pane.BBorderPane;
import javax.baja.ui.pane.BEdgePane;
import javax.baja.ui.pane.BGridPane;
import javax.baja.ui.style.IStylable;
import javax.baja.ui.wizard.BWizardHeader;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BExemptionPromptDialog
extends BCertViewDialog {
public static final Action cancelButtonPressed = BExemptionPromptDialog.newAction((int)0, (BValue)new BWidgetEvent(), null);
public static final Type TYPE;
protected static BImage logo;
protected boolean hostNameMismatch;
protected boolean unknownIdentity;
protected boolean certExpired;
protected BButton cancelButton;
protected boolean closeResult;
static /* synthetic */ Class class$com$tridium$platcrypto$ui$BExemptionPromptDialog;
public void cancelButtonPressed(BWidgetEvent bWidgetEvent) {
this.invoke(cancelButtonPressed, (BValue)bWidgetEvent, null);
}
public Type getType() {
return TYPE;
}
public static boolean show(BWidget bWidget, CertValidationResult certValidationResult) throws Exception {
BExemptionPromptDialog bExemptionPromptDialog = new BExemptionPromptDialog(bWidget, certValidationResult);
bExemptionPromptDialog.setBoundsCenteredOnOwner();
bExemptionPromptDialog.setResizable(false);
bExemptionPromptDialog.open();
return bExemptionPromptDialog.getResult();
}
protected BWidget buildHeader() {
return new BWizardHeader(logo, this.cert.getSubject(), lex.getText("exempt.prompt.dialog.info", new Object[]{this.cert.getSubject()}));
}
protected BWidget buildContent() throws Exception {
BEdgePane bEdgePane = new BEdgePane();
bEdgePane.setTop(this.buildInfo());
bEdgePane.setCenter(super.buildContent());
return bEdgePane;
}
private final BWidget buildInfo() {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(lex.getText("exempt.prompt.dialog.msg.untrusted")).append(":").append("\n");
if (this.hostNameMismatch) {
stringBuffer.append("\n - ").append(lex.getText("exempt.prompt.dialog.msg.mismatch"));
}
if (this.unknownIdentity) {
stringBuffer.append("\n - ").append(lex.getText("exempt.prompt.dialog.msg.identity"));
}
if (this.certExpired) {
stringBuffer.append("\n - ").append(lex.getText("exempt.prompt.dialog.msg.expired"));
}
BLabel bLabel = new BLabel(stringBuffer.toString(), BHalign.left);
StyleUtils.addStyleClass((IStylable)bLabel, (String)"strong");
return new BBorderPane((BWidget)bLabel, 10.0, 10.0, (double)5, 10.0);
}
protected BWidget buildButtons() {
BGridPane bGridPane = new BGridPane(2);
bGridPane.setColumnAlign(BHalign.fill);
bGridPane.setUniformColumnWidth(true);
this.okButton = new BButton(lex.getText("exempt.prompt.dialog.accept"));
bGridPane.add(null, (BValue)this.okButton);
this.linkTo("linkA", (BComponent)this.okButton, (Slot)BButton.actionPerformed, (Slot)okButtonPressed);
this.okButton.setEnabled(true);
this.cancelButton = new BButton(lex.getText("exempt.prompt.dialog.reject"));
bGridPane.add(null, (BValue)this.cancelButton);
this.linkTo("linkB", (BComponent)this.cancelButton, (Slot)BButton.actionPerformed, (Slot)cancelButtonPressed);
this.cancelButton.setEnabled(true);
return new BBorderPane((BWidget)bGridPane, 7.0, 0.0, 0.0, 0.0);
}
public void windowClosing(BWindowEvent bWindowEvent) {
this.close();
}
public void doOkButtonPressed(BWidgetEvent bWidgetEvent) {
this.closeResult = true;
this.close();
}
public void doCancelButtonPressed(BWidgetEvent bWidgetEvent) {
this.closeResult = false;
this.close();
}
public boolean 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.hostNameMismatch = false;
this.unknownIdentity = false;
this.certExpired = false;
this.closeResult = false;
}
private BExemptionPromptDialog(BWidget bWidget, CertValidationResult certValidationResult) throws Exception {
super(bWidget, lex.getText("exempt.prompt.dialog.title"));
this.this();
this.cert = certValidationResult.getNewCert();
this.hostNameMismatch = certValidationResult.isHostnameVerified() ^ true;
this.unknownIdentity = certValidationResult.isValidCertChain() ^ true;
this.certExpired = certValidationResult.isCertExpired();
this.setContent(this.buildDialog());
this.setDefaultButton(this.okButton);
}
static {
Class clazz = class$com$tridium$platcrypto$ui$BExemptionPromptDialog;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$ui$BExemptionPromptDialog = BExemptionPromptDialog.class("[Lcom.tridium.platcrypto.ui.BExemptionPromptDialog;", false);
}
TYPE = Sys.loadType((Class)clazz);
logo = BImage.make((String)lex.get("cert.warning.x32.icon", "module://icons/x32/warning.png"));
}
}
@@ -0,0 +1,503 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.cert.NHostExemption
* com.tridium.crypto.core.io.ICoreExemptionStore
* com.tridium.platform.ui.util.BCommandBoundTable
* com.tridium.platform.ui.util.BCommandEnablePolicy
* com.tridium.platform.ui.util.CommandBindings$Support
* com.tridium.platform.ui.util.CommandBindings$TableSelection
* com.tridium.platform.ui.util.CommandUtil
* javax.baja.gx.BImage
* javax.baja.log.Log
* javax.baja.nre.util.Array
* javax.baja.nre.util.SortUtil
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BDialog
* javax.baja.ui.BWidget
* javax.baja.ui.Command
* javax.baja.ui.CommandArtifact
* javax.baja.ui.table.DynamicTableModel
* javax.baja.ui.table.TableModel
* javax.baja.util.Lexicon
*/
package com.tridium.platcrypto.ui;
import com.tridium.crypto.core.cert.NHostExemption;
import com.tridium.crypto.core.io.ICoreExemptionStore;
import com.tridium.platcrypto.ui.BExemptionChangedDialog;
import com.tridium.platcrypto.ui.BExemptionViewDialog;
import com.tridium.platform.ui.util.BCommandBoundTable;
import com.tridium.platform.ui.util.BCommandEnablePolicy;
import com.tridium.platform.ui.util.CommandBindings;
import com.tridium.platform.ui.util.CommandUtil;
import java.util.Enumeration;
import javax.baja.gx.BImage;
import javax.baja.log.Log;
import javax.baja.nre.util.Array;
import javax.baja.nre.util.SortUtil;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BDialog;
import javax.baja.ui.BWidget;
import javax.baja.ui.Command;
import javax.baja.ui.CommandArtifact;
import javax.baja.ui.table.DynamicTableModel;
import javax.baja.ui.table.TableModel;
import javax.baja.util.Lexicon;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BExemptionTable
extends BCommandBoundTable
implements CommandBindings.Support {
public static final Type TYPE;
public static final int COL_HOST = 0;
public static final int COL_SUBJECT = 1;
public static final int COL_STATUS = 2;
public static final int COL_CREATED = 3;
public static final int COL_ISSUER = 4;
public static final int COL_NOT_BEFORE = 5;
public static final int COL_NOT_AFTER = 6;
public static final int COL_KEY_ALG = 7;
public static final int COL_KEY_SIZE = 8;
public static final int COL_SIG_ALG = 9;
public static final int COL_SIG_SIZE = 10;
public static final int COL_VALID = 11;
protected static Log log;
public static final Lexicon lex;
static final BImage securityHigh;
static final BImage securityMedium;
static final BImage securityLow;
protected ICoreExemptionStore mgr;
protected boolean readonly;
static /* synthetic */ Class class$com$tridium$platcrypto$ui$BExemptionTable;
public Type getType() {
return TYPE;
}
public void load() throws Exception {
this.exemptModel().load();
}
protected void initCommands() {
this.getCommandBindings().setSupport((CommandBindings.Support)this);
ViewCommand viewCommand = new ViewCommand();
this.addCommand(viewCommand, BCommandEnablePolicy.singleSelection);
this.setDoubleClickCommand(viewCommand);
this.addCommand(new ApproveCommand(), BCommandEnablePolicy.anySelection);
this.addCommand(new UnapproveCommand(), BCommandEnablePolicy.anySelection);
this.addCommand(new DeleteCommand(), BCommandEnablePolicy.anySelection);
}
protected ExemptionModel exemptModel() {
DynamicTableModel dynamicTableModel = (DynamicTableModel)this.getModel();
return (ExemptionModel)dynamicTableModel.getRootModel();
}
public boolean isReadonly() {
return this.readonly;
}
public void setReadonly(boolean bl) {
this.readonly = bl;
this.setCommandEnabledStates();
}
public void setBoundCommandEnabled(Command command, boolean bl) {
if (this.readonly && (command instanceof ApproveCommand || command instanceof UnapproveCommand || command instanceof DeleteCommand)) {
command.setEnabled(false);
} else {
CommandBindings.TableSelection tableSelection = (CommandBindings.TableSelection)this.getSelection();
int[] nArray = tableSelection.getRows();
if (nArray.length > 0 && command instanceof ApprovalCommand) {
ApprovalCommand approvalCommand = (ApprovalCommand)command;
DynamicTableModel dynamicTableModel = (DynamicTableModel)this.getModel();
ExemptionModel exemptionModel = (ExemptionModel)dynamicTableModel.getRootModel();
boolean bl2 = true;
int n = 0;
while (n < nArray.length) {
NHostExemption nHostExemption = (NHostExemption)exemptionModel.exemptions.get(nArray[n]);
bl2 &= nHostExemption.getApproved();
++n;
}
command.setEnabled(approvalCommand.isApproved() ? bl2 ^ true : bl2);
} else {
command.setEnabled(bl);
}
}
}
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.mgr = null;
this.readonly = false;
}
public BExemptionTable() throws UnsupportedOperationException {
this.this();
throw new UnsupportedOperationException();
}
public BExemptionTable(ICoreExemptionStore iCoreExemptionStore) throws Exception {
int[] nArray = new int[7];
nArray[1] = 1;
nArray[2] = 2;
nArray[3] = 3;
nArray[4] = 4;
nArray[5] = 5;
nArray[6] = 6;
super((TableModel)new DynamicTableModel((TableModel)new ExemptionModel(iCoreExemptionStore), nArray));
this.this();
this.mgr = iCoreExemptionStore;
this.initCommands();
}
static {
Class clazz = class$com$tridium$platcrypto$ui$BExemptionTable;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$ui$BExemptionTable = BExemptionTable.class("[Lcom.tridium.platcrypto.ui.BExemptionTable;", false);
}
TYPE = Sys.loadType((Class)clazz);
log = Log.getLog((String)"crypto");
lex = Lexicon.make((String)"platCrypto");
securityHigh = BImage.make((String)lex.get("security.high.x16.icon", "module://icons/x16/security-high.png"));
securityMedium = BImage.make((String)lex.get("security.medium.x16.icon", "module://icons/x16/security-medium.png"));
securityLow = BImage.make((String)lex.get("security.low.x16.icon", "module://icons/x16/security-low.png"));
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
static class ExemptionModel
extends TableModel {
private Array exemptions;
private ICoreExemptionStore mgr;
static /* synthetic */ Class class$com$tridium$crypto$core$cert$NHostExemption;
public BImage getRowIcon(int n) {
if (!this.exemption(n).getApproved()) {
return securityLow;
}
if (this.exemption(n).getChanged() != null) {
return securityMedium;
}
return securityHigh;
}
public void load() throws Exception {
Enumeration enumeration = this.mgr.exemptions();
Class clazz = class$com$tridium$crypto$core$cert$NHostExemption;
if (clazz == null) {
clazz = class$com$tridium$crypto$core$cert$NHostExemption = ExemptionModel.class("[Lcom.tridium.crypto.core.cert.NHostExemption;", false);
}
this.exemptions = new Array(clazz);
while (enumeration.hasMoreElements()) {
this.exemptions.add(enumeration.nextElement());
}
this.updateTable(true);
this.getSelection().deselectAll();
}
public int getColumnCount() {
return 12;
}
public String getColumnName(int n) {
switch (n) {
case 0: {
return lex.getText("exempt.field.host");
}
case 2: {
return lex.getText("exempt.field.approved");
}
case 3: {
return lex.getText("exempt.field.created");
}
case 4: {
return lex.getText("cert.field.issuedBy");
}
case 1: {
return lex.getText("cert.field.subject");
}
case 5: {
return lex.getText("cert.field.notBefore");
}
case 6: {
return lex.getText("cert.field.notAfter");
}
case 7: {
return lex.getText("cert.field.keyAlgorithm");
}
case 8: {
return lex.getText("cert.field.keySize");
}
case 9: {
return lex.getText("cert.field.signatureAlgorithm");
}
case 10: {
return lex.getText("cert.field.signatureSize");
}
case 11: {
return lex.getText("cert.field.valid");
}
}
throw new IndexOutOfBoundsException();
}
public boolean isColumnSortable(int n) {
return true;
}
public void sortByColumn(int n, boolean bl) {
Object[] objectArray = this.getColumnValues(n);
Object[] objectArray2 = this.exemptions.trim();
SortUtil.sort((Object[])objectArray, (Object[])objectArray2, (boolean)bl);
this.exemptions.clear();
this.exemptions.addAll(objectArray2);
this.updateTable(false);
}
public int getRowCount() {
int n = 0;
if (this.exemptions != null) {
n = this.exemptions.size();
}
return n;
}
public NHostExemption exemption(int n) {
return (NHostExemption)this.exemptions.get(n);
}
public Object getValueAt(int n, int n2) {
switch (n2) {
case 0: {
return this.exemption(n).getHost();
}
case 2: {
return this.exemption(n).getApproved() ? lex.getText("exempt.field.approved.true") : lex.getText("exempt.field.approved.false");
}
case 3: {
return this.exemption(n).getCreated();
}
case 4: {
return this.exemption(n).getCertificate().getIssuer();
}
case 1: {
return this.exemption(n).getCertificate().getSubject();
}
case 5: {
return this.exemption(n).getCertificate().getNotBefore();
}
case 6: {
return this.exemption(n).getCertificate().getNotAfter();
}
case 7: {
return this.exemption(n).getCertificate().getKeyAlgorithm();
}
case 8: {
return "" + this.exemption(n).getCertificate().getKeySize();
}
case 9: {
return this.exemption(n).getCertificate().getSignatureAlgorithm();
}
case 10: {
return "" + this.exemption(n).getCertificate().getSignatureSize();
}
case 11: {
return this.exemption(n).getCertificate().checkValidity() ? lex.getText("cert.field.valid.true") : lex.getText("cert.field.valid.false");
}
}
throw new IndexOutOfBoundsException();
}
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.exemptions = null;
this.mgr = null;
}
public ExemptionModel(ICoreExemptionStore iCoreExemptionStore) {
this.this();
this.mgr = iCoreExemptionStore;
}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
protected class ViewCommand
extends Command {
public CommandArtifact doInvoke() {
try {
int n = BExemptionTable.this.exemptModel().getSelection().getRow();
NHostExemption nHostExemption = BExemptionTable.this.exemptModel().exemption(n);
if (nHostExemption.getChanged() != null) {
if (BExemptionChangedDialog.show((BWidget)BExemptionTable.this, nHostExemption)) {
nHostExemption.approveChanged();
BExemptionTable.this.mgr.setExemption(nHostExemption);
BExemptionTable.this.mgr.save();
}
} else {
BExemptionViewDialog.show((BWidget)BExemptionTable.this, nHostExemption);
}
}
catch (Exception exception) {
CommandUtil.error((Command)this, (Throwable)exception);
}
return null;
}
public ViewCommand() {
super((BWidget)BExemptionTable.this, lex, "exemption.button.view");
}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
protected class ApproveCommand
extends ApprovalCommand {
public String getTitle() {
return "exempt.approve.dialog.title";
}
public String getInfo() {
return "exempt.approve.dialog.info";
}
public boolean isApproved() {
return true;
}
public ApproveCommand() {
super((BWidget)BExemptionTable.this, lex, "exemption.button.approve");
}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
protected class UnapproveCommand
extends ApprovalCommand {
public String getTitle() {
return "exempt.unapprove.dialog.title";
}
public String getInfo() {
return "exempt.unapprove.dialog.info";
}
public boolean isApproved() {
return false;
}
public UnapproveCommand() {
super((BWidget)BExemptionTable.this, lex, "exemption.button.unapprove");
}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
protected class DeleteCommand
extends Command {
public CommandArtifact doInvoke() {
try {
if (4 == BDialog.confirm((BWidget)BExemptionTable.this, (String)lex.getText("exempt.delete.dialog.title"), (Object)lex.getText("exempt.delete.dialog.info"), (int)12)) {
int[] nArray = BExemptionTable.this.getSelection().getRows();
int n = 0;
while (n < nArray.length) {
String string = BExemptionTable.this.exemptModel().exemption(nArray[n]).getHost();
BExemptionTable.this.mgr.deleteExemption(string);
++n;
}
BExemptionTable.this.mgr.save();
BExemptionTable.this.exemptModel().load();
}
}
catch (Exception exception) {
CommandUtil.error((Command)this, (Throwable)exception);
}
return null;
}
public DeleteCommand() {
super((BWidget)BExemptionTable.this, lex, "exemption.button.delete");
}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
protected abstract class ApprovalCommand
extends Command {
public abstract String getTitle();
public abstract String getInfo();
public abstract boolean isApproved();
public CommandArtifact doInvoke() {
try {
if (4 == BDialog.confirm((BWidget)BExemptionTable.this, (String)lex.getText(this.getTitle()), (Object)lex.getText(this.getInfo()), (int)12)) {
int[] nArray = BExemptionTable.this.getSelection().getRows();
boolean bl = false;
int n = 0;
while (n < nArray.length) {
NHostExemption nHostExemption = BExemptionTable.this.exemptModel().exemption(nArray[n]);
boolean bl2 = this.isApproved();
if (bl2 != nHostExemption.getApproved()) {
nHostExemption.setApproved(bl2);
BExemptionTable.this.mgr.setExemption(nHostExemption);
bl = true;
}
++n;
}
if (bl) {
BExemptionTable.this.mgr.save();
}
BExemptionTable.this.exemptModel().load();
}
}
catch (Exception exception) {
CommandUtil.error((Command)this, (Throwable)exception);
}
return null;
}
public ApprovalCommand(BWidget bWidget, Lexicon lexicon, String string) {
super(bWidget, lexicon, string);
}
}
}
@@ -0,0 +1,89 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.cert.NHostExemption
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BWidget
* javax.baja.ui.pane.BGridPane
* javax.baja.ui.wizard.BWizardHeader
*/
package com.tridium.platcrypto.ui;
import com.tridium.crypto.core.cert.NHostExemption;
import com.tridium.platcrypto.ui.BCertViewDialog;
import com.tridium.platcrypto.ui.BX509CertificatePane;
import java.util.Properties;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BWidget;
import javax.baja.ui.pane.BGridPane;
import javax.baja.ui.wizard.BWizardHeader;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BExemptionViewDialog
extends BCertViewDialog {
public static final Type TYPE;
private NHostExemption hostExemption;
static /* synthetic */ Class class$com$tridium$platcrypto$ui$BExemptionViewDialog;
public Type getType() {
return TYPE;
}
public static void show(BWidget bWidget, NHostExemption nHostExemption) throws Exception {
BExemptionViewDialog bExemptionViewDialog = new BExemptionViewDialog(bWidget, nHostExemption);
bExemptionViewDialog.setBoundsCenteredOnOwner();
bExemptionViewDialog.setResizable(false);
bExemptionViewDialog.open();
}
protected BWidget buildHeader() {
return new BWizardHeader(logo, this.cert.getSubject(), lex.getText("exempt.view.dialog.info", new Object[]{this.cert.getSubject()}));
}
protected BWidget buildProperties() {
Properties properties = new Properties();
properties.setProperty("exempt.field.host", this.hostExemption.getHost());
properties.setProperty("exempt.field.approved", this.hostExemption.getApproved() ? lex.getText("exempt.field.approved.true") : lex.getText("exempt.field.approved.false"));
properties.setProperty("exempt.field.created", this.hostExemption.getCreated().toString());
BX509CertificatePane bX509CertificatePane = new BX509CertificatePane(this.cert, properties, null);
return bX509CertificatePane;
}
protected void appendProperties(BGridPane bGridPane) {
}
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());
}
}
protected BExemptionViewDialog(BWidget bWidget, NHostExemption nHostExemption) throws Exception {
super(bWidget, lex.getText("exempt.view.dialog.title"));
this.hostExemption = nHostExemption;
this.cert = nHostExemption.getCertificate();
this.setContent(this.buildDialog());
this.setDefaultButton(this.okButton);
}
static {
Class clazz = class$com$tridium$platcrypto$ui$BExemptionViewDialog;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$ui$BExemptionViewDialog = BExemptionViewDialog.class("[Lcom.tridium.platcrypto.ui.BExemptionViewDialog;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,124 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.security.BPassword
* javax.baja.sys.BStruct
* javax.baja.sys.BValue
* javax.baja.sys.Property
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platcrypto.ui;
import javax.baja.security.BPassword;
import javax.baja.sys.BStruct;
import javax.baja.sys.BValue;
import javax.baja.sys.Property;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BExportResponse
extends BStruct {
public static final Property exportCert = BExportResponse.newProperty((int)0, (boolean)true, null);
public static final Property exportPrivateKey = BExportResponse.newProperty((int)0, (boolean)false, null);
public static final Property privateKeyPassword = BExportResponse.newProperty((int)0, (BValue)BPassword.DEFAULT, null);
public static final Property encryptPrivateKey = BExportResponse.newProperty((int)0, (boolean)true, null);
public static final Property reusePassword = BExportResponse.newProperty((int)0, (boolean)true, null);
public static final Property privateKeySavedPassword = BExportResponse.newProperty((int)0, (BValue)BPassword.DEFAULT, null);
public static final Type TYPE;
static /* synthetic */ Class class$com$tridium$platcrypto$ui$BExportResponse;
public boolean getExportCert() {
return this.getBoolean(exportCert);
}
public void setExportCert(boolean bl) {
this.setBoolean(exportCert, bl, null);
}
public boolean getExportPrivateKey() {
return this.getBoolean(exportPrivateKey);
}
public void setExportPrivateKey(boolean bl) {
this.setBoolean(exportPrivateKey, bl, null);
}
public BPassword getPrivateKeyPassword() {
return (BPassword)this.get(privateKeyPassword);
}
public void setPrivateKeyPassword(BPassword bPassword) {
this.set(privateKeyPassword, (BValue)bPassword, null);
}
public boolean getEncryptPrivateKey() {
return this.getBoolean(encryptPrivateKey);
}
public void setEncryptPrivateKey(boolean bl) {
this.setBoolean(encryptPrivateKey, bl, null);
}
public boolean getReusePassword() {
return this.getBoolean(reusePassword);
}
public void setReusePassword(boolean bl) {
this.setBoolean(reusePassword, bl, null);
}
public BPassword getPrivateKeySavedPassword() {
return (BPassword)this.get(privateKeySavedPassword);
}
public void setPrivateKeySavedPassword(BPassword bPassword) {
this.set(privateKeySavedPassword, (BValue)bPassword, null);
}
public Type getType() {
return TYPE;
}
public static BExportResponse make(boolean bl, boolean bl2, BPassword bPassword, boolean bl3, boolean bl4, BPassword bPassword2) {
return new BExportResponse(bl, bl2, bPassword, bl3, bl4, bPassword2);
}
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());
}
}
public BExportResponse() {
}
private BExportResponse(boolean bl, boolean bl2, BPassword bPassword, boolean bl3, boolean bl4, BPassword bPassword2) {
this.setExportCert(bl);
this.setExportPrivateKey(bl2);
this.setPrivateKeyPassword(bPassword);
this.setEncryptPrivateKey(bl3);
this.setReusePassword(bl4);
this.setPrivateKeySavedPassword(bPassword2);
}
static {
Class clazz = class$com$tridium$platcrypto$ui$BExportResponse;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$ui$BExportResponse = BExportResponse.class("[Lcom.tridium.platcrypto.ui.BExportResponse;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,337 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.cert.NX509Certificate
* com.tridium.crypto.core.io.ICoreKeyStore
* com.tridium.platform.ui.util.BCommandEnablePolicy
* com.tridium.platform.ui.util.CommandBindings$Support
* com.tridium.platform.ui.util.CommandUtil
* javax.baja.file.BIFile
* javax.baja.file.IFileFilter
* javax.baja.gx.BImage
* javax.baja.naming.BOrd
* javax.baja.nre.util.Array
* javax.baja.security.BPassword
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BDialog
* javax.baja.ui.BLabel
* javax.baja.ui.BWidget
* javax.baja.ui.Command
* javax.baja.ui.CommandArtifact
* javax.baja.ui.file.BFileChooser
* javax.baja.ui.file.ExtFileFilter
* javax.baja.ui.pane.BConstrainedPane
* org.bouncycastle.jce.PKCS10CertificationRequest
* org.bouncycastle.openssl.PEMWriter
*/
package com.tridium.platcrypto.ui;
import com.tridium.crypto.core.cert.NX509Certificate;
import com.tridium.crypto.core.io.ICoreKeyStore;
import com.tridium.platcrypto.ui.BCertImportDialog;
import com.tridium.platcrypto.ui.BCertRequestDialog;
import com.tridium.platcrypto.ui.BCertsTable;
import com.tridium.platcrypto.ui.BPasswordPromptDialog;
import com.tridium.platcrypto.ui.BPrivateKeyPasswordDialog;
import com.tridium.platcrypto.ui.BSelfSignedDialog;
import com.tridium.platform.ui.util.BCommandEnablePolicy;
import com.tridium.platform.ui.util.CommandBindings;
import com.tridium.platform.ui.util.CommandUtil;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.security.Key;
import java.security.PrivateKey;
import java.security.UnrecoverableKeyException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Enumeration;
import javax.baja.file.BIFile;
import javax.baja.file.IFileFilter;
import javax.baja.gx.BImage;
import javax.baja.naming.BOrd;
import javax.baja.nre.util.Array;
import javax.baja.security.BPassword;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BDialog;
import javax.baja.ui.BLabel;
import javax.baja.ui.BWidget;
import javax.baja.ui.Command;
import javax.baja.ui.CommandArtifact;
import javax.baja.ui.file.BFileChooser;
import javax.baja.ui.file.ExtFileFilter;
import javax.baja.ui.pane.BConstrainedPane;
import org.bouncycastle.jce.PKCS10CertificationRequest;
import org.bouncycastle.openssl.PEMWriter;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BLocalCertsTable
extends BCertsTable {
public static final Type TYPE;
static /* synthetic */ Class class$com$tridium$platcrypto$ui$BLocalCertsTable;
public Type getType() {
return TYPE;
}
protected void initCommands() {
this.getCommandBindings().setSupport((CommandBindings.Support)this);
BCertsTable.ViewCommand viewCommand = new BCertsTable.ViewCommand();
this.addCommand(viewCommand, BCommandEnablePolicy.singleSelection);
this.setDoubleClickCommand(viewCommand);
this.addCommand(new NewCommand(), BCommandEnablePolicy.always);
this.addCommand(new CsrCommand(), BCommandEnablePolicy.singleSelection);
this.addCommand(new BCertsTable.DeleteCommand(), BCommandEnablePolicy.anySelection);
this.addCommand(new LocalImportCommand(), BCommandEnablePolicy.always);
this.addCommand(new BCertsTable.ExportCommand(), BCommandEnablePolicy.singleSelection);
this.addCommand(new ResetCommand(), BCommandEnablePolicy.always);
this.setCommandEnabledStates();
}
private final void certGenRequest(BWidget bWidget) {
BCertsTable.CertGenRequest certGenRequest = BSelfSignedDialog.show(bWidget, this.mgr);
if (certGenRequest != null) {
this.certGenRequests.put(certGenRequest.getRequestId(), (Object)certGenRequest);
this.checkCertMonitorThread();
BDialog.info((BWidget)bWidget, (Object)lex.get("cert.generate.notify.msg"));
}
}
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());
}
}
public BLocalCertsTable() throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
public BLocalCertsTable(ICoreKeyStore iCoreKeyStore) throws Exception {
super(iCoreKeyStore);
}
static {
Class clazz = class$com$tridium$platcrypto$ui$BLocalCertsTable;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$ui$BLocalCertsTable = BLocalCertsTable.class("[Lcom.tridium.platcrypto.ui.BLocalCertsTable;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
protected class NewCommand
extends Command {
public CommandArtifact doInvoke() {
if (!BLocalCertsTable.this.mgr.canGenerateCertificate()) {
BDialog.open((BWidget)BLocalCertsTable.this.getParentWidget(), (String)lex.getText("station.running.dialog.title"), (Object)lex.getText("station.running.dialog.message"), (int)1, (BImage)BDialog.WARNING_ICON, null);
} else {
BLocalCertsTable.this.certGenRequest(this.getOwner());
}
return null;
}
public NewCommand() {
super((BWidget)BLocalCertsTable.this, lex, "cert.button.new");
}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
protected class CsrCommand
extends Command {
public CommandArtifact doInvoke() {
block7: {
try {
BPassword bPassword;
PrivateKey privateKey;
int n = BLocalCertsTable.this.certModel().getSelection().getRow();
if (!BCertRequestDialog.request(this.getOwner(), BLocalCertsTable.this.certModel().cert(n).getCertificate(0))) break block7;
String string = BLocalCertsTable.this.certModel().cert(n).getAlias();
String string2 = null;
try {
privateKey = (PrivateKey)BLocalCertsTable.this.mgr.getKey(string, null);
}
catch (UnrecoverableKeyException unrecoverableKeyException) {
bPassword = BPasswordPromptDialog.open(this.getOwner(), lex.getText("cert.pkey.dialog.title"), lex.getText("cert.pkey.dialog.info"));
if (bPassword == null) {
return null;
}
string2 = bPassword.getValue();
}
privateKey = BLocalCertsTable.this.mgr.generateCSR(string, string2);
if (privateKey != null) {
bPassword = BFileChooser.makeSave((BWidget)this.getOwner());
bPassword.addFilter((IFileFilter)new ExtFileFilter(lex.getText("csr.extension.info"), "csr"));
bPassword.setTitle(lex.getText(lex.getText("csr.filechooser.dialog.title")));
bPassword.setDefaultFileName(string + ".csr");
bPassword.setCurrentDirectory(BOrd.make((String)("file:/" + BLocalCertsTable.getCertsDirectoryPath())));
BOrd bOrd = bPassword.show();
if (bOrd == null) {
return null;
}
BIFile bIFile = (BIFile)bOrd.get();
PEMWriter pEMWriter = new PEMWriter((Writer)new OutputStreamWriter(bIFile.getOutputStream()));
pEMWriter.writeObject((Object)new PKCS10CertificationRequest(privateKey.getRequest().getEncoded()));
pEMWriter.close();
BConstrainedPane bConstrainedPane = new BConstrainedPane((BWidget)new BLabel(lex.getText("csr.generate.complete")));
bConstrainedPane.setMinWidth(200.0);
BDialog.info((BWidget)this.getOwner(), (String)lex.getText("csr.extension.info"), (Object)bConstrainedPane);
}
}
catch (Exception exception) {
CommandUtil.error((Command)this, (Throwable)exception);
}
}
return null;
}
public CsrCommand() {
super((BWidget)BLocalCertsTable.this, lex, "cert.button.csr");
}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
protected class LocalImportCommand
extends BCertsTable.ImportCommand {
protected void importCertData(Array array, PrivateKey privateKey, String string) throws Exception {
X509Certificate[] x509CertificateArray = (X509Certificate[])array.trim();
if (x509CertificateArray.length <= 0) {
BDialog.warning((BWidget)this.getOwner(), (String)lex.get("cert.import.certificate.missing.title"), (Object)lex.get("cert.import.certificate.missing.msg"));
return;
}
NX509Certificate nX509Certificate = NX509Certificate.make((X509Certificate)x509CertificateArray[0]);
String string2 = BLocalCertsTable.this.mgr.findCertificate((X509Certificate)array.get(0));
if (string2 != null) {
string2 = BCertImportDialog.prompt(this.getOwner(), nX509Certificate, string2, true);
if (string2 == null) {
return;
}
if (nX509Certificate.getCertificate().getBasicConstraints() >= 0) {
BPassword bPassword = BPrivateKeyPasswordDialog.open(this.getOwner());
if (bPassword == null) {
return;
}
if (privateKey == null && (privateKey = (PrivateKey)BLocalCertsTable.this.mgr.getKey(string2, bPassword.getValue().toCharArray())) == null) {
BDialog.warning((BWidget)this.getOwner(), (String)lex.get("cert.import.privatekey.missing.title"), (Object)lex.get("cert.import.privatekey.missing.msg"));
return;
}
BLocalCertsTable.this.mgr.setKeyEntry(string2, (Key)privateKey, bPassword.getValue().toCharArray(), x509CertificateArray);
} else {
if (privateKey == null && (privateKey = (PrivateKey)BLocalCertsTable.this.mgr.getKey(string2, null)) == null) {
BDialog.warning((BWidget)this.getOwner(), (String)lex.get("cert.import.privatekey.missing.title"), (Object)lex.get("cert.import.privatekey.missing.msg"));
return;
}
BLocalCertsTable.this.mgr.setKeyEntry(string2, (Key)privateKey, null, x509CertificateArray);
}
} else {
string2 = BCertImportDialog.prompt(this.getOwner(), nX509Certificate, string, false);
if (string2 == null) {
return;
}
if (string2.trim().length() <= 0) {
BDialog.warning((BWidget)this.getOwner(), (String)lex.get("cert.import.alias.missing.title"), (Object)lex.get("cert.import.alias.missing.msg"));
return;
}
X509Certificate x509Certificate = BLocalCertsTable.this.mgr.getCertificate(string2);
if (x509Certificate != null && !x509Certificate.getPublicKey().equals(nX509Certificate.getPublicKey())) {
BDialog.warning((BWidget)this.getOwner(), (String)lex.get("cert.import.privatekey.mismatch.title"), (Object)lex.get("cert.import.privatekey.mismatch.msg"));
return;
}
if (nX509Certificate.getCertificate().getBasicConstraints() >= 0) {
BPassword bPassword = BPrivateKeyPasswordDialog.open(this.getOwner());
if (bPassword == null) {
return;
}
if (privateKey == null && (privateKey = (PrivateKey)BLocalCertsTable.this.mgr.getKey(string2, bPassword.getValue().toCharArray())) == null) {
BDialog.warning((BWidget)this.getOwner(), (String)lex.get("cert.import.privatekey.missing.title"), (Object)lex.get("cert.import.privatekey.missing.msg"));
return;
}
BLocalCertsTable.this.mgr.setKeyEntry(string2, (Key)privateKey, bPassword.getValue().toCharArray(), x509CertificateArray);
} else {
if (privateKey == null) {
try {
privateKey = (PrivateKey)BLocalCertsTable.this.mgr.getKey(string2, null);
}
catch (Exception exception) {}
if (privateKey == null) {
BDialog.warning((BWidget)this.getOwner(), (String)lex.get("cert.import.privatekey.missing.title"), (Object)lex.get("cert.import.privatekey.missing.msg"));
return;
}
}
BLocalCertsTable.this.mgr.setKeyEntry(string2, (Key)privateKey, null, x509CertificateArray);
}
}
}
protected LocalImportCommand() {
}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
protected class ResetCommand
extends Command {
public CommandArtifact doInvoke() {
try {
if (4 == BDialog.confirm((BWidget)BLocalCertsTable.this, (String)lex.getText("cert.reset.dialog.title"), (Object)lex.getText("cert.reset.dialog.info"), (int)12)) {
Enumeration enumeration = BLocalCertsTable.this.mgr.aliases();
ArrayList<String> arrayList = new ArrayList<String>();
while (enumeration.hasMoreElements()) {
arrayList.add((String)enumeration.nextElement());
}
BLocalCertsTable.this.mgr.deleteEntries(arrayList.toArray(new String[0]));
BLocalCertsTable.this.mgr.save();
BLocalCertsTable.this.certModel().load();
Calendar calendar = Calendar.getInstance();
Date date = calendar.getTime();
calendar.set(1, calendar.get(1) + 1);
Date date2 = calendar.getTime();
if (!BLocalCertsTable.this.mgr.canGenerateCertificate()) {
BDialog.open((BWidget)BLocalCertsTable.this.getParentWidget(), (String)lex.getText("station.running.dialog.title"), (Object)lex.getText("station.running.dialog.message"), (int)1, (BImage)BDialog.WARNING_ICON, null);
} else {
String string = "tridium";
int n = BLocalCertsTable.this.mgr.generateSelfSignedCert(string, "CN=NiagaraAX,O=Tridium,C=US", date, date2, 1024, 160, null, null);
if (n != -1) {
BCertsTable.CertGenRequest certGenRequest = new BCertsTable.CertGenRequest(n, string);
BLocalCertsTable.this.certGenRequests.put(n, (Object)certGenRequest);
BLocalCertsTable.this.checkCertMonitorThread();
BDialog.info((BWidget)this.getOwner(), (Object)lex.get("cert.generate.notify.msg"));
} else {
log.message("cert generation failed for " + string);
BLocalCertsTable.this.notify(lex.get("cert.generate.title"), failedIcon, lex.get("cert.generate.failed"), lex.getText("cert.generate.failed.msg", (Object[])new String[]{string}));
}
}
}
}
catch (Exception exception) {
CommandUtil.error((Command)this, (Throwable)exception);
}
return null;
}
public ResetCommand() {
super((BWidget)BLocalCertsTable.this, lex, "cert.button.reset");
}
}
}
@@ -0,0 +1,87 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.security.BPassword
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BTextField
* javax.baja.ui.text.PasswordRenderer
* javax.baja.ui.text.PasswordTextController
* javax.baja.ui.text.TextController
* javax.baja.ui.text.TextRenderer
*/
package com.tridium.platcrypto.ui;
import javax.baja.security.BPassword;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BTextField;
import javax.baja.ui.text.PasswordRenderer;
import javax.baja.ui.text.PasswordTextController;
import javax.baja.ui.text.TextController;
import javax.baja.ui.text.TextRenderer;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BPasswordField
extends BTextField {
public static final Type TYPE;
static /* synthetic */ Class class$com$tridium$platcrypto$ui$BPasswordField;
public Type getType() {
return TYPE;
}
public BPassword getPassword() {
return BPassword.make((String)this.getText());
}
private final void initPasswordField() {
this.setRenderer((TextRenderer)new PasswordRenderer());
this.setController((TextController)new PasswordTextController());
this.setAllowCopying(false);
}
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());
}
}
public BPasswordField(String string, int n, boolean bl) {
super(string, n, bl);
this.initPasswordField();
}
public BPasswordField(String string, int n) {
super(string, n);
this.initPasswordField();
}
public BPasswordField(String string) {
super(string);
this.initPasswordField();
}
public BPasswordField() {
this.initPasswordField();
}
static {
Class clazz = class$com$tridium$platcrypto$ui$BPasswordField;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$ui$BPasswordField = BPasswordField.class("[Lcom.tridium.platcrypto.ui.BPasswordField;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,189 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.gx.BImage
* 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.BDialog
* javax.baja.ui.BLabel
* javax.baja.ui.BWidget
* javax.baja.ui.enums.BHalign
* javax.baja.ui.event.BWidgetEvent
* javax.baja.ui.event.BWindowEvent
* 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
* javax.baja.util.Lexicon
*/
package com.tridium.platcrypto.ui;
import com.tridium.platcrypto.ui.BPasswordField;
import javax.baja.gx.BImage;
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.BDialog;
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.event.BWindowEvent;
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;
import javax.baja.util.Lexicon;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BPasswordPromptDialog
extends BDialog {
public static final Action okButtonPressed = BPasswordPromptDialog.newAction((int)0, (BValue)new BWidgetEvent(), null);
public static final Action cancelButtonPressed = BPasswordPromptDialog.newAction((int)0, (BValue)new BWidgetEvent(), null);
public static final Type TYPE;
private static Lexicon lex;
private static final BImage logo;
protected BButton okButton;
protected BButton cancelButton;
private BPasswordField passwordField;
private BPassword response;
private String msg;
static /* synthetic */ Class class$com$tridium$platcrypto$ui$BPasswordPromptDialog;
public void okButtonPressed(BWidgetEvent bWidgetEvent) {
this.invoke(okButtonPressed, (BValue)bWidgetEvent, null);
}
public void cancelButtonPressed(BWidgetEvent bWidgetEvent) {
this.invoke(cancelButtonPressed, (BValue)bWidgetEvent, null);
}
public Type getType() {
return TYPE;
}
public static BPassword open(BWidget bWidget, String string, String string2) {
BPasswordPromptDialog bPasswordPromptDialog = new BPasswordPromptDialog(bWidget, string, string2);
bPasswordPromptDialog.setBoundsCenteredOnOwner();
bPasswordPromptDialog.setResizable(false);
bPasswordPromptDialog.open();
return bPasswordPromptDialog.getPassword();
}
private final BWidget buildDialog() {
BEdgePane bEdgePane = new BEdgePane();
bEdgePane.setTop(this.buildHeader());
bEdgePane.setCenter(this.buildContent());
return bEdgePane;
}
private final BWidget buildHeader() {
return new BWizardHeader(logo, this.getTitle(), this.msg);
}
private final BWidget buildContent() {
BGridPane bGridPane = new BGridPane(1);
bGridPane.setHalign(BHalign.center);
bGridPane.setColumnAlign(BHalign.center);
bGridPane.add(null, (BValue)this.buildBody());
bGridPane.add(null, (BValue)this.buildButtons());
return new BBorderPane((BWidget)bGridPane, 17.0, 7.0, 7.0, 7.0);
}
private final BWidget buildBody() {
BEdgePane bEdgePane = new BEdgePane();
bEdgePane.setLeft((BWidget)new BLabel(lex.get("password.field.password")));
this.passwordField = new BPasswordField();
bEdgePane.setCenter((BWidget)new BBorderPane((BWidget)this.passwordField, (double)4, (double)4, (double)4, (double)4));
return bEdgePane;
}
private final 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.okButton.setPreferredSize(50.0, this.okButton.getPreferredHeight());
this.linkTo("linkA", (BComponent)this.okButton, (Slot)BButton.actionPerformed, (Slot)okButtonPressed);
this.okButton.setEnabled(false);
this.cancelButton = new BButton(UiLexicon.bajaui().getText("dialog.cancel"));
bGridPane.add(null, (BValue)this.cancelButton);
this.cancelButton.setPreferredSize(50.0, this.cancelButton.getPreferredHeight());
this.linkTo("linkC", (BComponent)this.cancelButton, (Slot)BButton.actionPerformed, (Slot)cancelButtonPressed);
return new BBorderPane((BWidget)bGridPane, 7.0, 0.0, 0.0, 0.0);
}
public void windowClosing(BWindowEvent bWindowEvent) {
this.close();
}
public BPassword getPassword() {
return this.response;
}
public void doOkButtonPressed(BWidgetEvent bWidgetEvent) throws Exception {
this.response = this.passwordField.getPassword();
this.close();
}
public void doCancelButtonPressed(BWidgetEvent bWidgetEvent) throws Exception {
this.response = null;
this.close();
}
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.passwordField = null;
this.response = null;
this.msg = null;
}
private BPasswordPromptDialog(BWidget bWidget, String string, String string2) {
super(bWidget, string, true);
this.this();
this.msg = string2;
this.setContent(this.buildDialog());
this.setDefaultButton(this.okButton);
this.okButton.setEnabled(true);
}
static {
Class clazz = class$com$tridium$platcrypto$ui$BPasswordPromptDialog;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$ui$BPasswordPromptDialog = BPasswordPromptDialog.class("[Lcom.tridium.platcrypto.ui.BPasswordPromptDialog;", false);
}
TYPE = Sys.loadType((Class)clazz);
lex = Lexicon.make((String)"platCrypto");
logo = BImage.make((String)lex.get("cert.x32.icon", "module://icons/x32/lock.png"));
}
}
@@ -0,0 +1,194 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.cert.NKey
* com.tridium.crypto.core.cert.NPKCS10CertificationRequest
* com.tridium.crypto.core.cert.NX509Certificate
* com.tridium.crypto.core.util.FriendlyPemReader
* javax.baja.gx.BImage
* javax.baja.sys.BObject
* javax.baja.sys.Context
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BWidget
* javax.baja.ui.pane.BTextEditorPane
* javax.baja.ui.text.BTextEditor
* javax.baja.ui.wizard.BWizardHeader
* javax.baja.util.Lexicon
* javax.baja.workbench.CannotSaveException
* javax.baja.workbench.view.BWbView
* org.bouncycastle.cert.X509CertificateHolder
* org.bouncycastle.cert.jcajce.JcaX509CertificateConverter
* org.bouncycastle.jce.provider.BouncyCastleProvider
* org.bouncycastle.openssl.PEMDecryptorProvider
* org.bouncycastle.openssl.PEMEncryptedKeyPair
* org.bouncycastle.openssl.PEMKeyPair
* org.bouncycastle.openssl.PEMParser
* org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter
* org.bouncycastle.openssl.jcajce.JcePEMDecryptorProviderBuilder
* org.bouncycastle.pkcs.PKCS10CertificationRequest
* org.bouncycastle.pkcs.jcajce.JcaPKCS10CertificationRequest
*/
package com.tridium.platcrypto.ui;
import com.tridium.crypto.core.cert.NKey;
import com.tridium.crypto.core.cert.NPKCS10CertificationRequest;
import com.tridium.crypto.core.cert.NX509Certificate;
import com.tridium.crypto.core.util.FriendlyPemReader;
import com.tridium.platcrypto.ui.PrivateKeyPasswordFinder;
import com.tridium.platcrypto.util.BPemFile;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.security.Key;
import java.security.KeyPair;
import java.security.Provider;
import java.security.cert.Certificate;
import java.security.cert.X509Certificate;
import javax.baja.gx.BImage;
import javax.baja.sys.BObject;
import javax.baja.sys.Context;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BWidget;
import javax.baja.ui.pane.BTextEditorPane;
import javax.baja.ui.text.BTextEditor;
import javax.baja.ui.wizard.BWizardHeader;
import javax.baja.util.Lexicon;
import javax.baja.workbench.CannotSaveException;
import javax.baja.workbench.view.BWbView;
import org.bouncycastle.cert.X509CertificateHolder;
import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.openssl.PEMDecryptorProvider;
import org.bouncycastle.openssl.PEMEncryptedKeyPair;
import org.bouncycastle.openssl.PEMKeyPair;
import org.bouncycastle.openssl.PEMParser;
import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter;
import org.bouncycastle.openssl.jcajce.JcePEMDecryptorProviderBuilder;
import org.bouncycastle.pkcs.PKCS10CertificationRequest;
import org.bouncycastle.pkcs.jcajce.JcaPKCS10CertificationRequest;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BPemFileView
extends BWbView {
public static final Type TYPE;
protected static Lexicon lex;
protected static BImage logo;
public BTextEditorPane pane;
public BTextEditor editor;
static /* synthetic */ Class class$com$tridium$platcrypto$ui$BPemFileView;
public Type getType() {
return TYPE;
}
protected BWidget buildHeader() {
return new BWizardHeader(logo, lex.getText("pem.file.viewer.title"));
}
protected void doLoadValue(BObject bObject, Context context) throws Exception {
super.doLoadValue(bObject, context);
StringBuffer stringBuffer = new StringBuffer();
BPemFile bPemFile = (BPemFile)bObject;
InputStream inputStream = bPemFile.getInputStream();
InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
FriendlyPemReader friendlyPemReader = new FriendlyPemReader((Reader)inputStreamReader);
PEMParser pEMParser = new PEMParser((Reader)friendlyPemReader);
int n = 0;
while (n < 50) {
try {
NPKCS10CertificationRequest nPKCS10CertificationRequest;
Object object;
Object object2 = pEMParser.readObject();
if (object2 == null) break;
if (object2 instanceof X509Certificate) {
object = NX509Certificate.make((X509Certificate)((X509Certificate)object2));
stringBuffer.append(object.toString());
} else if (object2 instanceof X509CertificateHolder) {
object = new JcaX509CertificateConverter().getCertificate((X509CertificateHolder)object2);
stringBuffer.append(((Certificate)object).toString());
} else if (object2 instanceof PKCS10CertificationRequest) {
object = new JcaPKCS10CertificationRequest(((PKCS10CertificationRequest)object2).getEncoded());
nPKCS10CertificationRequest = NPKCS10CertificationRequest.make((JcaPKCS10CertificationRequest)object);
stringBuffer.append(nPKCS10CertificationRequest.toString());
} else if (object2 instanceof Key) {
stringBuffer.append(NKey.toString((Key)((Key)object2)));
} else if (object2 instanceof KeyPair) {
object = (KeyPair)object2;
stringBuffer.append(NKey.toString((Key)((KeyPair)object).getPrivate()));
stringBuffer.append(NKey.toString((Key)((KeyPair)object).getPublic()));
} else if (object2 instanceof PEMKeyPair) {
object = (PEMKeyPair)object2;
nPKCS10CertificationRequest = new JcaPEMKeyConverter().setProvider((Provider)new BouncyCastleProvider());
stringBuffer.append(NKey.toString((Key)nPKCS10CertificationRequest.getPrivateKey(object.getPrivateKeyInfo())));
stringBuffer.append(NKey.toString((Key)nPKCS10CertificationRequest.getPublicKey(object.getPublicKeyInfo())));
} else if (object2 instanceof PEMEncryptedKeyPair) {
object = new JcePEMDecryptorProviderBuilder().setProvider((Provider)new BouncyCastleProvider());
nPKCS10CertificationRequest = object.build(new PrivateKeyPasswordFinder((BWidget)this).getPassword());
JcaPEMKeyConverter jcaPEMKeyConverter = new JcaPEMKeyConverter().setProvider((Provider)new BouncyCastleProvider());
PEMKeyPair pEMKeyPair = ((PEMEncryptedKeyPair)object2).decryptKeyPair((PEMDecryptorProvider)nPKCS10CertificationRequest);
stringBuffer.append(NKey.toString((Key)jcaPEMKeyConverter.getPrivateKey(pEMKeyPair.getPrivateKeyInfo())));
stringBuffer.append(NKey.toString((Key)jcaPEMKeyConverter.getPublicKey(pEMKeyPair.getPublicKeyInfo())));
} else {
stringBuffer.append("unrecognized object: " + object2.getClass().getName() + '\n');
stringBuffer.append(object2.toString());
}
stringBuffer.append("\n");
}
catch (Exception exception) {
++n;
stringBuffer.append("error parsing object: " + exception.getLocalizedMessage()).append("\n");
}
}
try {
if (pEMParser != null) {
pEMParser.close();
}
}
catch (Exception exception) {}
this.editor.setEditable(false);
this.editor.setText(stringBuffer.toString());
}
protected BObject doSaveValue(BObject bObject, Context context) throws CannotSaveException, Exception {
return super.doSaveValue(bObject, context);
}
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.pane = new BTextEditorPane("", 80, 40, true);
this.editor = this.pane.getEditor();
}
public BPemFileView() {
this.this();
this.setContent((BWidget)this.pane);
}
static {
Class clazz = class$com$tridium$platcrypto$ui$BPemFileView;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$ui$BPemFileView = BPemFileView.class("[Lcom.tridium.platcrypto.ui.BPemFileView;", false);
}
TYPE = Sys.loadType((Class)clazz);
lex = Lexicon.make((String)"platCrypto");
logo = BImage.make((String)lex.get("cert.x32.icon", "module://crypto/icons/x32/cert.png"));
}
}
@@ -0,0 +1,213 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.gx.BImage
* 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.BDialog
* javax.baja.ui.BLabel
* javax.baja.ui.BWidget
* javax.baja.ui.enums.BHalign
* javax.baja.ui.event.BWidgetEvent
* javax.baja.ui.event.BWindowEvent
* 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
* javax.baja.util.Lexicon
*/
package com.tridium.platcrypto.ui;
import com.tridium.platcrypto.ui.BPasswordField;
import javax.baja.gx.BImage;
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.BDialog;
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.event.BWindowEvent;
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;
import javax.baja.util.Lexicon;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BPrivateKeyPasswordDialog
extends BDialog {
public static final Action okButtonPressed = BPrivateKeyPasswordDialog.newAction((int)0, (BValue)new BWidgetEvent(), null);
public static final Action cancelButtonPressed = BPrivateKeyPasswordDialog.newAction((int)0, (BValue)new BWidgetEvent(), null);
public static final Action setModified = BPrivateKeyPasswordDialog.newAction((int)0, (BValue)new BWidgetEvent(), null);
public static final Type TYPE;
private static Lexicon lex;
private static final BImage logo;
protected BButton okButton;
protected BButton cancelButton;
private BPassword password;
private BPasswordField passwordField;
private BPasswordField confirmField;
static /* synthetic */ Class class$com$tridium$platcrypto$ui$BPrivateKeyPasswordDialog;
public void okButtonPressed(BWidgetEvent bWidgetEvent) {
this.invoke(okButtonPressed, (BValue)bWidgetEvent, null);
}
public void cancelButtonPressed(BWidgetEvent bWidgetEvent) {
this.invoke(cancelButtonPressed, (BValue)bWidgetEvent, null);
}
public void setModified(BWidgetEvent bWidgetEvent) {
this.invoke(setModified, (BValue)bWidgetEvent, null);
}
public Type getType() {
return TYPE;
}
public static BPassword open(BWidget bWidget) {
BPrivateKeyPasswordDialog bPrivateKeyPasswordDialog = new BPrivateKeyPasswordDialog(bWidget);
bPrivateKeyPasswordDialog.setBoundsCenteredOnOwner();
bPrivateKeyPasswordDialog.setResizable(false);
bPrivateKeyPasswordDialog.open();
return bPrivateKeyPasswordDialog.getPassword();
}
private final BWidget buildDialog() {
BEdgePane bEdgePane = new BEdgePane();
bEdgePane.setTop(this.buildHeader());
bEdgePane.setCenter(this.buildContent());
return bEdgePane;
}
private final BWidget buildHeader() {
return new BWizardHeader(logo, this.getTitle(), lex.get("cert.export.privatekey.title"));
}
private final BWidget buildContent() {
BGridPane bGridPane = new BGridPane(1);
bGridPane.setHalign(BHalign.center);
bGridPane.setColumnAlign(BHalign.center);
bGridPane.add(null, (BValue)new BLabel(lex.get("cert.export.password.prompt"), BHalign.left));
bGridPane.add(null, (BValue)this.buildBody());
bGridPane.add(null, (BValue)this.buildButtons());
return new BBorderPane((BWidget)bGridPane, 7.0, 7.0, 7.0, 7.0);
}
private final BWidget buildBody() {
BGridPane bGridPane = new BGridPane(2);
bGridPane.setRowGap((double)5);
bGridPane.setColumnGap((double)5);
bGridPane.setColumnAlign(BHalign.left);
bGridPane.setStretchColumn(1);
bGridPane.add(null, (BValue)new BLabel(lex.get("password.field.password")));
this.passwordField = new BPasswordField();
bGridPane.add(null, (BValue)this.passwordField);
bGridPane.add(null, (BValue)new BLabel(lex.get("password.field.confirm")));
this.confirmField = new BPasswordField();
bGridPane.add(null, (BValue)this.confirmField);
this.linkTo(null, (BComponent)this.passwordField, (Slot)BPasswordField.textModified, (Slot)setModified);
this.linkTo(null, (BComponent)this.confirmField, (Slot)BPasswordField.textModified, (Slot)setModified);
return bGridPane;
}
private final BWidget buildButtons() {
BGridPane bGridPane = new BGridPane(3);
bGridPane.setColumnAlign(BHalign.fill);
bGridPane.setUniformColumnWidth(true);
this.okButton = new BButton(UiLexicon.bajaui().getText("dialog.ok"));
bGridPane.add(null, (BValue)this.okButton);
this.linkTo("linkA", (BComponent)this.okButton, (Slot)BButton.actionPerformed, (Slot)okButtonPressed);
this.okButton.setEnabled(false);
this.cancelButton = new BButton(UiLexicon.bajaui().getText("dialog.cancel"));
bGridPane.add(null, (BValue)this.cancelButton);
this.linkTo("linkC", (BComponent)this.cancelButton, (Slot)BButton.actionPerformed, (Slot)cancelButtonPressed);
return new BBorderPane((BWidget)bGridPane, 7.0, 0.0, 0.0, 0.0);
}
public void windowClosing(BWindowEvent bWindowEvent) {
this.close();
}
public BPassword getPassword() {
return this.password;
}
public void doOkButtonPressed(BWidgetEvent bWidgetEvent) throws Exception {
this.password = BPassword.make((String)this.confirmField.getText());
this.close();
}
public void doCancelButtonPressed(BWidgetEvent bWidgetEvent) {
this.close();
}
public void doSetModified(BWidgetEvent bWidgetEvent) {
try {
if (this.passwordField.getText().equals(this.confirmField.getText())) {
this.okButton.setEnabled(true);
} else {
this.okButton.setEnabled(false);
}
}
catch (Exception exception) {
exception.printStackTrace();
}
}
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.password = null;
this.passwordField = null;
this.confirmField = null;
}
private BPrivateKeyPasswordDialog(BWidget bWidget) {
super(bWidget, "Private Key Password", true);
this.this();
this.setContent(this.buildDialog());
this.setDefaultButton(this.okButton);
this.okButton.setEnabled(true);
}
static {
Class clazz = class$com$tridium$platcrypto$ui$BPrivateKeyPasswordDialog;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$ui$BPrivateKeyPasswordDialog = BPrivateKeyPasswordDialog.class("[Lcom.tridium.platcrypto.ui.BPrivateKeyPasswordDialog;", false);
}
TYPE = Sys.loadType((Class)clazz);
lex = Lexicon.make((String)"platCrypto");
logo = BImage.make((String)lex.get("cert.x32.icon", "module://icons/x32/lock.png"));
}
}
@@ -0,0 +1,440 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.io.ICoreKeyStore
* com.tridium.workbench.fieldeditors.BAbsTimeFE
* javax.baja.gx.BImage
* javax.baja.security.BPassword
* javax.baja.sys.Action
* javax.baja.sys.BAbsTime
* javax.baja.sys.BComponent
* javax.baja.sys.BObject
* javax.baja.sys.BRelTime
* javax.baja.sys.BValue
* javax.baja.sys.Clock
* javax.baja.sys.Slot
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BButton
* javax.baja.ui.BDialog
* javax.baja.ui.BLabel
* javax.baja.ui.BRadioButton
* javax.baja.ui.BTextField
* javax.baja.ui.BWidget
* javax.baja.ui.ToggleCommandGroup
* javax.baja.ui.enums.BHalign
* javax.baja.ui.event.BWidgetEvent
* javax.baja.ui.event.BWindowEvent
* 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
* javax.baja.util.Lexicon
*/
package com.tridium.platcrypto.ui;
import com.tridium.crypto.core.io.ICoreKeyStore;
import com.tridium.platcrypto.ui.BCertsTable;
import com.tridium.platcrypto.ui.BPrivateKeyPasswordDialog;
import com.tridium.workbench.fieldeditors.BAbsTimeFE;
import java.security.cert.X509Certificate;
import java.util.Date;
import java.util.Locale;
import javax.baja.gx.BImage;
import javax.baja.security.BPassword;
import javax.baja.sys.Action;
import javax.baja.sys.BAbsTime;
import javax.baja.sys.BComponent;
import javax.baja.sys.BObject;
import javax.baja.sys.BRelTime;
import javax.baja.sys.BValue;
import javax.baja.sys.Clock;
import javax.baja.sys.Slot;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BButton;
import javax.baja.ui.BDialog;
import javax.baja.ui.BLabel;
import javax.baja.ui.BRadioButton;
import javax.baja.ui.BTextField;
import javax.baja.ui.BWidget;
import javax.baja.ui.ToggleCommandGroup;
import javax.baja.ui.enums.BHalign;
import javax.baja.ui.event.BWidgetEvent;
import javax.baja.ui.event.BWindowEvent;
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;
import javax.baja.util.Lexicon;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BSelfSignedDialog
extends BDialog {
public static final Action okButtonPressed = BSelfSignedDialog.newAction((int)0, (BValue)new BWidgetEvent(), null);
public static final Action cancelButtonPressed = BSelfSignedDialog.newAction((int)0, (BValue)new BWidgetEvent(), null);
public static final Action setModified = BSelfSignedDialog.newAction((int)0, (BValue)new BWidgetEvent(), null);
public static final Type TYPE;
private static Lexicon lex;
private static final BImage logo;
private BTextField alias;
private BTextField cn;
private BTextField ou;
private BTextField o;
private BTextField l;
private BTextField st;
private BTextField c;
private BAbsTimeFE starts;
private BAbsTimeFE ends;
private BRadioButton keySize1024;
private BRadioButton keySize2048;
private BRadioButton keySize3072;
private BRadioButton keySize4096;
private BRadioButton serverCert;
private BRadioButton caCert;
private BTextField emailAltName;
private BPassword pkPassword;
private BButton okButton;
private BButton cancelButton;
private ICoreKeyStore mgr;
private int keySize;
private int keyUsage;
private boolean canceled;
static /* synthetic */ Class class$com$tridium$platcrypto$ui$BSelfSignedDialog;
public void okButtonPressed(BWidgetEvent bWidgetEvent) {
this.invoke(okButtonPressed, (BValue)bWidgetEvent, null);
}
public void cancelButtonPressed(BWidgetEvent bWidgetEvent) {
this.invoke(cancelButtonPressed, (BValue)bWidgetEvent, null);
}
public void setModified(BWidgetEvent bWidgetEvent) {
this.invoke(setModified, (BValue)bWidgetEvent, null);
}
public Type getType() {
return TYPE;
}
public static BCertsTable.CertGenRequest show(BWidget bWidget, ICoreKeyStore iCoreKeyStore) {
BSelfSignedDialog bSelfSignedDialog = new BSelfSignedDialog(bWidget, iCoreKeyStore);
bSelfSignedDialog.setBoundsCenteredOnOwner();
bSelfSignedDialog.setResizable(false);
bSelfSignedDialog.open();
return bSelfSignedDialog.getResult();
}
private final BWidget buildDialog() {
BEdgePane bEdgePane = new BEdgePane();
bEdgePane.setTop(this.buildHeader());
bEdgePane.setCenter(this.buildContent());
return bEdgePane;
}
private final BWidget buildHeader() {
return new BWizardHeader(logo, this.getTitle(), lex.getText("cert.generate.dialog.info"));
}
private final BWidget buildContent() {
BGridPane bGridPane = new BGridPane(1);
bGridPane.setHalign(BHalign.center);
bGridPane.setColumnAlign(BHalign.center);
bGridPane.add(null, (BValue)this.buildBody());
bGridPane.add(null, (BValue)this.buildButtons());
return new BBorderPane((BWidget)bGridPane, 7.0, 7.0, 7.0, 7.0);
}
private final BWidget buildDnTextField(BTextField bTextField, boolean bl) {
BGridPane bGridPane = new BGridPane(2);
bGridPane.setStretchColumn(0);
bGridPane.setColumnAlign(BHalign.fill);
bGridPane.add(null, (BValue)bTextField);
if (bl) {
bGridPane.add(null, (BValue)new BLabel(lex.getText("cert.field.required")));
} else {
bGridPane.add(null, (BValue)new BLabel());
}
return bGridPane;
}
private final BWidget buildBody() {
BGridPane bGridPane = new BGridPane(2);
bGridPane.setRowGap((double)5);
bGridPane.setColumnGap((double)5);
bGridPane.setColumnAlign(BHalign.left);
bGridPane.setStretchColumn(1);
bGridPane.add(null, (BValue)new BLabel(lex.getText("cert.field.alias")));
this.alias = new BTextField("", 40);
bGridPane.add(null, (BValue)this.buildDnTextField(this.alias, true));
bGridPane.add(null, (BValue)new BLabel(lex.getText("cert.field.commonName")));
this.cn = new BTextField("", 40);
bGridPane.add(null, (BValue)this.buildDnTextField(this.cn, true));
bGridPane.add(null, (BValue)new BLabel(""));
bGridPane.add(null, (BValue)new BLabel(lex.getText("cert.field.commonName.desc")));
bGridPane.add(null, (BValue)new BLabel(lex.getText("cert.field.organizationalUnit")));
this.ou = new BTextField("", 40);
bGridPane.add(null, (BValue)this.buildDnTextField(this.ou, false));
bGridPane.add(null, (BValue)new BLabel(lex.getText("cert.field.organization")));
this.o = new BTextField("", 40);
bGridPane.add(null, (BValue)this.buildDnTextField(this.o, true));
bGridPane.add(null, (BValue)new BLabel(lex.getText("cert.field.locality")));
this.l = new BTextField("", 40);
bGridPane.add(null, (BValue)this.buildDnTextField(this.l, false));
bGridPane.add(null, (BValue)new BLabel(lex.getText("cert.field.stateProvince")));
this.st = new BTextField("", 40);
bGridPane.add(null, (BValue)this.buildDnTextField(this.st, false));
bGridPane.add(null, (BValue)new BLabel(lex.getText("cert.field.countryCode")));
this.c = new BTextField("", 3);
bGridPane.add(null, (BValue)this.buildDnTextField(this.c, true));
bGridPane.add(null, (BValue)new BLabel(lex.getText("cert.field.notBefore")));
this.starts = new BAbsTimeFE();
bGridPane.add(null, (BValue)this.starts);
this.starts.loadValue((BObject)BAbsTime.now());
bGridPane.add(null, (BValue)new BLabel(lex.getText("cert.field.notAfter")));
this.ends = new BAbsTimeFE();
bGridPane.add(null, (BValue)this.ends);
this.ends.loadValue((BObject)BAbsTime.make((long)(Clock.millis() + BRelTime.makeHours((int)8760).getMillis())));
BGridPane bGridPane2 = new BGridPane(4);
bGridPane2.setColumnGap(7.0);
ToggleCommandGroup toggleCommandGroup = new ToggleCommandGroup();
this.keySize1024 = new BRadioButton(toggleCommandGroup, lex.getText("cert.field.1024bits"), false);
bGridPane2.add(null, (BValue)this.keySize1024);
this.keySize2048 = new BRadioButton(toggleCommandGroup, lex.getText("cert.field.2048bits"), true);
bGridPane2.add(null, (BValue)this.keySize2048);
this.keySize3072 = new BRadioButton(toggleCommandGroup, lex.getText("cert.field.3072bits"), true);
bGridPane2.add(null, (BValue)this.keySize3072);
this.keySize4096 = new BRadioButton(toggleCommandGroup, lex.getText("cert.field.4096bits"), false);
bGridPane2.add(null, (BValue)this.keySize4096);
bGridPane.add(null, (BValue)new BLabel(lex.getText("cert.field.keySize")));
bGridPane.add(null, (BValue)bGridPane2);
this.keySize2048.setSelected(true);
BGridPane bGridPane3 = new BGridPane(2);
toggleCommandGroup = new ToggleCommandGroup();
this.serverCert = new BRadioButton(toggleCommandGroup, lex.getText("cert.field.serverCert"), true);
bGridPane3.add(null, (BValue)this.serverCert);
this.caCert = new BRadioButton(toggleCommandGroup, lex.getText("cert.field.caCert"), false);
bGridPane3.add(null, (BValue)this.caCert);
bGridPane.add(null, (BValue)new BLabel(lex.getText("cert.field.certUsage")));
bGridPane.add(null, (BValue)bGridPane3);
bGridPane.add(null, (BValue)new BLabel(lex.getText("cert.field.emailAddress")));
this.emailAltName = new BTextField("", 40);
bGridPane.add(null, (BValue)this.emailAltName);
BGridPane bGridPane4 = new BGridPane(1);
bGridPane4.add(null, (BValue)bGridPane);
this.linkTo(null, (BComponent)this.alias, (Slot)BTextField.textModified, (Slot)setModified);
this.linkTo(null, (BComponent)this.cn, (Slot)BTextField.textModified, (Slot)setModified);
this.linkTo(null, (BComponent)this.o, (Slot)BTextField.textModified, (Slot)setModified);
this.linkTo(null, (BComponent)this.c, (Slot)BTextField.textModified, (Slot)setModified);
this.linkTo(null, (BComponent)this.starts, (Slot)BAbsTimeFE.pluginModified, (Slot)setModified);
this.linkTo(null, (BComponent)this.ends, (Slot)BAbsTimeFE.pluginModified, (Slot)setModified);
return bGridPane4;
}
private final 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("linkA", (BComponent)this.okButton, (Slot)BButton.actionPerformed, (Slot)okButtonPressed);
this.okButton.setEnabled(false);
this.cancelButton = new BButton(UiLexicon.bajaui().getText("dialog.cancel"));
bGridPane.add(null, (BValue)this.cancelButton);
this.linkTo("linkB", (BComponent)this.cancelButton, (Slot)BButton.actionPerformed, (Slot)cancelButtonPressed);
return new BBorderPane((BWidget)bGridPane, 7.0, 0.0, 0.0, 0.0);
}
public void windowClosing(BWindowEvent bWindowEvent) {
this.close();
}
public void doOkButtonPressed(BWidgetEvent bWidgetEvent) throws Exception {
String string;
StringBuffer stringBuffer = new StringBuffer();
if (this.alias.getText().length() <= 0) {
stringBuffer.append("- " + lex.getText("cert.generate.error.requiredAlias") + '\n');
}
if (this.cn.getText().length() <= 0) {
stringBuffer.append("- " + lex.getText("cert.generate.error.requiredCommonName") + '\n');
}
if (this.o.getText().length() <= 0) {
stringBuffer.append("- " + lex.getText("cert.generate.error.requiredOrganization") + '\n');
}
if (!BSelfSignedDialog.isValidCountryCode(string = this.c.getText())) {
stringBuffer.append("- " + lex.getText("cert.generate.error.requiredCountryCode") + '\n');
}
if (stringBuffer.length() > 0) {
BDialog.error((BWidget)this, (String)lex.getText("cert.generate.error.failure"), (Object)lex.getText("cert.generate.error.failure.description"), (String)stringBuffer.toString());
return;
}
if (this.keySize1024.getSelected()) {
if (BDialog.open((BWidget)this, (String)lex.getText("cert.generate.warning.weakKeySize"), (Object)lex.getText("cert.generate.warning.weakKeySize.description"), (int)12, (BImage)BDialog.WARNING_ICON, null) == 8) {
return;
}
this.keySize = 1024;
} else if (this.keySize2048.getSelected()) {
this.keySize = 2048;
} else if (this.keySize3072.getSelected()) {
this.keySize = 3072;
} else if (this.keySize4096.getSelected()) {
this.keySize = 4096;
}
this.keyUsage = 0;
if (this.serverCert.getSelected()) {
this.keyUsage = 160;
} else if (this.caCert.getSelected()) {
this.keyUsage = 6;
}
try {
X509Certificate x509Certificate = this.mgr.getCertificate(this.alias.getText());
if (x509Certificate != null) {
if (BDialog.open((BWidget)this, (String)lex.getText("cert.generate.warning.matchingAlias"), (Object)lex.getText("cert.generate.warning.matchingAlias.description", new Object[]{this.alias.getText()}), (int)12, (BImage)BDialog.WARNING_ICON) == 8) {
return;
}
this.mgr.deleteEntry(this.alias.getText());
}
}
catch (Exception exception) {}
if ((this.keyUsage & 4) != 0) {
this.pkPassword = BPrivateKeyPasswordDialog.open((BWidget)this);
if (this.pkPassword == null) {
this.close();
return;
}
}
this.canceled = false;
this.close();
}
public void doCancelButtonPressed(BWidgetEvent bWidgetEvent) {
this.close();
}
public void doSetModified(BWidgetEvent bWidgetEvent) {
boolean bl = true;
try {
if (this.alias.getText().trim().length() == 0) {
bl = false;
}
if (this.cn.getText().trim().length() == 0) {
bl = false;
}
if (this.o.getText().trim().length() == 0) {
bl = false;
}
if (!BSelfSignedDialog.isValidCountryCode(this.c.getText())) {
bl = false;
}
if (((BAbsTime)this.ends.saveValue()).getMillis() <= ((BAbsTime)this.starts.saveValue()).getMillis()) {
bl = false;
}
}
catch (Exception exception) {
bl = false;
}
this.okButton.setEnabled(bl);
}
private static final boolean isValidCountryCode(String string) {
boolean bl = true;
if (string.trim().length() <= 0) {
bl = false;
} else if (string.trim().length() != 2) {
bl = false;
} else {
String[] stringArray = Locale.getISOCountries();
int n = 0;
n = 0;
while (n < stringArray.length) {
if (string.equalsIgnoreCase(stringArray[n])) break;
++n;
}
if (n == stringArray.length) {
bl = false;
}
}
return bl;
}
public BCertsTable.CertGenRequest getResult() {
if (this.canceled) {
return null;
}
try {
int n = this.mgr.generateSelfSignedCert(this.alias.getText(), this.cn.getText().trim().length() > 0 ? this.cn.getText() : null, this.ou.getText().trim().length() > 0 ? this.ou.getText() : null, this.o.getText().trim().length() > 0 ? this.o.getText() : null, this.l.getText().trim().length() > 0 ? this.l.getText() : null, this.st.getText().trim().length() > 0 ? this.st.getText() : null, this.c.getText().length() > 0 ? this.c.getText() : null, new Date(((BAbsTime)this.starts.saveValue()).getMillis()), new Date(((BAbsTime)this.ends.saveValue()).getMillis()), this.keySize, this.keyUsage, this.emailAltName.getText().length() > 0 ? this.emailAltName.getText() : null, this.pkPassword != null ? this.pkPassword.getValue() : null);
if (n == -1) {
return null;
}
return new BCertsTable.CertGenRequest(n, this.alias.getText());
}
catch (Exception exception) {
exception.printStackTrace();
return null;
}
}
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.alias = null;
this.cn = null;
this.ou = null;
this.o = null;
this.l = null;
this.st = null;
this.c = null;
this.starts = null;
this.ends = null;
this.keySize1024 = null;
this.keySize2048 = null;
this.keySize3072 = null;
this.keySize4096 = null;
this.serverCert = null;
this.caCert = null;
this.emailAltName = null;
this.pkPassword = null;
this.okButton = null;
this.cancelButton = null;
this.mgr = null;
this.keySize = 2048;
this.keyUsage = 0;
this.canceled = true;
}
protected BSelfSignedDialog(BWidget bWidget, ICoreKeyStore iCoreKeyStore) {
super(bWidget, lex.getText("cert.generate.dialog.title"), true);
this.this();
this.mgr = iCoreKeyStore;
this.setContent(this.buildDialog());
this.setDefaultButton(this.okButton);
}
static {
Class clazz = class$com$tridium$platcrypto$ui$BSelfSignedDialog;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$ui$BSelfSignedDialog = BSelfSignedDialog.class("[Lcom.tridium.platcrypto.ui.BSelfSignedDialog;", false);
}
TYPE = Sys.loadType((Class)clazz);
lex = Lexicon.make((String)"platCrypto");
logo = BImage.make((String)lex.get("cert.x32.icon", "module://icons/x32/lock.png"));
}
}
@@ -0,0 +1,131 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.platform.ui.util.CommandUtil
* com.tridium.workbench.util.BSessionInfoDialog
* javax.baja.gx.BImage
* javax.baja.sys.BIcon
* javax.baja.sys.BValue
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BButton
* javax.baja.ui.BSeparator
* javax.baja.ui.BWidget
* javax.baja.ui.Command
* javax.baja.ui.CommandArtifact
* javax.baja.ui.enums.BButtonStyle
* javax.baja.ui.enums.BHalign
* javax.baja.ui.pane.BEdgePane
* javax.baja.ui.pane.BGridPane
* javax.baja.util.Lexicon
*/
package com.tridium.platcrypto.ui;
import com.tridium.platcrypto.ui.BCertViewDialog;
import com.tridium.platcrypto.util.BSslSessionInfo;
import com.tridium.platform.ui.util.CommandUtil;
import com.tridium.workbench.util.BSessionInfoDialog;
import javax.baja.gx.BImage;
import javax.baja.sys.BIcon;
import javax.baja.sys.BValue;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BButton;
import javax.baja.ui.BSeparator;
import javax.baja.ui.BWidget;
import javax.baja.ui.Command;
import javax.baja.ui.CommandArtifact;
import javax.baja.ui.enums.BButtonStyle;
import javax.baja.ui.enums.BHalign;
import javax.baja.ui.pane.BEdgePane;
import javax.baja.ui.pane.BGridPane;
import javax.baja.util.Lexicon;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BSslSessionInfoDialog
extends BSessionInfoDialog {
public static final Type TYPE;
private static Lexicon lex;
BSslSessionInfo sslInfo;
static /* synthetic */ Class class$com$tridium$platcrypto$ui$BSslSessionInfoDialog;
public Type getType() {
return TYPE;
}
protected BWidget buildBody() {
this.sslInfo = (BSslSessionInfo)this.info;
BGridPane bGridPane = new BGridPane(1);
bGridPane.setStretchColumn(0);
bGridPane.setHalign(BHalign.fill);
bGridPane.setColumnAlign(BHalign.fill);
String string = this.info.getUsername();
if (string != null) {
bGridPane.add(null, (BValue)this.buildRow(BImage.make((BIcon)userIcon), this.wordWrappedLabel(this.info.getConnectedAsMessage(string), BHalign.left, 250.0)));
bGridPane.add(null, (BValue)new BSeparator());
}
bGridPane.add(null, (BValue)this.buildRow(BImage.make((BIcon)this.info.getIdentityVerifiedIcon()), this.createCertLinkRow()));
bGridPane.add(null, (BValue)new BSeparator());
bGridPane.add(null, (BValue)this.buildRow(BImage.make((BIcon)this.info.getSessionEncryptedIcon()), this.wordWrappedLabel(this.info.getSessionEncryptedMessage(), BHalign.left, 300.0)));
bGridPane.add(null, (BValue)new BSeparator());
bGridPane.add(null, (BValue)this.buildRow(BImage.make((BIcon)this.info.getLastConnectedIcon()), this.wordWrappedLabel(this.info.getLastConnectedMessage(), BHalign.left, 300.0)));
bGridPane.add(null, (BValue)new BSeparator());
return bGridPane;
}
private final BWidget createCertLinkRow() {
BEdgePane bEdgePane = new BEdgePane();
bEdgePane.setCenter(this.wordWrappedLabel(this.info.getIdentityVerifiedMessage(), BHalign.left, 300.0));
BButton bButton = new BButton((Command)new CertificateCommand());
bButton.setButtonStyle(BButtonStyle.hyperlink);
bButton.setHalign(BHalign.left);
bEdgePane.setBottom((BWidget)bButton);
return bEdgePane;
}
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());
}
}
static {
Class clazz = class$com$tridium$platcrypto$ui$BSslSessionInfoDialog;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$ui$BSslSessionInfoDialog = BSslSessionInfoDialog.class("[Lcom.tridium.platcrypto.ui.BSslSessionInfoDialog;", false);
}
TYPE = Sys.loadType((Class)clazz);
lex = Lexicon.make((String)"workbench");
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
class CertificateCommand
extends Command {
public CommandArtifact doInvoke() {
try {
BCertViewDialog.show((BWidget)BSslSessionInfoDialog.this, BSslSessionInfoDialog.this.sslInfo.getCertificate());
}
catch (Exception exception) {
CommandUtil.error((Command)this, (Throwable)exception);
}
return null;
}
public CertificateCommand() {
super((BWidget)BSslSessionInfoDialog.this, lex.get("sessionInfoDialog.certificateInfo.label", "Certificate Information"));
}
}
}
@@ -0,0 +1,228 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.cert.NX509Certificate
* com.tridium.crypto.core.io.ICoreKeyStore
* com.tridium.crypto.core.util.FriendlyPemReader
* com.tridium.platform.ui.util.BCommandEnablePolicy
* com.tridium.platform.ui.util.CommandBindings$Support
* com.tridium.platform.ui.util.CommandUtil
* javax.baja.file.BIFile
* javax.baja.file.IFileFilter
* javax.baja.naming.BOrd
* javax.baja.nre.util.Array
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BDialog
* javax.baja.ui.BWidget
* javax.baja.ui.Command
* javax.baja.ui.CommandArtifact
* javax.baja.ui.file.BFileChooser
* javax.baja.ui.file.ExtFileFilter
* org.bouncycastle.cert.X509CertificateHolder
* org.bouncycastle.cert.jcajce.JcaX509CertificateConverter
* org.bouncycastle.openssl.EncryptionException
* org.bouncycastle.openssl.PEMEncryptedKeyPair
* org.bouncycastle.openssl.PEMKeyPair
* org.bouncycastle.openssl.PEMParser
* org.bouncycastle.openssl.PasswordException
*/
package com.tridium.platcrypto.ui;
import com.tridium.crypto.core.cert.NX509Certificate;
import com.tridium.crypto.core.io.ICoreKeyStore;
import com.tridium.crypto.core.util.FriendlyPemReader;
import com.tridium.platcrypto.ui.BCertImportDialog;
import com.tridium.platcrypto.ui.BCertsTable;
import com.tridium.platform.ui.util.BCommandEnablePolicy;
import com.tridium.platform.ui.util.CommandBindings;
import com.tridium.platform.ui.util.CommandUtil;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.security.PrivateKey;
import java.security.cert.X509Certificate;
import java.util.ListIterator;
import javax.baja.file.BIFile;
import javax.baja.file.IFileFilter;
import javax.baja.naming.BOrd;
import javax.baja.nre.util.Array;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BDialog;
import javax.baja.ui.BWidget;
import javax.baja.ui.Command;
import javax.baja.ui.CommandArtifact;
import javax.baja.ui.file.BFileChooser;
import javax.baja.ui.file.ExtFileFilter;
import org.bouncycastle.cert.X509CertificateHolder;
import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter;
import org.bouncycastle.openssl.EncryptionException;
import org.bouncycastle.openssl.PEMEncryptedKeyPair;
import org.bouncycastle.openssl.PEMKeyPair;
import org.bouncycastle.openssl.PEMParser;
import org.bouncycastle.openssl.PasswordException;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BTrustCertsTable
extends BCertsTable {
public static final Type TYPE;
static /* synthetic */ Class class$com$tridium$platcrypto$ui$BTrustCertsTable;
static /* synthetic */ Class class$java$security$cert$X509Certificate;
public Type getType() {
return TYPE;
}
protected void initCommands() {
this.getCommandBindings().setSupport((CommandBindings.Support)this);
BCertsTable.ViewCommand viewCommand = new BCertsTable.ViewCommand();
this.addCommand(viewCommand, BCommandEnablePolicy.singleSelection);
this.setDoubleClickCommand(viewCommand);
this.addCommand(new BCertsTable.DeleteCommand(), BCommandEnablePolicy.anySelection);
this.addCommand(new TrustImportCommand(), BCommandEnablePolicy.always);
this.addCommand(new BCertsTable.ExportCommand(), BCommandEnablePolicy.singleSelection);
}
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());
}
}
public BTrustCertsTable() throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
public BTrustCertsTable(ICoreKeyStore iCoreKeyStore) throws Exception {
super(iCoreKeyStore);
}
static {
Class clazz = class$com$tridium$platcrypto$ui$BTrustCertsTable;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$ui$BTrustCertsTable = BTrustCertsTable.class("[Lcom.tridium.platcrypto.ui.BTrustCertsTable;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
protected class TrustImportCommand
extends BCertsTable.ImportCommand {
/*
* WARNING - Removed back jump from a try to a catch block - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public CommandArtifact doInvoke() {
try {
BFileChooser bFileChooser = BFileChooser.makeOpen((BWidget)this.getOwner());
bFileChooser.setTitle(lex.getText("cert.import.chooser.title"));
bFileChooser.addFilter((IFileFilter)new ExtFileFilter(lex.getText("cert.extension.info"), "pem,p12,crt,cer,cert"));
bFileChooser.setCurrentDirectory(BOrd.make((String)("file:/" + BTrustCertsTable.getCertsDirectoryPath())));
BOrd bOrd = bFileChooser.show();
if (bOrd == null) {
return null;
}
BIFile bIFile = (BIFile)bOrd.get();
if (bIFile == null) return null;
Class clazz = class$java$security$cert$X509Certificate;
if (clazz == null) {
clazz = class$java$security$cert$X509Certificate = BTrustCertsTable.class("[Ljava.security.cert.X509Certificate;", false);
}
Array array = new Array(clazz);
InputStreamReader inputStreamReader = new InputStreamReader(bIFile.getInputStream());
FriendlyPemReader friendlyPemReader = new FriendlyPemReader((Reader)inputStreamReader);
PEMParser pEMParser = new PEMParser((Reader)friendlyPemReader);
try {
Object object = null;
do {
try {
object = pEMParser.readObject();
if (object == null) continue;
if (object instanceof X509Certificate) {
array.add(object);
continue;
}
if (object instanceof X509CertificateHolder) {
X509Certificate x509Certificate = new JcaX509CertificateConverter().getCertificate((X509CertificateHolder)object);
array.add((Object)x509Certificate);
continue;
}
if (object instanceof PEMKeyPair || object instanceof PEMEncryptedKeyPair) continue;
throw new IOException("unsupported object type: " + object.getClass().getName());
}
catch (PasswordException passwordException) {
log.trace("skipping private key during trust store import");
object = new Object();
}
} while (object != null);
}
catch (Throwable throwable) {
Object var9_14 = null;
try {
pEMParser.close();
throw throwable;
}
catch (Exception exception) {}
throw throwable;
}
{
Object var9_15 = null;
}
try {}
catch (Exception exception) {}
pEMParser.close();
String string = bIFile.getFileName();
string = string.substring(0, string.length() - bIFile.getExtension().length() - 1);
this.importCertData(array, null, string);
BTrustCertsTable.this.mgr.save();
BTrustCertsTable.this.certModel().load();
return null;
}
catch (EncryptionException encryptionException) {
BDialog.error((BWidget)this.getOwner(), (Object)lex.get("cert.import.privatekey.badpassword"));
return null;
}
catch (Exception exception) {
CommandUtil.error((Command)this, (Throwable)exception);
}
return null;
}
protected void importCertData(Array array, PrivateKey privateKey, String string) throws Exception {
ListIterator listIterator = array.iterator();
while (listIterator.hasNext()) {
X509Certificate x509Certificate = (X509Certificate)listIterator.next();
if (!NX509Certificate.isSelfSigned((X509Certificate)x509Certificate)) {
throw new IOException("certificate in the trust store must be root certificates");
}
String string2 = BTrustCertsTable.this.mgr.findCertificate(x509Certificate);
if (string2 == null) {
string2 = string;
}
NX509Certificate nX509Certificate = NX509Certificate.make((X509Certificate)x509Certificate);
string2 = BCertImportDialog.prompt(this.getOwner(), nX509Certificate, string2, false);
if (string2 == null) continue;
BTrustCertsTable.this.mgr.setCertificateEntry(string2, x509Certificate);
}
}
protected TrustImportCommand() {
}
}
}
@@ -0,0 +1,194 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.cert.NX509Certificate
* com.tridium.ui.theme.Theme
* com.tridium.ui.theme.custom.nss.StyleUtils
* javax.baja.nre.util.ByteArrayUtil
* javax.baja.sys.BValue
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BLabel
* javax.baja.ui.BWidget
* javax.baja.ui.enums.BHalign
* javax.baja.ui.pane.BBorderPane
* javax.baja.ui.pane.BEdgePane
* javax.baja.ui.pane.BGridPane
* javax.baja.ui.style.IStylable
* javax.baja.util.Lexicon
*/
package com.tridium.platcrypto.ui;
import com.tridium.crypto.core.cert.NX509Certificate;
import com.tridium.ui.theme.Theme;
import com.tridium.ui.theme.custom.nss.StyleUtils;
import java.util.Enumeration;
import java.util.Properties;
import javax.baja.nre.util.ByteArrayUtil;
import javax.baja.sys.BValue;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BLabel;
import javax.baja.ui.BWidget;
import javax.baja.ui.enums.BHalign;
import javax.baja.ui.pane.BBorderPane;
import javax.baja.ui.pane.BEdgePane;
import javax.baja.ui.pane.BGridPane;
import javax.baja.ui.style.IStylable;
import javax.baja.util.Lexicon;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BX509CertificateChangedPane
extends BEdgePane {
public static final Type TYPE;
static Lexicon lex;
private NX509Certificate oldCert;
private NX509Certificate cert;
private Properties before;
private Properties after;
static /* synthetic */ Class class$com$tridium$platcrypto$ui$BX509CertificateChangedPane;
public Type getType() {
return TYPE;
}
public void set(NX509Certificate nX509Certificate, NX509Certificate nX509Certificate2) {
this.set(nX509Certificate, nX509Certificate2, null, null);
}
public void set(NX509Certificate nX509Certificate, NX509Certificate nX509Certificate2, Properties properties, Properties properties2) {
this.oldCert = nX509Certificate;
this.cert = nX509Certificate2;
this.before = properties;
this.after = properties2;
this.buildCertPane();
}
private final void buildCertPane() {
BGridPane bGridPane = new BGridPane(2);
bGridPane.setStretchColumn(1);
bGridPane.setColorRows(true);
StyleUtils.addStyleClass((IStylable)bGridPane, (String)"scrolled");
bGridPane.setColumnAlign(BHalign.fill);
this.appendProperties(bGridPane, this.before);
this.appendCertProperties(bGridPane);
this.appendProperties(bGridPane, this.after);
this.setCenter((BWidget)bGridPane);
}
protected void appendProperties(BGridPane bGridPane, Properties properties) {
if (properties == null) {
return;
}
Enumeration<Object> enumeration = properties.keys();
while (enumeration.hasMoreElements()) {
String string = (String)enumeration.nextElement();
String string2 = properties.getProperty(string, null);
if (string2 == null) continue;
bGridPane.add(null, (BValue)this.createPaddedLabel(lex.getText(string), false));
bGridPane.add(null, (BValue)this.createPaddedLabel(string2, true));
}
}
protected void appendCertProperty(BGridPane bGridPane, String string, String string2, String string3) {
if (string2.equals(string3)) {
bGridPane.add(null, (BValue)this.createPaddedLabel(string, false));
bGridPane.add(null, (BValue)this.createPaddedLabel(string3, true));
} else {
bGridPane.add(null, (BValue)this.createPaddedLabel(string, false));
BEdgePane bEdgePane = new BEdgePane();
bEdgePane.setTop(this.createPaddedLabel("(-) " + string2, true));
bEdgePane.setBottom(this.createChangedLabel("(+) " + string3));
bGridPane.add(null, (BValue)bEdgePane);
}
}
protected void appendCertProperties(BGridPane bGridPane) {
if (this.cert == null || this.oldCert == null) {
return;
}
this.appendCertProperty(bGridPane, lex.getText("cert.field.version"), "v" + this.oldCert.getVersion(), "v" + this.cert.getVersion());
this.appendCertProperty(bGridPane, lex.getText("cert.field.serialNum"), ByteArrayUtil.toHexString((byte[])this.oldCert.getSerialNumber().toByteArray(), (String)" "), ByteArrayUtil.toHexString((byte[])this.cert.getSerialNumber().toByteArray(), (String)" "));
this.appendCertProperty(bGridPane, lex.getText("cert.field.issuedBy"), this.oldCert.getIssuer(), this.cert.getIssuer());
this.appendCertProperty(bGridPane, lex.getText("cert.field.issuerDn"), this.oldCert.getIssuerDN().toString(), this.cert.getIssuerDN().toString());
this.appendCertProperty(bGridPane, lex.getText("cert.field.subject"), this.oldCert.getSubject(), this.cert.getSubject());
this.appendCertProperty(bGridPane, lex.getText("cert.field.subjectDn"), this.oldCert.getSubjectDN().toString(), this.cert.getSubjectDN().toString());
this.appendCertProperty(bGridPane, lex.getText("cert.field.notBefore"), this.oldCert.getNotBefore().toString(), this.cert.getNotBefore().toString());
this.appendCertProperty(bGridPane, lex.getText("cert.field.notAfter"), this.oldCert.getNotAfter().toString(), this.cert.getNotAfter().toString());
this.appendCertProperty(bGridPane, lex.getText("cert.field.keyAlgorithm"), this.oldCert.getKeyAlgorithm(), this.cert.getKeyAlgorithm());
this.appendCertProperty(bGridPane, lex.getText("cert.field.keySize"), "" + this.oldCert.getKeySize(), "" + this.cert.getKeySize());
this.appendCertProperty(bGridPane, lex.getText("cert.field.signatureAlgorithm"), this.oldCert.getSignatureAlgorithm(), this.cert.getSignatureAlgorithm());
this.appendCertProperty(bGridPane, lex.getText("cert.field.signatureSize"), "" + this.oldCert.getSignatureSize(), "" + this.cert.getSignatureSize());
this.appendCertProperty(bGridPane, lex.getText("cert.field.basicConstraints"), this.oldCert.getBasicConstraints(), this.cert.getBasicConstraints());
this.appendCertProperty(bGridPane, lex.getText("cert.field.keyUsage"), this.oldCert.getKeyUsage(), this.cert.getKeyUsage());
this.appendCertProperty(bGridPane, lex.getText("cert.field.extendedKeyUsage"), this.oldCert.getExtendedKeyUsage(), this.cert.getExtendedKeyUsage());
this.appendCertProperty(bGridPane, lex.getText("cert.field.md5Fingerprint"), this.oldCert.getMD5Fingerprint(), this.cert.getMD5Fingerprint());
this.appendCertProperty(bGridPane, lex.getText("cert.field.sha1Fingerprint"), this.oldCert.getSHA1Fingerprint(), this.cert.getSHA1Fingerprint());
this.appendCertProperty(bGridPane, lex.getText("cert.field.valid"), this.oldCert.checkValidity() ? lex.getText("cert.field.valid.true") : lex.getText("cert.field.valid.false"), this.cert.checkValidity() ? lex.getText("cert.field.valid.true") : lex.getText("cert.field.valid.false"));
}
private final BWidget createPaddedLabel(String string, boolean bl) {
BLabel bLabel = new BLabel(string, BHalign.left);
if (bl) {
bLabel.setFont(Theme.label().getFixedWidthFont((IStylable)bLabel));
}
BBorderPane bBorderPane = new BBorderPane((BWidget)bLabel, 0.0, (double)5, 0.0, 15.0);
return bBorderPane;
}
private final BWidget createChangedLabel(String string) {
BLabel bLabel = new BLabel(string, BHalign.left);
bLabel.setFont(Theme.label().getFixedWidthFont((IStylable)bLabel));
StyleUtils.addStyleClass((IStylable)bLabel, (String)"warning emphasized");
BBorderPane bBorderPane = new BBorderPane((BWidget)bLabel, 0.0, (double)5, 0.0, 15.0);
return bBorderPane;
}
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());
}
}
public BX509CertificateChangedPane() {
this.cert = null;
this.before = null;
this.after = null;
}
public BX509CertificateChangedPane(NX509Certificate nX509Certificate, NX509Certificate nX509Certificate2) {
this.oldCert = nX509Certificate;
this.cert = nX509Certificate2;
this.before = null;
this.after = null;
this.buildCertPane();
}
public BX509CertificateChangedPane(NX509Certificate nX509Certificate, NX509Certificate nX509Certificate2, Properties properties, Properties properties2) {
this.oldCert = nX509Certificate;
this.cert = nX509Certificate2;
this.before = properties;
this.after = properties2;
this.buildCertPane();
}
static {
Class clazz = class$com$tridium$platcrypto$ui$BX509CertificateChangedPane;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$ui$BX509CertificateChangedPane = BX509CertificateChangedPane.class("[Lcom.tridium.platcrypto.ui.BX509CertificateChangedPane;", false);
}
TYPE = Sys.loadType((Class)clazz);
lex = Lexicon.make((String)"platCrypto");
}
}
@@ -0,0 +1,187 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.cert.NX509Certificate
* com.tridium.ui.theme.Theme
* com.tridium.ui.theme.custom.nss.StyleUtils
* javax.baja.nre.util.ByteArrayUtil
* javax.baja.sys.BValue
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BLabel
* javax.baja.ui.BWidget
* javax.baja.ui.enums.BHalign
* javax.baja.ui.pane.BBorderPane
* javax.baja.ui.pane.BEdgePane
* javax.baja.ui.pane.BGridPane
* javax.baja.ui.style.IStylable
* javax.baja.util.Lexicon
*/
package com.tridium.platcrypto.ui;
import com.tridium.crypto.core.cert.NX509Certificate;
import com.tridium.ui.theme.Theme;
import com.tridium.ui.theme.custom.nss.StyleUtils;
import java.util.Enumeration;
import java.util.Properties;
import javax.baja.nre.util.ByteArrayUtil;
import javax.baja.sys.BValue;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BLabel;
import javax.baja.ui.BWidget;
import javax.baja.ui.enums.BHalign;
import javax.baja.ui.pane.BBorderPane;
import javax.baja.ui.pane.BEdgePane;
import javax.baja.ui.pane.BGridPane;
import javax.baja.ui.style.IStylable;
import javax.baja.util.Lexicon;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BX509CertificatePane
extends BEdgePane {
public static final Type TYPE;
static Lexicon lex;
private NX509Certificate cert;
private Properties before;
private Properties after;
static /* synthetic */ Class class$com$tridium$platcrypto$ui$BX509CertificatePane;
public Type getType() {
return TYPE;
}
public void set(NX509Certificate nX509Certificate) {
this.set(nX509Certificate, null, null);
}
public void set(NX509Certificate nX509Certificate, Properties properties, Properties properties2) {
this.cert = nX509Certificate;
this.before = properties;
this.after = properties2;
this.buildCertPane();
}
private final void buildCertPane() {
BGridPane bGridPane = new BGridPane(2);
bGridPane.setStretchColumn(1);
bGridPane.setColorRows(true);
StyleUtils.addStyleClass((IStylable)bGridPane, (String)"scrolled");
bGridPane.setColumnAlign(BHalign.fill);
this.appendProperties(bGridPane, this.before);
this.appendCertProperties(bGridPane);
this.appendProperties(bGridPane, this.after);
this.setCenter((BWidget)bGridPane);
}
protected void appendProperties(BGridPane bGridPane, Properties properties) {
if (properties == null) {
return;
}
Enumeration<Object> enumeration = properties.keys();
while (enumeration.hasMoreElements()) {
String string = (String)enumeration.nextElement();
String string2 = properties.getProperty(string, null);
if (string2 == null) continue;
bGridPane.add(null, (BValue)this.createPaddedLabel(lex.getText(string), false));
bGridPane.add(null, (BValue)this.createPaddedLabel(string2, true));
}
}
protected void appendCertProperties(BGridPane bGridPane) {
if (this.cert == null) {
return;
}
bGridPane.add(null, (BValue)this.createPaddedLabel(lex.getText("cert.field.version"), false));
bGridPane.add(null, (BValue)this.createPaddedLabel("v" + this.cert.getVersion(), true));
bGridPane.add(null, (BValue)this.createPaddedLabel(lex.getText("cert.field.serialNum"), false));
bGridPane.add(null, (BValue)this.createPaddedLabel(ByteArrayUtil.toHexString((byte[])this.cert.getSerialNumber().toByteArray(), (String)" "), true));
bGridPane.add(null, (BValue)this.createPaddedLabel(lex.getText("cert.field.issuedBy"), false));
bGridPane.add(null, (BValue)this.createPaddedLabel(this.cert.getIssuer(), true));
bGridPane.add(null, (BValue)this.createPaddedLabel(lex.getText("cert.field.issuerDn"), false));
bGridPane.add(null, (BValue)this.createPaddedLabel(this.cert.getIssuerDN().toString(), true));
bGridPane.add(null, (BValue)this.createPaddedLabel(lex.getText("cert.field.subject"), false));
bGridPane.add(null, (BValue)this.createPaddedLabel(this.cert.getSubject(), true));
bGridPane.add(null, (BValue)this.createPaddedLabel(lex.getText("cert.field.subjectDn"), false));
bGridPane.add(null, (BValue)this.createPaddedLabel(this.cert.getSubjectDN().toString(), true));
bGridPane.add(null, (BValue)this.createPaddedLabel(lex.getText("cert.field.notBefore"), false));
bGridPane.add(null, (BValue)this.createPaddedLabel(this.cert.getNotBefore().toString(), true));
bGridPane.add(null, (BValue)this.createPaddedLabel(lex.getText("cert.field.notAfter"), false));
bGridPane.add(null, (BValue)this.createPaddedLabel(this.cert.getNotAfter().toString(), true));
bGridPane.add(null, (BValue)this.createPaddedLabel(lex.getText("cert.field.keyAlgorithm"), false));
bGridPane.add(null, (BValue)this.createPaddedLabel(this.cert.getKeyAlgorithm(), true));
bGridPane.add(null, (BValue)this.createPaddedLabel(lex.getText("cert.field.keySize"), false));
bGridPane.add(null, (BValue)this.createPaddedLabel("" + this.cert.getKeySize(), true));
bGridPane.add(null, (BValue)this.createPaddedLabel(lex.getText("cert.field.signatureAlgorithm"), false));
bGridPane.add(null, (BValue)this.createPaddedLabel(this.cert.getSignatureAlgorithm(), true));
bGridPane.add(null, (BValue)this.createPaddedLabel(lex.getText("cert.field.signatureSize"), false));
bGridPane.add(null, (BValue)this.createPaddedLabel("" + this.cert.getSignatureSize(), true));
bGridPane.add(null, (BValue)this.createPaddedLabel(lex.getText("cert.field.basicConstraints"), false));
bGridPane.add(null, (BValue)this.createPaddedLabel(this.cert.getBasicConstraints(), true));
bGridPane.add(null, (BValue)this.createPaddedLabel(lex.getText("cert.field.keyUsage"), false));
bGridPane.add(null, (BValue)this.createPaddedLabel(this.cert.getKeyUsage(), true));
bGridPane.add(null, (BValue)this.createPaddedLabel(lex.getText("cert.field.extendedKeyUsage"), false));
bGridPane.add(null, (BValue)this.createPaddedLabel(this.cert.getExtendedKeyUsage(), true));
bGridPane.add(null, (BValue)this.createPaddedLabel(lex.getText("cert.field.md5Fingerprint"), false));
bGridPane.add(null, (BValue)this.createPaddedLabel(this.cert.getMD5Fingerprint(), true));
bGridPane.add(null, (BValue)this.createPaddedLabel(lex.getText("cert.field.sha1Fingerprint"), false));
bGridPane.add(null, (BValue)this.createPaddedLabel(this.cert.getSHA1Fingerprint(), true));
bGridPane.add(null, (BValue)this.createPaddedLabel(lex.getText("cert.field.valid"), false));
bGridPane.add(null, (BValue)this.createPaddedLabel(this.cert.checkValidity() ? lex.getText("cert.field.valid.true") : lex.getText("cert.field.valid.false"), true));
}
private final BWidget createPaddedLabel(String string, boolean bl) {
BLabel bLabel = new BLabel(string, BHalign.left);
if (bl) {
bLabel.setFont(Theme.label().getFixedWidthFont((IStylable)bLabel));
}
BBorderPane bBorderPane = new BBorderPane((BWidget)bLabel, 0.0, (double)5, 0.0, 15.0);
return bBorderPane;
}
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());
}
}
public BX509CertificatePane() {
this.cert = null;
this.before = null;
this.after = null;
}
public BX509CertificatePane(NX509Certificate nX509Certificate) {
this.cert = nX509Certificate;
this.before = null;
this.after = null;
this.buildCertPane();
}
public BX509CertificatePane(NX509Certificate nX509Certificate, Properties properties, Properties properties2) {
this.cert = nX509Certificate;
this.before = properties;
this.after = properties2;
this.buildCertPane();
}
static {
Class clazz = class$com$tridium$platcrypto$ui$BX509CertificatePane;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$ui$BX509CertificatePane = BX509CertificatePane.class("[Lcom.tridium.platcrypto.ui.BX509CertificatePane;", false);
}
TYPE = Sys.loadType((Class)clazz);
lex = Lexicon.make((String)"platCrypto");
}
}
@@ -0,0 +1,168 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.cert.NX509Extension
* com.tridium.ui.theme.Theme
* com.tridium.ui.theme.custom.nss.StyleUtils
* javax.baja.sys.BValue
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BLabel
* javax.baja.ui.BWidget
* javax.baja.ui.enums.BHalign
* javax.baja.ui.pane.BBorderPane
* javax.baja.ui.pane.BConstrainedPane
* javax.baja.ui.pane.BEdgePane
* javax.baja.ui.pane.BGridPane
* javax.baja.ui.style.IStylable
*/
package com.tridium.platcrypto.ui;
import com.tridium.crypto.core.cert.NX509Extension;
import com.tridium.ui.theme.Theme;
import com.tridium.ui.theme.custom.nss.StyleUtils;
import javax.baja.sys.BValue;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.ui.BLabel;
import javax.baja.ui.BWidget;
import javax.baja.ui.enums.BHalign;
import javax.baja.ui.pane.BBorderPane;
import javax.baja.ui.pane.BConstrainedPane;
import javax.baja.ui.pane.BEdgePane;
import javax.baja.ui.pane.BGridPane;
import javax.baja.ui.style.IStylable;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BX509ExtensionChangedPane
extends BEdgePane {
public static final Type TYPE;
private NX509Extension[] oldExtensions;
private NX509Extension[] extensions;
static /* synthetic */ Class class$com$tridium$platcrypto$ui$BX509ExtensionChangedPane;
public Type getType() {
return TYPE;
}
protected BWidget createPaddedLabel(String string, boolean bl) {
BLabel bLabel = new BLabel(string, BHalign.left);
bLabel.setFont(Theme.label().getFixedWidthFont((IStylable)bLabel));
if (bl) {
StyleUtils.addStyleClass((IStylable)bLabel, (String)"warning emphasized");
}
BBorderPane bBorderPane = new BBorderPane((BWidget)bLabel, 0.0, (double)5, 0.0, (double)5);
return bBorderPane;
}
private final void buildExtensions() {
int n;
boolean bl;
BGridPane bGridPane = new BGridPane(1);
bGridPane.setStretchColumn(0);
bGridPane.setColorRows(true);
StyleUtils.addStyleClass((IStylable)bGridPane, (String)"scrolled");
bGridPane.setColumnAlign(BHalign.fill);
bGridPane.setHalign(BHalign.left);
int n2 = 0;
while (n2 < this.oldExtensions.length) {
bl = false;
n = 0;
while (n < this.extensions.length) {
if (this.oldExtensions[n2].getOid().equals((Object)this.extensions[n].getOid())) {
bl = true;
if (this.oldExtensions[n2].equals((Object)this.extensions[n])) {
bGridPane.add(null, (BValue)this.getExtensionWidget(this.oldExtensions[n2], "", false));
break;
}
BEdgePane bEdgePane = new BEdgePane();
bEdgePane.setTop(this.getExtensionWidget(this.oldExtensions[n2], "(-) ", false));
bEdgePane.setBottom(this.getExtensionWidget(this.extensions[n], "(+) ", true));
bGridPane.add(null, (BValue)bEdgePane);
break;
}
++n;
}
if (!bl) {
bGridPane.add(null, (BValue)this.getExtensionWidget(this.oldExtensions[n2], "(-) ", false));
}
++n2;
}
n2 = 0;
while (n2 < this.extensions.length) {
bl = false;
n = 0;
while (n < this.oldExtensions.length) {
if (this.extensions[n2].getOid().equals((Object)this.oldExtensions[n].getOid())) {
bl = true;
break;
}
++n;
}
if (!bl) {
bGridPane.add(null, (BValue)this.getExtensionWidget(this.extensions[n2], "(+) ", true));
}
++n2;
}
this.setCenter((BWidget)bGridPane);
}
private final BWidget getExtensionWidget(NX509Extension nX509Extension, String string, boolean bl) {
BEdgePane bEdgePane = new BEdgePane();
bEdgePane.setTop(this.createPaddedLabel(string + "Identifier: " + nX509Extension.getIdentifier(), bl));
String[] stringArray = nX509Extension.getExtensionText();
StringBuffer stringBuffer = new StringBuffer("isCritical: " + (nX509Extension.isCritical() ? "true" : "false"));
int n = 0;
while (n < stringArray.length) {
stringBuffer.append("\n");
stringBuffer.append(stringArray[n]);
++n;
}
bEdgePane.setCenter(this.createPaddedLabel(stringBuffer.toString(), bl));
BConstrainedPane bConstrainedPane = new BConstrainedPane();
bConstrainedPane.setMinWidth(15.0);
bEdgePane.setLeft((BWidget)bConstrainedPane);
return bEdgePane;
}
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.oldExtensions = null;
this.extensions = null;
}
public BX509ExtensionChangedPane() {
this.this();
}
public BX509ExtensionChangedPane(NX509Extension[] nX509ExtensionArray, NX509Extension[] nX509ExtensionArray2) {
this.this();
this.oldExtensions = nX509ExtensionArray;
this.extensions = nX509ExtensionArray2;
this.buildExtensions();
}
static {
Class clazz = class$com$tridium$platcrypto$ui$BX509ExtensionChangedPane;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$ui$BX509ExtensionChangedPane = BX509ExtensionChangedPane.class("[Lcom.tridium.platcrypto.ui.BX509ExtensionChangedPane;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,236 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.cert.NX509Extension
* com.tridium.crypto.core.cert.NX509Extension$NASN1Primitive
* com.tridium.ui.theme.Theme
* com.tridium.ui.theme.custom.nss.StyleUtils
* javax.baja.sys.BValue
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.ui.BCheckBox
* javax.baja.ui.BLabel
* javax.baja.ui.BWidget
* javax.baja.ui.enums.BHalign
* javax.baja.ui.pane.BBorderPane
* javax.baja.ui.pane.BConstrainedPane
* javax.baja.ui.pane.BEdgePane
* javax.baja.ui.pane.BGridPane
* javax.baja.ui.style.IStylable
*/
package com.tridium.platcrypto.ui;
import com.tridium.crypto.core.cert.NX509Extension;
import com.tridium.ui.theme.Theme;
import com.tridium.ui.theme.custom.nss.StyleUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.baja.sys.BValue;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
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.pane.BBorderPane;
import javax.baja.ui.pane.BConstrainedPane;
import javax.baja.ui.pane.BEdgePane;
import javax.baja.ui.pane.BGridPane;
import javax.baja.ui.style.IStylable;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BX509ExtensionPane
extends BEdgePane {
public static final Type TYPE;
private static final List OID_READONLY_LIST;
private BCheckBox[] selected;
private NX509Extension[] extensions;
private boolean selectable;
static /* synthetic */ Class class$com$tridium$platcrypto$ui$BX509ExtensionPane;
static /* synthetic */ Class class$org$bouncycastle$asn1$DERObjectIdentifier;
public Type getType() {
return TYPE;
}
public boolean isSelectable() {
return this.selectable;
}
public int getExtensionCount() {
if (this.extensions == null) {
return 0;
}
return this.extensions.length;
}
public boolean isSelected(int n) {
if (this.extensions == null) {
return false;
}
if (n > this.extensions.length - 1) {
return false;
}
if (this.selected == null) {
return false;
}
if (n > this.selected.length - 1) {
return false;
}
return this.selected[n].getSelected();
}
public NX509Extension getExtension(int n) {
return this.extensions[n];
}
public void setExtensions(NX509Extension[] nX509ExtensionArray, boolean bl) {
this.extensions = nX509ExtensionArray;
this.selectable = bl;
this.buildExtensions();
}
protected BWidget createPaddedLabel(String string) {
BLabel bLabel = new BLabel(string, BHalign.left);
bLabel.setFont(Theme.label().getFixedWidthFont((IStylable)bLabel));
BBorderPane bBorderPane = new BBorderPane((BWidget)bLabel, 0.0, (double)5, 0.0, (double)5);
return bBorderPane;
}
private final void buildExtensions() {
BGridPane bGridPane;
if (this.selectable) {
bGridPane = new BGridPane(2);
bGridPane.setStretchColumn(1);
} else {
bGridPane = new BGridPane(1);
bGridPane.setStretchColumn(0);
}
bGridPane.setColorRows(true);
StyleUtils.addStyleClass((IStylable)bGridPane, (String)"scrolled");
bGridPane.setColumnAlign(BHalign.fill);
bGridPane.setHalign(BHalign.left);
ArrayList<BEdgePane> arrayList = new ArrayList<BEdgePane>();
int n = 0;
while (n < this.extensions.length) {
BBorderPane bBorderPane;
BEdgePane bEdgePane;
if (this.selectable) {
bEdgePane = new BCheckBox("", true);
if (this.checkReadOnlyExtension(this.extensions[n])) {
bEdgePane.setEnabled(false);
}
arrayList.add(bEdgePane);
bBorderPane = new BBorderPane((BWidget)bEdgePane, 0.0, 10.0, 0.0, 10.0);
bGridPane.add(null, (BValue)bBorderPane);
}
bEdgePane = new BEdgePane();
bEdgePane.setTop(this.createPaddedLabel("Identifier: " + this.extensions[n].getIdentifier()));
bBorderPane = this.extensions[n].getExtensionText();
StringBuffer stringBuffer = new StringBuffer("isCritical: " + (this.extensions[n].isCritical() ? "true" : "false"));
int n2 = 0;
while (n2 < ((BBorderPane)bBorderPane).length) {
stringBuffer.append("\n");
stringBuffer.append((String)bBorderPane[n2]);
++n2;
}
bEdgePane.setCenter(this.createPaddedLabel(stringBuffer.toString()));
BConstrainedPane bConstrainedPane = new BConstrainedPane();
bConstrainedPane.setMinWidth(15.0);
bEdgePane.setLeft((BWidget)bConstrainedPane);
bGridPane.add(null, (BValue)bEdgePane);
++n;
}
this.selected = arrayList.toArray(new BCheckBox[0]);
this.setCenter((BWidget)bGridPane);
}
private final boolean checkReadOnlyExtension(NX509Extension nX509Extension) {
if (OID_READONLY_LIST.contains(nX509Extension.getOid())) {
return true;
}
try {
if (nX509Extension.getOid().getId().equals("2.5.29.18")) {
Class clazz = nX509Extension.getObject().getType();
Class clazz2 = class$org$bouncycastle$asn1$DERObjectIdentifier;
if (clazz2 == null) {
clazz2 = class$org$bouncycastle$asn1$DERObjectIdentifier = BX509ExtensionPane.class("[Lorg.bouncycastle.asn1.DERObjectIdentifier;", false);
}
if (clazz == clazz2 && nX509Extension.getObject().getValue() == "tridiumHostId") {
return true;
}
if (this.checkForTridiumHostId(nX509Extension.getObject())) {
return true;
}
}
}
catch (Exception exception) {
exception.printStackTrace();
}
return false;
}
private final boolean checkForTridiumHostId(NX509Extension.NASN1Primitive nASN1Primitive) {
if ("tridiumHostId".equals(nASN1Primitive.getValue())) {
return true;
}
NX509Extension.NASN1Primitive[] nASN1PrimitiveArray = nASN1Primitive.getChildren();
int n = 0;
while (n < nASN1PrimitiveArray.length) {
if (this.checkForTridiumHostId(nASN1PrimitiveArray[n])) {
return true;
}
++n;
}
return false;
}
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.extensions = null;
this.selectable = false;
}
public BX509ExtensionPane() {
this.this();
}
public BX509ExtensionPane(NX509Extension[] nX509ExtensionArray) {
this.this();
this.extensions = nX509ExtensionArray;
this.buildExtensions();
}
public BX509ExtensionPane(NX509Extension[] nX509ExtensionArray, boolean bl) {
this.this();
this.extensions = nX509ExtensionArray;
this.selectable = bl;
this.buildExtensions();
}
static {
Class clazz = class$com$tridium$platcrypto$ui$BX509ExtensionPane;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$ui$BX509ExtensionPane = BX509ExtensionPane.class("[Lcom.tridium.platcrypto.ui.BX509ExtensionPane;", false);
}
TYPE = Sys.loadType((Class)clazz);
OID_READONLY_LIST = Arrays.asList("2.5.29.19", "2.5.29.37", "2.5.29.15", "2.5.29.14", "1.3.6.1.4.1.4131.2");
}
}
@@ -0,0 +1,35 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.security.BPassword
* javax.baja.ui.BWidget
* javax.baja.util.Lexicon
* org.bouncycastle.openssl.PasswordFinder
*/
package com.tridium.platcrypto.ui;
import com.tridium.platcrypto.ui.BPasswordPromptDialog;
import javax.baja.security.BPassword;
import javax.baja.ui.BWidget;
import javax.baja.util.Lexicon;
import org.bouncycastle.openssl.PasswordFinder;
public class PrivateKeyPasswordFinder
implements PasswordFinder {
protected static Lexicon lex = Lexicon.make((String)"platCrypto");
private BWidget owner;
public char[] getPassword() {
BPassword bPassword = BPasswordPromptDialog.open(this.owner, lex.get("pem.prompt.password.title"), lex.get("pem.prompt.password.description"));
if (bPassword == null) {
return null;
}
return bPassword.getValue().toCharArray();
}
public PrivateKeyPasswordFinder(BWidget bWidget) {
this.owner = bWidget;
}
}
@@ -0,0 +1,58 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.cert.CertValidationResult
* com.tridium.crypto.core.cert.NHostExemption
* com.tridium.crypto.core.cert.NX509Certificate
* com.tridium.crypto.core.cert.TridiumX509TrustManager
* com.tridium.crypto.core.io.CoreCryptoManager
* com.tridium.crypto.core.util.ILogger
* com.tridium.nre.security.ISecurityInfoProvider
* javax.baja.log.Log
*/
package com.tridium.platcrypto.ui;
import com.tridium.crypto.core.cert.CertValidationResult;
import com.tridium.crypto.core.cert.NHostExemption;
import com.tridium.crypto.core.cert.NX509Certificate;
import com.tridium.crypto.core.cert.TridiumX509TrustManager;
import com.tridium.crypto.core.io.CoreCryptoManager;
import com.tridium.crypto.core.util.ILogger;
import com.tridium.nre.security.ISecurityInfoProvider;
import com.tridium.platcrypto.ui.BExemptionChangedDialog;
import com.tridium.platcrypto.ui.BExemptionPromptDialog;
import com.tridium.platcrypto.util.Logger;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import javax.baja.log.Log;
public class TridiumUIX509TrustManager
extends TridiumX509TrustManager {
/*
* Enabled aggressive block sorting
*/
protected void handleRejectedCertificate(X509Certificate[] x509CertificateArray, CoreCryptoManager coreCryptoManager, CertValidationResult certValidationResult) throws Exception {
this.log.error("No trusted certificate found");
if (!certValidationResult.certChanged()) {
boolean bl = BExemptionPromptDialog.show(null, certValidationResult);
this.addExemption(x509CertificateArray[0], coreCryptoManager, bl);
if (bl) return;
this.certificateException(certValidationResult.isValidCertChain(), certValidationResult.isHostnameVerified(), certValidationResult.isCertExpired());
return;
}
if (BExemptionChangedDialog.show(null, certValidationResult)) {
this.addExemption(x509CertificateArray[0], coreCryptoManager, true);
return;
}
NHostExemption nHostExemption = coreCryptoManager.getExemptionStore().getExemption(this.host);
nHostExemption.setChanged(NX509Certificate.make((X509Certificate)x509CertificateArray[0]));
coreCryptoManager.getExemptionStore().setExemption(nHostExemption);
throw new CertificateException("certificate private key has changed");
}
public TridiumUIX509TrustManager(ISecurityInfoProvider iSecurityInfoProvider) throws Exception {
super(iSecurityInfoProvider, (ILogger)new Logger(Log.getLog((String)"crypto")));
}
}