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,286 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.io.CoreCryptoManager
* com.tridium.crypto.core.io.ICoreCryptoManager
* com.tridium.crypto.core.io.ICoreExemptionStore
* com.tridium.crypto.core.util.ILogger
* com.tridium.fox.sys.BFoxChannelRegistry
* com.tridium.fox.sys.BFoxSession
* com.tridium.nre.security.ISecurityInfoProvider
* com.tridium.platform.BPlatformService
* com.tridium.sys.Nre
* javax.baja.file.BFileSystem
* javax.baja.file.FilePath
* javax.baja.io.net.IClientSocketFactory
* javax.baja.io.net.IServerSocketFactory
* javax.baja.log.Log
* javax.baja.naming.BISession
* javax.baja.naming.BLocalHost
* javax.baja.naming.BOrd
* javax.baja.naming.OrdQuery
* javax.baja.security.crypto.BSslTlsEnum
* javax.baja.security.crypto.BTlsEnum
* javax.baja.security.crypto.ICryptoManagerEx
* javax.baja.security.crypto.IKeyStore
* javax.baja.sys.BComponent
* javax.baja.sys.BIcon
* javax.baja.sys.BValue
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platcrypto.core;
import com.tridium.crypto.core.io.CoreCryptoManager;
import com.tridium.crypto.core.io.ICoreCryptoManager;
import com.tridium.crypto.core.io.ICoreExemptionStore;
import com.tridium.crypto.core.util.ILogger;
import com.tridium.fox.sys.BFoxChannelRegistry;
import com.tridium.fox.sys.BFoxSession;
import com.tridium.nre.security.ISecurityInfoProvider;
import com.tridium.platcrypto.core.ICryptoManagerProvider;
import com.tridium.platcrypto.core.IExtCryptoManager;
import com.tridium.platcrypto.core.IProviderInfo;
import com.tridium.platcrypto.core.NExemptionStore;
import com.tridium.platcrypto.core.NKeyStore;
import com.tridium.platcrypto.core.NProviderInfo;
import com.tridium.platcrypto.fox.BCryptoChannel;
import com.tridium.platcrypto.fox.ChannelCryptoManager;
import com.tridium.platcrypto.socket.CryptoClientNoArgSocketFactory;
import com.tridium.platcrypto.socket.CryptoClientSocketFactory;
import com.tridium.platcrypto.socket.CryptoServerSocketFactory;
import com.tridium.platcrypto.util.Logger;
import com.tridium.platform.BPlatformService;
import com.tridium.sys.Nre;
import java.io.File;
import java.io.IOException;
import javax.baja.file.BFileSystem;
import javax.baja.file.FilePath;
import javax.baja.io.net.IClientSocketFactory;
import javax.baja.io.net.IServerSocketFactory;
import javax.baja.log.Log;
import javax.baja.naming.BISession;
import javax.baja.naming.BLocalHost;
import javax.baja.naming.BOrd;
import javax.baja.naming.OrdQuery;
import javax.baja.security.crypto.BSslTlsEnum;
import javax.baja.security.crypto.BTlsEnum;
import javax.baja.security.crypto.ICryptoManagerEx;
import javax.baja.security.crypto.IKeyStore;
import javax.baja.sys.BComponent;
import javax.baja.sys.BIcon;
import javax.baja.sys.BValue;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLSocketFactory;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public final class BCertManagerService
extends BPlatformService
implements IExtCryptoManager,
ICryptoManagerProvider {
public static final Type TYPE;
private static final BIcon icon;
private ICoreCryptoManager cryptoManager;
private NKeyStore trustKeyStore;
private NKeyStore keyStore;
private NExemptionStore exemptionStore;
private IProviderInfo providerInfo;
static /* synthetic */ Class class$com$tridium$platcrypto$core$BCertManagerService;
static /* synthetic */ Class class$com$tridium$platcrypto$socket$CryptoClientTlsSocketFactory;
public final Type getType() {
return TYPE;
}
public final Type[] getServiceTypes() {
return new Type[]{TYPE};
}
public final boolean isValidPlatform() {
if (System.getProperty("java.vm.name").equalsIgnoreCase("J9")) {
Log.getLog((String)"crypto").error("Unable to install new crypto service with the j9 vm");
return false;
}
try {
if (Nre.serviceManager.getService("crypto:CryptoService") != null) {
Log.getLog((String)"crypto").warning("Unable to install new crypto service while legacy crypto.jar is installed");
return false;
}
}
catch (Exception exception) {}
return true;
}
public final String getLicenseFeature() {
return "crypto";
}
public final int getSlotFlags() {
return 1;
}
public final synchronized void serviceStarted() throws Exception {
super.serviceStarted();
HttpsURLConnection.setDefaultSSLSocketFactory((SSLSocketFactory)this.getClientSocketFactory(BTlsEnum.tlsv1.getTag()));
BISession bISession = this.getSession();
if (bISession instanceof BLocalHost) {
this.cryptoManager = CoreCryptoManager.get((ISecurityInfoProvider)Nre.getSecurityInfoProvider());
} else if (bISession instanceof BFoxSession) {
this.cryptoManager = new ChannelCryptoManager((BComponent)this);
} else {
throw new Exception("unrecognized session: " + bISession.getClass().getName());
}
}
public final void serviceStopped() throws Exception {
super.serviceStopped();
BFoxChannelRegistry bFoxChannelRegistry = BFoxChannelRegistry.getPrototype();
if (bFoxChannelRegistry.get("crypto") != null) {
bFoxChannelRegistry.remove("crypto");
}
}
public final BIcon getIcon() {
return icon;
}
public final boolean hasNavChildren() {
return false;
}
public final synchronized IKeyStore getTrustStore() throws Exception {
if (this.trustKeyStore == null) {
this.trustKeyStore = new NKeyStore(this.cryptoManager.getTrustStore());
}
return this.trustKeyStore;
}
public final synchronized IKeyStore getKeyStore() throws Exception {
if (this.keyStore == null) {
this.keyStore = new NKeyStore(this.cryptoManager.getKeyStore());
}
return this.keyStore;
}
public final synchronized ICoreExemptionStore getExemptionStore() throws Exception {
if (this.exemptionStore == null) {
this.exemptionStore = new NExemptionStore(this.cryptoManager.getExemptionStore());
}
return this.exemptionStore;
}
public final synchronized IProviderInfo getProviderInfo() throws Exception {
if (this.providerInfo == null) {
this.providerInfo = new NProviderInfo(this.cryptoManager.getProviderInfo());
}
return this.providerInfo;
}
public final File getBaseDir() {
try {
return new File(BCertManagerService.getFilePath(BOrd.make((String)"file:!")));
}
catch (Exception exception) {
return Sys.getBajaHome();
}
}
public final IServerSocketFactory getServerSocketFactory(BSslTlsEnum bSslTlsEnum, boolean bl, String string) throws Exception {
return this.getServerSocketFactory(BTlsEnum.tlsv1.getTag(), bl, string);
}
public final IServerSocketFactory getServerSocketFactory(String string, boolean bl, String string2) throws Exception {
return new CryptoServerSocketFactory(Nre.getSecurityInfoProvider(), string, bl, string2);
}
public final IClientSocketFactory getClientSocketFactory(BSslTlsEnum bSslTlsEnum) throws Exception {
return new CryptoClientSocketFactory(Nre.getSecurityInfoProvider(), bSslTlsEnum.getTag());
}
public final IClientSocketFactory getClientSocketFactory(String string) throws Exception {
return new CryptoClientSocketFactory(Nre.getSecurityInfoProvider(), string);
}
public final String getClientSocketFactoryClass(BSslTlsEnum bSslTlsEnum) throws Exception {
return this.getClientSocketFactoryClass(BTlsEnum.tlsv1.getTag());
}
public final String getClientSocketFactoryClass(String string) throws Exception {
CryptoClientNoArgSocketFactory.setBaseDir(Nre.getSecurityInfoProvider());
Class clazz = class$com$tridium$platcrypto$socket$CryptoClientTlsSocketFactory;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$socket$CryptoClientTlsSocketFactory = BCertManagerService.class("[Lcom.tridium.platcrypto.socket.CryptoClientTlsSocketFactory;", false);
}
return clazz.getCanonicalName();
}
public final ICryptoManagerEx getCryptoManager() {
return this;
}
public final synchronized ICoreCryptoManager getCoreCryptoManager() throws Exception {
if (this.cryptoManager == null) {
BISession bISession = this.getSession();
if (bISession instanceof BLocalHost) {
this.cryptoManager = CoreCryptoManager.get((ISecurityInfoProvider)Nre.getSecurityInfoProvider(), (ILogger)new Logger(Log.getLog((String)"crypto")));
} else if (bISession instanceof BFoxSession) {
this.cryptoManager = new ChannelCryptoManager((BComponent)this);
} else {
throw new Exception("unrecognized session: " + bISession.getClass().getName());
}
}
return this.cryptoManager;
}
private static final String getFilePath(BOrd bOrd) throws IOException {
OrdQuery[] ordQueryArray = bOrd.parse();
FilePath filePath = (FilePath)ordQueryArray[ordQueryArray.length - 1];
File file = BFileSystem.INSTANCE.pathToLocalFile(filePath);
return file.getPath();
}
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.cryptoManager = null;
this.trustKeyStore = null;
this.keyStore = null;
this.exemptionStore = null;
this.providerInfo = null;
}
public BCertManagerService() throws Exception {
this.this();
this.setPlatformServiceDescription(this.getLexicon().getText("CertManagerService.description"));
BFoxChannelRegistry bFoxChannelRegistry = BFoxChannelRegistry.getPrototype();
if (bFoxChannelRegistry.get("crypto") == null) {
bFoxChannelRegistry.add("crypto", (BValue)new BCryptoChannel());
}
}
static {
Class clazz = class$com$tridium$platcrypto$core$BCertManagerService;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$core$BCertManagerService = BCertManagerService.class("[Lcom.tridium.platcrypto.core.BCertManagerService;", false);
}
TYPE = Sys.loadType((Class)clazz);
icon = BIcon.std((String)"files/certificate.png");
}
}
@@ -0,0 +1,169 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.io.ICoreCryptoManager
* com.tridium.crypto.core.io.ICoreExemptionStore
* javax.baja.io.net.IClientSocketFactory
* javax.baja.io.net.IServerSocketFactory
* javax.baja.log.Log
* javax.baja.security.crypto.BSslTlsEnum
* javax.baja.security.crypto.IKeyStore
* javax.baja.status.BStatus
* javax.baja.sys.BComponent
* javax.baja.sys.BIcon
* javax.baja.sys.BValue
* javax.baja.sys.Property
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.util.Lexicon
*/
package com.tridium.platcrypto.core;
import com.tridium.crypto.core.io.ICoreCryptoManager;
import com.tridium.crypto.core.io.ICoreExemptionStore;
import com.tridium.platcrypto.core.IExtCryptoManager;
import com.tridium.platcrypto.core.IProviderInfo;
import com.tridium.platcrypto.core.WbAppletCryptoManager;
import com.tridium.platcrypto.socket.CryptoWbAppletClientSocketFactory;
import java.io.File;
import java.io.IOException;
import java.security.GeneralSecurityException;
import javax.baja.io.net.IClientSocketFactory;
import javax.baja.io.net.IServerSocketFactory;
import javax.baja.log.Log;
import javax.baja.security.crypto.BSslTlsEnum;
import javax.baja.security.crypto.IKeyStore;
import javax.baja.status.BStatus;
import javax.baja.sys.BComponent;
import javax.baja.sys.BIcon;
import javax.baja.sys.BValue;
import javax.baja.sys.Property;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.util.Lexicon;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BWbAppletCertManager
extends BComponent
implements IExtCryptoManager {
public static final Property status = BWbAppletCertManager.newProperty((int)3, (BValue)BStatus.stale, null);
public static final Property javaxNetDebug = BWbAppletCertManager.newProperty((int)0, (boolean)false, null);
public static final Property unrestrictedPolicyFiles = BWbAppletCertManager.newProperty((int)3, (boolean)false, null);
public static final Type TYPE;
private static Log log;
private static Lexicon lex;
private static final BIcon icon;
static /* synthetic */ Class class$com$tridium$platcrypto$core$BWbAppletCertManager;
public BStatus getStatus() {
return (BStatus)this.get(status);
}
public void setStatus(BStatus bStatus) {
this.set(status, (BValue)bStatus, null);
}
public boolean getJavaxNetDebug() {
return this.getBoolean(javaxNetDebug);
}
public void setJavaxNetDebug(boolean bl) {
this.setBoolean(javaxNetDebug, bl, null);
}
public boolean getUnrestrictedPolicyFiles() {
return this.getBoolean(unrestrictedPolicyFiles);
}
public void setUnrestrictedPolicyFiles(boolean bl) {
this.setBoolean(unrestrictedPolicyFiles, bl, null);
}
public Type getType() {
return TYPE;
}
public static BWbAppletCertManager make() throws Exception {
return new BWbAppletCertManager();
}
public synchronized IKeyStore getTrustStore() throws IOException, GeneralSecurityException {
throw new UnsupportedOperationException("not supported by the applet");
}
public synchronized IKeyStore getKeyStore() throws IOException, GeneralSecurityException {
throw new UnsupportedOperationException("not supported by the applet");
}
public ICoreExemptionStore getExemptionStore() throws IOException {
throw new UnsupportedOperationException("not supported by the applet");
}
public IProviderInfo getProviderInfo() throws IOException {
throw new UnsupportedOperationException("not supported by the applet");
}
public IServerSocketFactory getServerSocketFactory(BSslTlsEnum bSslTlsEnum, boolean bl, String string) throws Exception {
throw new UnsupportedOperationException("not supported by the applet");
}
public IServerSocketFactory getServerSocketFactory(String string, boolean bl, String string2) throws Exception {
throw new UnsupportedOperationException("not supported by the applet");
}
public IClientSocketFactory getClientSocketFactory(BSslTlsEnum bSslTlsEnum) throws Exception {
return new CryptoWbAppletClientSocketFactory(bSslTlsEnum.getTag());
}
public IClientSocketFactory getClientSocketFactory(String string) throws Exception {
return new CryptoWbAppletClientSocketFactory(string);
}
public String getClientSocketFactoryClass(BSslTlsEnum bSslTlsEnum) throws Exception {
throw new UnsupportedOperationException("not supported by the applet");
}
public String getClientSocketFactoryClass(String string) throws Exception {
throw new UnsupportedOperationException("not supported by the applet");
}
public ICoreCryptoManager getCoreCryptoManager() {
return new WbAppletCryptoManager();
}
public File getBaseDir() {
throw new UnsupportedOperationException("not supported by the applet");
}
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$core$BWbAppletCertManager;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$core$BWbAppletCertManager = BWbAppletCertManager.class("[Lcom.tridium.platcrypto.core.BWbAppletCertManager;", false);
}
TYPE = Sys.loadType((Class)clazz);
log = Log.getLog((String)"crypto");
lex = Lexicon.make((String)"platCrypto");
icon = BIcon.make((String)lex.get("cert.x16.icon", "module://icons/x16/lock.png"));
}
}
@@ -0,0 +1,213 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.io.CoreCryptoManager
* com.tridium.crypto.core.io.ICoreCryptoManager
* com.tridium.crypto.core.io.ICoreExemptionStore
* com.tridium.nre.security.ISecurityInfoProvider
* com.tridium.sys.Nre
* javax.baja.file.BFileSystem
* javax.baja.file.FilePath
* javax.baja.io.net.IClientSocketFactory
* javax.baja.io.net.IServerSocketFactory
* javax.baja.log.Log
* javax.baja.naming.BOrd
* javax.baja.naming.OrdQuery
* javax.baja.security.crypto.BSslTlsEnum
* javax.baja.security.crypto.BTlsEnum
* javax.baja.security.crypto.IKeyStore
* javax.baja.sys.BComponent
* javax.baja.sys.BIcon
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.util.Lexicon
*/
package com.tridium.platcrypto.core;
import com.tridium.crypto.core.io.CoreCryptoManager;
import com.tridium.crypto.core.io.ICoreCryptoManager;
import com.tridium.crypto.core.io.ICoreExemptionStore;
import com.tridium.nre.security.ISecurityInfoProvider;
import com.tridium.platcrypto.core.IExtCryptoManager;
import com.tridium.platcrypto.core.IProviderInfo;
import com.tridium.platcrypto.core.NExemptionStore;
import com.tridium.platcrypto.core.NKeyStore;
import com.tridium.platcrypto.core.NProviderInfo;
import com.tridium.platcrypto.socket.CryptoWbClientSocketFactory;
import com.tridium.sys.Nre;
import java.io.File;
import java.io.IOException;
import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import javax.baja.file.BFileSystem;
import javax.baja.file.FilePath;
import javax.baja.io.net.IClientSocketFactory;
import javax.baja.io.net.IServerSocketFactory;
import javax.baja.log.Log;
import javax.baja.naming.BOrd;
import javax.baja.naming.OrdQuery;
import javax.baja.security.crypto.BSslTlsEnum;
import javax.baja.security.crypto.BTlsEnum;
import javax.baja.security.crypto.IKeyStore;
import javax.baja.sys.BComponent;
import javax.baja.sys.BIcon;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.util.Lexicon;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLSocketFactory;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BWbCertManager
extends BComponent
implements IExtCryptoManager {
public static final Type TYPE;
private static Log log;
private static Lexicon lex;
private static final BIcon icon;
private ICoreCryptoManager cryptoManager;
private NKeyStore trustKeyStore;
private NKeyStore keyStore;
private NExemptionStore exemptionStore;
private NProviderInfo providerInfo;
static /* synthetic */ Class class$com$tridium$platcrypto$core$BWbCertManager;
public Type getType() {
return TYPE;
}
public static BWbCertManager make() throws Exception {
return new BWbCertManager();
}
public synchronized IKeyStore getTrustStore() throws Exception {
if (this.trustKeyStore == null) {
this.trustKeyStore = new NKeyStore(this.cryptoManager.getTrustStore());
}
return this.trustKeyStore;
}
public synchronized IKeyStore getKeyStore() throws Exception {
if (this.keyStore == null) {
this.keyStore = new NKeyStore(this.cryptoManager.getKeyStore());
}
return this.keyStore;
}
public synchronized ICoreExemptionStore getExemptionStore() throws Exception {
if (this.exemptionStore == null) {
this.exemptionStore = new NExemptionStore(this.cryptoManager.getExemptionStore());
}
return this.exemptionStore;
}
public synchronized IProviderInfo getProviderInfo() throws Exception {
if (this.providerInfo == null) {
this.providerInfo = new NProviderInfo(this.cryptoManager.getProviderInfo());
}
return this.providerInfo;
}
public File getBaseDir() {
try {
return new File(BWbCertManager.getFilePath(BOrd.make((String)"file:!workbench")));
}
catch (Exception exception) {
return new File(Sys.getBajaHome(), "workbench");
}
}
public IServerSocketFactory getServerSocketFactory(BSslTlsEnum bSslTlsEnum, boolean bl, String string) throws Exception {
throw new UnsupportedOperationException("not supported by workbench");
}
public IServerSocketFactory getServerSocketFactory(String string, boolean bl, String string2) throws Exception {
throw new UnsupportedOperationException("not supported by workbench");
}
public IClientSocketFactory getClientSocketFactory(BSslTlsEnum bSslTlsEnum) throws Exception {
return new CryptoWbClientSocketFactory(Nre.getSecurityInfoProvider(), bSslTlsEnum.getTag());
}
public IClientSocketFactory getClientSocketFactory(String string) throws Exception {
return new CryptoWbClientSocketFactory(Nre.getSecurityInfoProvider(), string);
}
public String getClientSocketFactoryClass(BSslTlsEnum bSslTlsEnum) throws Exception {
throw new UnsupportedOperationException("not supported by the workbench");
}
public String getClientSocketFactoryClass(String string) throws Exception {
throw new UnsupportedOperationException("not supported by the workbench");
}
public ICoreCryptoManager getCoreCryptoManager() {
return this.cryptoManager;
}
private static final String getFilePath(BOrd bOrd) throws IOException {
OrdQuery[] ordQueryArray = bOrd.parse();
FilePath filePath = (FilePath)ordQueryArray[ordQueryArray.length - 1];
File file = BFileSystem.INSTANCE.pathToLocalFile(filePath);
return file.getPath();
}
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());
}
}
private final /* synthetic */ void this() {
this.cryptoManager = null;
this.trustKeyStore = null;
this.keyStore = null;
this.exemptionStore = null;
this.providerInfo = null;
}
public BWbCertManager() throws Exception {
this.this();
log.trace("WbCryptoFactory started");
try {
AccessController.doPrivileged(new PrivilegedExceptionAction(){
public final Object run() throws Exception {
HttpsURLConnection.setDefaultSSLSocketFactory((SSLSocketFactory)BWbCertManager.this.getClientSocketFactory(BTlsEnum.DEFAULT.getTag()));
return null;
}
});
}
catch (PrivilegedActionException privilegedActionException) {
throw privilegedActionException.getException();
}
this.cryptoManager = CoreCryptoManager.get((ISecurityInfoProvider)Nre.getSecurityInfoProvider());
}
static {
Class clazz = class$com$tridium$platcrypto$core$BWbCertManager;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$core$BWbCertManager = BWbCertManager.class("[Lcom.tridium.platcrypto.core.BWbCertManager;", false);
}
TYPE = Sys.loadType((Class)clazz);
log = Log.getLog((String)"crypto");
lex = Lexicon.make((String)"platCrypto");
icon = BIcon.std((String)"files/certificate.png");
}
}
@@ -0,0 +1,237 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.cert.NX509Certificate
* com.tridium.crypto.core.cert.NX509CertificateEntry
* javax.baja.nre.util.ByteArrayUtil
* javax.baja.sys.BAbsTime
* javax.baja.sys.BComponent
* javax.baja.sys.BValue
* javax.baja.sys.Property
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platcrypto.core;
import com.tridium.crypto.core.cert.NX509Certificate;
import com.tridium.crypto.core.cert.NX509CertificateEntry;
import javax.baja.nre.util.ByteArrayUtil;
import javax.baja.sys.BAbsTime;
import javax.baja.sys.BComponent;
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 BX509Certificate
extends BComponent {
public static final Property alias = BX509Certificate.newProperty((int)3, (String)"", null);
public static final Property version = BX509Certificate.newProperty((int)3, (String)"", null);
public static final Property serialNumber = BX509Certificate.newProperty((int)3, (String)"", null);
public static final Property issuerDN = BX509Certificate.newProperty((int)3, (String)"", null);
public static final Property subjectDN = BX509Certificate.newProperty((int)3, (String)"", null);
public static final Property notBefore = BX509Certificate.newProperty((int)3, (BValue)BAbsTime.DEFAULT, null);
public static final Property notAfter = BX509Certificate.newProperty((int)3, (BValue)BAbsTime.DEFAULT, null);
public static final Property keyAlgorithm = BX509Certificate.newProperty((int)3, (String)"", null);
public static final Property keySize = BX509Certificate.newProperty((int)3, (int)0, null);
public static final Property signatureAlgorithm = BX509Certificate.newProperty((int)3, (String)"", null);
public static final Property signatureSize = BX509Certificate.newProperty((int)3, (int)0, null);
public static final Property basicConstraints = BX509Certificate.newProperty((int)3, (String)"", null);
public static final Property keyUsage = BX509Certificate.newProperty((int)3, (String)"", null);
public static final Property ExtendedKeyUsage = BX509Certificate.newProperty((int)3, (String)"", null);
public static final Property md5Fingerprint = BX509Certificate.newProperty((int)3, (String)"", null);
public static final Property sha1Fingerprint = BX509Certificate.newProperty((int)3, (String)"", null);
public static final Property valid = BX509Certificate.newProperty((int)3, (boolean)false, null);
public static final Type TYPE;
static /* synthetic */ Class class$com$tridium$platcrypto$core$BX509Certificate;
public String getAlias() {
return this.getString(alias);
}
public void setAlias(String string) {
this.setString(alias, string, null);
}
public String getVersion() {
return this.getString(version);
}
public void setVersion(String string) {
this.setString(version, string, null);
}
public String getSerialNumber() {
return this.getString(serialNumber);
}
public void setSerialNumber(String string) {
this.setString(serialNumber, string, null);
}
public String getIssuerDN() {
return this.getString(issuerDN);
}
public void setIssuerDN(String string) {
this.setString(issuerDN, string, null);
}
public String getSubjectDN() {
return this.getString(subjectDN);
}
public void setSubjectDN(String string) {
this.setString(subjectDN, string, null);
}
public BAbsTime getNotBefore() {
return (BAbsTime)this.get(notBefore);
}
public void setNotBefore(BAbsTime bAbsTime) {
this.set(notBefore, (BValue)bAbsTime, null);
}
public BAbsTime getNotAfter() {
return (BAbsTime)this.get(notAfter);
}
public void setNotAfter(BAbsTime bAbsTime) {
this.set(notAfter, (BValue)bAbsTime, null);
}
public String getKeyAlgorithm() {
return this.getString(keyAlgorithm);
}
public void setKeyAlgorithm(String string) {
this.setString(keyAlgorithm, string, null);
}
public int getKeySize() {
return this.getInt(keySize);
}
public void setKeySize(int n) {
this.setInt(keySize, n, null);
}
public String getSignatureAlgorithm() {
return this.getString(signatureAlgorithm);
}
public void setSignatureAlgorithm(String string) {
this.setString(signatureAlgorithm, string, null);
}
public int getSignatureSize() {
return this.getInt(signatureSize);
}
public void setSignatureSize(int n) {
this.setInt(signatureSize, n, null);
}
public String getBasicConstraints() {
return this.getString(basicConstraints);
}
public void setBasicConstraints(String string) {
this.setString(basicConstraints, string, null);
}
public String getKeyUsage() {
return this.getString(keyUsage);
}
public void setKeyUsage(String string) {
this.setString(keyUsage, string, null);
}
public String getExtendedKeyUsage() {
return this.getString(ExtendedKeyUsage);
}
public void setExtendedKeyUsage(String string) {
this.setString(ExtendedKeyUsage, string, null);
}
public String getMd5Fingerprint() {
return this.getString(md5Fingerprint);
}
public void setMd5Fingerprint(String string) {
this.setString(md5Fingerprint, string, null);
}
public String getSha1Fingerprint() {
return this.getString(sha1Fingerprint);
}
public void setSha1Fingerprint(String string) {
this.setString(sha1Fingerprint, string, null);
}
public boolean getValid() {
return this.getBoolean(valid);
}
public void setValid(boolean bl) {
this.setBoolean(valid, bl, null);
}
public Type getType() {
return TYPE;
}
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 BX509Certificate() {
}
public BX509Certificate(NX509CertificateEntry nX509CertificateEntry) {
this.setAlias(nX509CertificateEntry.getAlias());
NX509Certificate nX509Certificate = nX509CertificateEntry.getCertificate(0);
this.setVersion("v" + nX509Certificate.getVersion());
this.setSerialNumber(ByteArrayUtil.toHexString((byte[])nX509Certificate.getSerialNumber().toByteArray(), (String)" "));
this.setIssuerDN(nX509Certificate.getIssuerDN().toString());
this.setSubjectDN(nX509Certificate.getSubjectDN().toString());
this.setNotBefore(BAbsTime.make((long)nX509Certificate.getNotBefore().getTime()));
this.setNotAfter(BAbsTime.make((long)nX509Certificate.getNotAfter().getTime()));
this.setKeyAlgorithm(nX509Certificate.getKeyAlgorithm());
this.setKeySize(nX509Certificate.getKeySize());
this.setSignatureAlgorithm(nX509Certificate.getSignatureAlgorithm());
this.setSignatureSize(nX509Certificate.getSignatureSize());
this.setBasicConstraints(nX509Certificate.getBasicConstraints());
this.setKeyUsage(nX509Certificate.getKeyUsage());
this.setExtendedKeyUsage(nX509Certificate.getExtendedKeyUsage());
this.setMd5Fingerprint(nX509Certificate.getMD5Fingerprint());
this.setSha1Fingerprint(nX509Certificate.getSHA1Fingerprint());
this.setValid(nX509Certificate.checkValidity());
}
static {
Class clazz = class$com$tridium$platcrypto$core$BX509Certificate;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$core$BX509Certificate = BX509Certificate.class("[Lcom.tridium.platcrypto.core.BX509Certificate;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,14 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.io.ICoreCryptoManager
*/
package com.tridium.platcrypto.core;
import com.tridium.crypto.core.io.ICoreCryptoManager;
public interface ICryptoManagerProvider {
public ICoreCryptoManager getCoreCryptoManager() throws Exception;
}
@@ -0,0 +1,27 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.io.ICoreCryptoManager
* com.tridium.crypto.core.io.ICoreExemptionStore
* javax.baja.security.crypto.ICryptoManagerEx
*/
package com.tridium.platcrypto.core;
import com.tridium.crypto.core.io.ICoreCryptoManager;
import com.tridium.crypto.core.io.ICoreExemptionStore;
import com.tridium.platcrypto.core.IProviderInfo;
import java.io.File;
import javax.baja.security.crypto.ICryptoManagerEx;
public interface IExtCryptoManager
extends ICryptoManagerEx {
public ICoreExemptionStore getExemptionStore() throws Exception;
public IProviderInfo getProviderInfo() throws Exception;
public File getBaseDir();
public ICoreCryptoManager getCoreCryptoManager() throws Exception;
}
@@ -0,0 +1,17 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.provider.IProvider
*/
package com.tridium.platcrypto.core;
import com.tridium.crypto.core.provider.IProvider;
import java.util.Enumeration;
public interface IProviderInfo {
public Enumeration providers() throws Exception;
public IProvider getProvider(String var1) throws Exception;
}
@@ -0,0 +1,51 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.cert.NHostExemption
* com.tridium.crypto.core.io.ICoreExemptionStore
*/
package com.tridium.platcrypto.core;
import com.tridium.crypto.core.cert.NHostExemption;
import com.tridium.crypto.core.io.ICoreExemptionStore;
import java.io.IOException;
import java.util.Enumeration;
public class NExemptionStore
implements ICoreExemptionStore {
private ICoreExemptionStore exemptionStore;
public Enumeration exemptions() throws Exception {
return this.exemptionStore.exemptions();
}
public NHostExemption getExemption(String string) throws Exception {
return this.exemptionStore.getExemption(string);
}
public void setExemption(NHostExemption nHostExemption) throws Exception {
this.exemptionStore.setExemption(nHostExemption);
}
public void deleteExemption(String string) throws Exception {
this.exemptionStore.deleteExemption(string);
}
public long getLastModified() throws Exception {
return this.exemptionStore.getLastModified();
}
public void load() throws Exception {
this.exemptionStore.load();
}
public void save() throws IOException, Exception {
this.exemptionStore.save();
}
public NExemptionStore(ICoreExemptionStore iCoreExemptionStore) {
this.exemptionStore = iCoreExemptionStore;
}
}
@@ -0,0 +1,133 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.cert.NPKCS10CertificationRequest
* com.tridium.crypto.core.io.ICoreKeyStore
* javax.baja.security.crypto.IKeyStore
*/
package com.tridium.platcrypto.core;
import com.tridium.crypto.core.cert.NPKCS10CertificationRequest;
import com.tridium.crypto.core.io.ICoreKeyStore;
import java.security.Key;
import java.security.KeyStore;
import java.security.cert.X509Certificate;
import java.util.Date;
import java.util.Enumeration;
import javax.baja.security.crypto.IKeyStore;
public class NKeyStore
implements IKeyStore,
ICoreKeyStore {
private ICoreKeyStore keyStore;
public Enumeration aliases() throws Exception {
return this.keyStore.aliases();
}
public boolean containsAlias(String string) throws Exception {
return this.keyStore.containsAlias(string);
}
public void deleteEntry(String string) throws Exception {
this.keyStore.deleteEntry(string);
}
public X509Certificate getCertificate(String string) throws Exception {
return this.keyStore.getCertificate(string);
}
public String getCertificateAlias(X509Certificate x509Certificate) throws Exception {
return this.keyStore.getCertificateAlias(x509Certificate);
}
public X509Certificate[] getCertificateChain(String string) throws Exception {
return this.keyStore.getCertificateChain(string);
}
public Date getCreationDate(String string) throws Exception {
return this.keyStore.getCreationDate(string);
}
public Key getKey(String string, char[] cArray) throws Exception {
return this.keyStore.getKey(string, cArray);
}
public boolean isCertificateEntry(String string) throws Exception {
return this.keyStore.isCertificateEntry(string);
}
public boolean isKeyEntry(String string) throws Exception {
return this.keyStore.isKeyEntry(string);
}
public void setCertificateEntry(String string, X509Certificate x509Certificate) throws Exception {
this.keyStore.setCertificateEntry(string, x509Certificate);
}
public void setKeyEntry(String string, byte[] byArray, X509Certificate[] x509CertificateArray) throws Exception {
this.keyStore.setKeyEntry(string, byArray, x509CertificateArray);
}
public void setKeyEntry(String string, Key key, char[] cArray, X509Certificate[] x509CertificateArray) throws Exception {
this.keyStore.setKeyEntry(string, key, cArray, x509CertificateArray);
}
public int size() throws Exception {
return this.keyStore.size();
}
public Enumeration getCertificates() throws Exception {
return this.keyStore.getCertificates();
}
public String findCertificate(X509Certificate x509Certificate) throws Exception {
return this.keyStore.findCertificate(x509Certificate);
}
public void deleteEntries(String[] stringArray) throws Exception {
this.keyStore.deleteEntries(stringArray);
}
public int generateSelfSignedCert(String string, String string2, String string3, String string4, String string5, String string6, String string7, Date date, Date date2, int n, int n2, String string8, String string9) throws Exception {
return this.keyStore.generateSelfSignedCert(string, string2, string3, string4, string5, string6, string7, date, date2, n, n2, string8, string9);
}
public int generateSelfSignedCert(String string, String string2, Date date, Date date2, int n, int n2, String string3, String string4) throws Exception {
return this.keyStore.generateSelfSignedCert(string, string2, date, date2, n, n2, string3, string4);
}
public NPKCS10CertificationRequest generateCSR(String string, String string2) throws Exception {
return this.keyStore.generateCSR(string, string2);
}
public int getCertGenerationStatus(int n) throws Exception {
return this.keyStore.getCertGenerationStatus(n);
}
public long getLastModified() throws Exception {
return this.keyStore.getLastModified();
}
public void load() throws Exception {
this.keyStore.load();
}
public void save() throws Exception {
this.keyStore.save();
}
public KeyStore getKeyStore() throws Exception {
return this.keyStore.getKeyStore();
}
public boolean canGenerateCertificate() {
return true;
}
public NKeyStore(ICoreKeyStore iCoreKeyStore) {
this.keyStore = iCoreKeyStore;
}
}
@@ -0,0 +1,32 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.io.ICoreProviderInfo
* com.tridium.crypto.core.provider.IProvider
*/
package com.tridium.platcrypto.core;
import com.tridium.crypto.core.io.ICoreProviderInfo;
import com.tridium.crypto.core.provider.IProvider;
import com.tridium.platcrypto.core.IProviderInfo;
import java.util.Enumeration;
public class NProviderInfo
implements IProviderInfo,
ICoreProviderInfo {
private ICoreProviderInfo providerInfo;
public Enumeration providers() throws Exception {
return this.providerInfo.providers();
}
public IProvider getProvider(String string) throws Exception {
return this.providerInfo.getProvider(string);
}
public NProviderInfo(ICoreProviderInfo iCoreProviderInfo) {
this.providerInfo = iCoreProviderInfo;
}
}
@@ -0,0 +1,59 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.io.CoreKeyStore
* com.tridium.crypto.core.io.ICoreCryptoManager
* com.tridium.crypto.core.io.ICoreExemptionStore
* com.tridium.crypto.core.io.ICoreKeyStore
* com.tridium.crypto.core.io.ICoreProviderInfo
*/
package com.tridium.platcrypto.core;
import com.tridium.crypto.core.io.CoreKeyStore;
import com.tridium.crypto.core.io.ICoreCryptoManager;
import com.tridium.crypto.core.io.ICoreExemptionStore;
import com.tridium.crypto.core.io.ICoreKeyStore;
import com.tridium.crypto.core.io.ICoreProviderInfo;
import java.io.File;
import java.io.FileNotFoundException;
public class WbAppletCryptoManager
implements ICoreCryptoManager {
public ICoreKeyStore getKeyStore() throws Exception {
throw new UnsupportedOperationException("not supported by the applet");
}
public ICoreKeyStore getTrustStore() throws Exception {
File file = null;
String string = System.getProperty("javax.net.ssl.trustStore", null);
String string2 = System.getProperty("javax.net.ssl.trustStorePassword", "changeit");
if (string != null) {
file = new File(string);
}
if (string == null || !file.exists()) {
file = new File(System.getProperty("java.home"), "lib/security/jssecacerts");
}
if (!file.exists()) {
file = new File(System.getProperty("java.home"), "lib/security/cacerts");
}
if (!file.exists()) {
throw new FileNotFoundException("Unable to find default truststore");
}
CoreKeyStore coreKeyStore = new CoreKeyStore((ICoreCryptoManager)this, file, string2.toCharArray(), null);
return coreKeyStore;
}
public ICoreExemptionStore getExemptionStore() throws Exception {
return null;
}
public ICoreProviderInfo getProviderInfo() throws Exception {
throw new UnsupportedOperationException("not supported by the applet");
}
public boolean isSecure() {
throw new UnsupportedOperationException("not supported by the applet");
}
}
@@ -0,0 +1,155 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.platform.daemon.BDaemonScheme$DaemonQuery
* com.tridium.platform.daemon.BDaemonSession
* javax.baja.naming.BHost
* javax.baja.naming.BOrdScheme
* javax.baja.naming.InvalidOrdBaseException
* javax.baja.naming.OrdQuery
* javax.baja.naming.OrdTarget
* javax.baja.naming.SyntaxException
* javax.baja.naming.UnresolvedException
* javax.baja.security.AuthenticationException
* javax.baja.sys.BObject
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platcrypto.daemon;
import com.tridium.platcrypto.daemon.BDaemonSecureSession;
import com.tridium.platform.daemon.BDaemonScheme;
import com.tridium.platform.daemon.BDaemonSession;
import javax.baja.naming.BHost;
import javax.baja.naming.BOrdScheme;
import javax.baja.naming.InvalidOrdBaseException;
import javax.baja.naming.OrdQuery;
import javax.baja.naming.OrdTarget;
import javax.baja.naming.SyntaxException;
import javax.baja.naming.UnresolvedException;
import javax.baja.security.AuthenticationException;
import javax.baja.sys.BObject;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BDaemonSecureScheme
extends BOrdScheme {
public static final BDaemonSecureScheme INSTANCE = new BDaemonSecureScheme();
public static final int DEFAULT_PORT = 5011;
public static final Type TYPE;
static /* synthetic */ Class class$com$tridium$platcrypto$daemon$BDaemonSecureScheme;
public OrdQuery parse(String string) {
return new DaemonQuery(string);
}
public OrdTarget resolve(OrdTarget ordTarget, OrdQuery ordQuery) throws SyntaxException, UnresolvedException {
if (!(ordTarget.get() instanceof BHost)) {
throw new InvalidOrdBaseException();
}
BHost bHost = (BHost)ordTarget.get();
BDaemonScheme.DaemonQuery daemonQuery = (BDaemonScheme.DaemonQuery)ordQuery;
int n = daemonQuery == null ? 5011 : daemonQuery.getPort();
String[] stringArray = daemonQuery == null ? null : daemonQuery.getTunnelAuthorities();
BDaemonSession bDaemonSession = null;
try {
bDaemonSession = BDaemonSecureSession.make(bHost, n, stringArray);
bDaemonSession.connect();
}
catch (AuthenticationException authenticationException) {
if (bDaemonSession != null) {
bDaemonSession.disconnect();
}
throw authenticationException;
}
catch (Exception exception) {
throw new UnresolvedException(ordQuery.toString(), (Throwable)exception);
}
return new OrdTarget(ordTarget, (BObject)bDaemonSession);
}
static String[] validateAuthorities(String[] stringArray) {
if (stringArray == null) {
return null;
}
int n = stringArray.length;
if (n < 1) {
return null;
}
String[] stringArray2 = new String[n];
int n2 = 0;
int n3 = 0;
while (n3 < n) {
if (stringArray[n3] != null && !stringArray[n3].equals("")) {
stringArray2[n2] = stringArray[n3];
++n2;
}
++n3;
}
String[] stringArray3 = new String[n2];
System.arraycopy(stringArray2, 0, stringArray3, 0, n2);
return stringArray3;
}
public Type getType() {
return TYPE;
}
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 BDaemonSecureScheme() {
super("platformssl");
}
static {
Class clazz = class$com$tridium$platcrypto$daemon$BDaemonSecureScheme;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$daemon$BDaemonSecureScheme = BDaemonSecureScheme.class("[Lcom.tridium.platcrypto.daemon.BDaemonSecureScheme;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
public static class DaemonQuery
extends BDaemonScheme.DaemonQuery
implements OrdQuery {
public String getScheme() {
return "platformssl";
}
public String toString() {
return "platformssl:" + this.getBody();
}
public int getDefaultPort() {
return 5011;
}
DaemonQuery(String string) {
super(string);
}
DaemonQuery(int n) {
super(n);
}
DaemonQuery(int n, String[] stringArray) {
super(n, stringArray);
}
}
}
@@ -0,0 +1,254 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.net.HttpUtil
* com.tridium.platform.BPlatformSSLSettings
* com.tridium.platform.daemon.BDaemonSession
* com.tridium.util.BSessionInfo
* javax.baja.io.net.IClientSocketFactory
* javax.baja.naming.BHost
* javax.baja.naming.BOrd
* javax.baja.naming.OrdQuery
* javax.baja.nav.BINavNode
* javax.baja.net.HttpConnection
* javax.baja.net.HttpsConnection
* javax.baja.security.BIUserCredentials
* javax.baja.sys.BIcon
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.util.LexiconText
*/
package com.tridium.platcrypto.daemon;
import com.tridium.net.HttpUtil;
import com.tridium.platcrypto.daemon.BDaemonSecureScheme;
import com.tridium.platcrypto.util.BSslSessionInfo;
import com.tridium.platform.BPlatformSSLSettings;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.util.BSessionInfo;
import java.net.ConnectException;
import java.net.Socket;
import java.net.SocketException;
import javax.baja.io.net.IClientSocketFactory;
import javax.baja.naming.BHost;
import javax.baja.naming.BOrd;
import javax.baja.naming.OrdQuery;
import javax.baja.nav.BINavNode;
import javax.baja.net.HttpConnection;
import javax.baja.net.HttpsConnection;
import javax.baja.security.BIUserCredentials;
import javax.baja.sys.BIcon;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.util.LexiconText;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BDaemonSecureSession
extends BDaemonSession {
public static final String PLATFORM_SSL_ORD = "platformssl";
public static final Type TYPE;
private static final BIcon secureBadgeConnected;
private static final BIcon secureBadgeDisconnected;
private IClientSocketFactory socketFactory;
private Socket lastSocket;
private Object SOCKET_FACTORY_LOCK;
private BOrd ordInHost;
private BOrd absOrd;
static /* synthetic */ Class class$com$tridium$platcrypto$daemon$BDaemonSecureSession;
public Type getType() {
return TYPE;
}
protected BDaemonSession makeNewSession(BHost bHost, int n, String[] stringArray) {
return BDaemonSecureSession.make(bHost, n, stringArray);
}
public static BDaemonSession makeIgnoringCache(BHost bHost, int n, String[] stringArray) {
StringBuffer stringBuffer = new StringBuffer("noCache:");
stringBuffer.append(PLATFORM_SSL_ORD);
if (n != 5011) {
stringBuffer.append(":").append(n);
}
if (stringArray != null) {
int n2 = 0;
while (n2 < stringArray.length) {
if (stringArray[n2] != null) {
stringBuffer.append("/").append(stringArray[n2]);
}
++n2;
}
}
return new BDaemonSecureSession(stringBuffer.toString(), bHost, n, stringArray, BOrd.make((String)""));
}
public static BDaemonSession make(BHost bHost, int n, String[] stringArray) {
BDaemonSession bDaemonSession;
StringBuffer stringBuffer = new StringBuffer(PLATFORM_SSL_ORD);
if (n != 5011) {
stringBuffer.append(":").append(n);
}
if (stringArray != null) {
int n2 = 0;
while (n2 < stringArray.length) {
if (stringArray[n2] != null) {
stringBuffer.append("/").append(stringArray[n2]);
}
++n2;
}
}
if ((bDaemonSession = (BDaemonSession)bHost.getNavChild(stringBuffer.toString())) == null || !(bDaemonSession instanceof BDaemonSecureSession)) {
BOrd bOrd;
if (stringArray != null) {
int n3 = 0;
while (n3 < stringArray.length) {
HttpUtil.parseHost((String)stringArray[n3]);
HttpUtil.parsePort((String)stringArray[n3], (int)3011);
++n3;
}
bOrd = BOrd.make((OrdQuery)new BDaemonSecureScheme.DaemonQuery(n, stringArray));
} else {
bOrd = BOrd.make((OrdQuery)new BDaemonSecureScheme.DaemonQuery(n));
}
bDaemonSession = new BDaemonSecureSession(stringBuffer.toString(), bHost, n, stringArray, bOrd);
bHost.addNavChild((BINavNode)bDaemonSession);
}
return bDaemonSession;
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
protected HttpConnection createNewConnection(String string, long l, int n, int n2, String string2) throws SocketException {
try {
Object object = this.SOCKET_FACTORY_LOCK;
synchronized (object) {
if (this.socketFactory == null) {
this.socketFactory = HttpsConnection.getDefaultSocketFactory();
}
HttpsConnection httpsConnection = new HttpsConnection(this.getHost(), this.getPort(), string2, this.socketFactory);
return this.initConnection((HttpConnection)httpsConnection, string, l, n, n2);
}
}
catch (Exception exception) {
return null;
}
}
protected void setDefaultAgent() {
this.getAgentList().remove("platform:DaemonTunnelSessionAgent");
this.getAgentList().remove("platform:DaemonSessionAgent");
if (this.tunnelAuthorities != null) {
this.getAgentList().toTop("platformssl:DaemonSecureTunnelSessionAgent");
} else {
this.getAgentList().toTop("platformssl:DaemonSecureSessionAgent");
}
}
protected int connect(HttpConnection httpConnection) throws ConnectException {
int n = super.connect(httpConnection);
this.lastSocket = httpConnection.getSocket();
return n;
}
public BSessionInfo getSessionInfo() {
BHost bHost = this.getHost();
if (bHost != null) {
String string = null;
if (this.getCredentials() instanceof BIUserCredentials) {
string = ((BIUserCredentials)this.getCredentials()).getUsername();
}
return BSslSessionInfo.make(bHost.getHostname(), this.getLastConnectedAbsTime(), this.lastSocket, string);
}
return null;
}
public boolean shouldDowngrade(BPlatformSSLSettings bPlatformSSLSettings) {
return bPlatformSSLSettings.getSslEnabled() ^ true;
}
public boolean isSecure() {
return true;
}
protected String getLexiconPrefix() {
return "DaemonSecureSession.";
}
protected int getDefaultPort() {
return 5011;
}
public BIcon getIcon() {
return BIcon.make((BIcon)super.getIcon(), (BIcon)(this.isConnected() ? secureBadgeConnected : secureBadgeDisconnected));
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public synchronized void disconnect(boolean bl) {
super.disconnect(bl);
Object object = this.SOCKET_FACTORY_LOCK;
synchronized (object) {
this.socketFactory = null;
return;
}
}
public BOrd getNavOrd() {
return this.getAbsoluteOrd();
}
public BOrd getOrdInHost() {
return this.ordInHost;
}
public BOrd getAbsoluteOrd() {
return this.absOrd;
}
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.lastSocket = null;
this.SOCKET_FACTORY_LOCK = new Object();
}
protected BDaemonSecureSession(String string, BHost bHost, int n, String[] stringArray, BOrd bOrd) {
super(string, bHost, n, stringArray, bOrd, stringArray == null ? LexiconText.make((String)"platCrypto", (String)"daemon.secure.session") : LexiconText.make((String)"platCrypto", (String)"daemon.secure.tunnel.session"));
this.this();
this.ordInHost = bOrd;
this.absOrd = BOrd.make((BOrd)bHost.getAbsoluteOrd(), (BOrd)this.ordInHost);
}
static {
Class clazz = class$com$tridium$platcrypto$daemon$BDaemonSecureSession;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$daemon$BDaemonSecureSession = BDaemonSecureSession.class("[Lcom.tridium.platcrypto.daemon.BDaemonSecureSession;", false);
}
TYPE = Sys.loadType((Class)clazz);
secureBadgeConnected = BIcon.std((String)"badges/lock.png");
secureBadgeDisconnected = BIcon.std((String)"badges/lockDisconnected.png");
}
}
@@ -0,0 +1,100 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.platform.daemon.BDaemonSession
* com.tridium.platform.daemon.message.DaemonMessage
* javax.baja.security.AuthenticationException
* javax.baja.sys.BComponent
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.xml.XElem
* javax.baja.xml.XParser
*/
package com.tridium.platcrypto.daemon;
import com.tridium.platcrypto.daemon.messages.CryptoServletMessage;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.message.DaemonMessage;
import java.io.InputStream;
import java.net.ConnectException;
import javax.baja.security.AuthenticationException;
import javax.baja.sys.BComponent;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.xml.XElem;
import javax.baja.xml.XParser;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public abstract class BPlatCryptoBase
extends BComponent {
public static final Type TYPE;
private BDaemonSession session;
static /* synthetic */ Class class$com$tridium$platcrypto$daemon$BPlatCryptoBase;
public Type getType() {
return TYPE;
}
public XElem send(CryptoServletMessage cryptoServletMessage) throws ConnectException, AuthenticationException {
try {
if (cryptoServletMessage.getMethod().equals("POST")) {
return this.getDaemonSession().post((DaemonMessage)cryptoServletMessage);
}
InputStream inputStream = this.getDaemonSession().getInputStream((DaemonMessage)cryptoServletMessage);
XParser xParser = XParser.make((InputStream)inputStream);
if (xParser != null) {
return xParser.parse();
}
}
catch (Exception exception) {}
return null;
}
public XElem[] send(CryptoServletMessage cryptoServletMessage, String string) throws Exception {
XElem xElem;
InputStream inputStream = this.getDaemonSession().getInputStream((DaemonMessage)cryptoServletMessage);
XParser xParser = XParser.make((InputStream)inputStream);
if (xParser != null && (xElem = xParser.parse()) != null) {
XElem[] xElemArray = xElem.elems(string);
return xElemArray;
}
return new XElem[0];
}
public BDaemonSession getDaemonSession() {
return this.session;
}
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 BPlatCryptoBase() throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
public BPlatCryptoBase(BDaemonSession bDaemonSession) {
this.session = bDaemonSession;
}
static {
Class clazz = class$com$tridium$platcrypto$daemon$BPlatCryptoBase;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$daemon$BPlatCryptoBase = BPlatCryptoBase.class("[Lcom.tridium.platcrypto.daemon.BPlatCryptoBase;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,91 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.io.ICoreCryptoManager
* com.tridium.crypto.core.io.ICoreExemptionStore
* com.tridium.crypto.core.io.ICoreKeyStore
* com.tridium.crypto.core.io.ICoreProviderInfo
* com.tridium.platform.daemon.BDaemonSession
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platcrypto.daemon;
import com.tridium.crypto.core.io.ICoreCryptoManager;
import com.tridium.crypto.core.io.ICoreExemptionStore;
import com.tridium.crypto.core.io.ICoreKeyStore;
import com.tridium.crypto.core.io.ICoreProviderInfo;
import com.tridium.platcrypto.daemon.BPlatCryptoBase;
import com.tridium.platcrypto.daemon.BPlatExemptionStore;
import com.tridium.platcrypto.daemon.BPlatKeyStore;
import com.tridium.platcrypto.daemon.BPlatProviderInfo;
import com.tridium.platcrypto.daemon.BPlatTrustStore;
import com.tridium.platform.daemon.BDaemonSession;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BPlatCryptoManager
extends BPlatCryptoBase
implements ICoreCryptoManager {
public static final Type TYPE;
public static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
static /* synthetic */ Class class$com$tridium$platcrypto$daemon$BPlatCryptoManager;
public Type getType() {
return TYPE;
}
public ICoreExemptionStore getExemptionStore() throws Exception {
return new BPlatExemptionStore(this.getDaemonSession());
}
public ICoreKeyStore getKeyStore() throws Exception {
return new BPlatKeyStore(this.getDaemonSession());
}
public ICoreProviderInfo getProviderInfo() throws Exception {
return new BPlatProviderInfo(this.getDaemonSession());
}
public ICoreKeyStore getTrustStore() throws Exception {
return new BPlatTrustStore(this.getDaemonSession());
}
public boolean isSecure() {
return this.getDaemonSession().isSecure();
}
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 BPlatCryptoManager() throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
public BPlatCryptoManager(BDaemonSession bDaemonSession) {
super(bDaemonSession);
}
static {
Class clazz = class$com$tridium$platcrypto$daemon$BPlatCryptoManager;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$daemon$BPlatCryptoManager = BPlatCryptoManager.class("[Lcom.tridium.platcrypto.daemon.BPlatCryptoManager;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,216 @@
/*
* 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.daemon.BDaemonSession
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.xml.XElem
*/
package com.tridium.platcrypto.daemon;
import com.tridium.crypto.core.cert.NHostExemption;
import com.tridium.crypto.core.io.ICoreExemptionStore;
import com.tridium.platcrypto.daemon.BPlatCryptoBase;
import com.tridium.platcrypto.daemon.messages.CryptoServletMessage;
import com.tridium.platform.daemon.BDaemonSession;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.xml.XElem;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BPlatExemptionStore
extends BPlatCryptoBase
implements ICoreExemptionStore {
public static final Type TYPE;
static /* synthetic */ Class class$com$tridium$platcrypto$daemon$BPlatExemptionStore;
public Type getType() {
return TYPE;
}
public Enumeration exemptions() throws Exception {
XElem[] xElemArray = this.send(new GetExemptionsMessage(), "exemption");
ArrayList<NHostExemption> arrayList = new ArrayList<NHostExemption>();
if (xElemArray != null) {
int n = 0;
while (n < xElemArray.length) {
arrayList.add(NHostExemption.decodeFromString((String)xElemArray[n].text().string()));
++n;
}
return Collections.enumeration(arrayList);
}
return null;
}
public NHostExemption getExemption(String string) throws Exception {
XElem[] xElemArray = this.send(new GetExemptionMessage(string), "exemption");
if (xElemArray != null && xElemArray.length > 0) {
return NHostExemption.decodeFromString((String)xElemArray[0].text().string());
}
return null;
}
public void setExemption(NHostExemption nHostExemption) throws Exception {
this.send(new SetExemptionMessage(nHostExemption));
}
public void deleteExemption(String string) throws Exception {
this.send(new DeleteExemptionMessage(string));
}
public long getLastModified() throws Exception {
return 0L;
}
public void load() throws Exception {
}
public void save() throws IOException, Exception {
this.send(new SaveExemptionMessage());
}
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 BPlatExemptionStore() throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
public BPlatExemptionStore(BDaemonSession bDaemonSession) {
super(bDaemonSession);
}
static {
Class clazz = class$com$tridium$platcrypto$daemon$BPlatExemptionStore;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$daemon$BPlatExemptionStore = BPlatExemptionStore.class("[Lcom.tridium.platcrypto.daemon.BPlatExemptionStore;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
private class GetExemptionsMessage
extends CryptoServletMessage {
public String getAction() {
return "getExemptions";
}
private GetExemptionsMessage() {
}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
private class GetExemptionMessage
extends CryptoServletMessage {
public String getAction() {
return "getExemption";
}
public GetExemptionMessage(String string) {
this.add("host", string);
}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
private class SetExemptionMessage
extends CryptoServletMessage {
private NHostExemption exemption;
public String getMethod() {
return "POST";
}
public String getAction() {
return "setExemption";
}
/*
* Exception decompiling
*/
public void write(OutputStream var1_1) {
/*
* 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 2[TRYBLOCK] [2 : 69->73)] 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 SetExemptionMessage(NHostExemption nHostExemption) {
this.exemption = nHostExemption;
}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
private class DeleteExemptionMessage
extends CryptoServletMessage {
public String getAction() {
return "deleteExemption";
}
public DeleteExemptionMessage(String string) {
try {
this.add("host", string);
}
catch (Exception exception) {
throw new IllegalArgumentException("Invalid host", exception);
}
}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
private class SaveExemptionMessage
extends CryptoServletMessage {
public String getAction() {
return "saveExemptions";
}
private SaveExemptionMessage() {
}
}
}
@@ -0,0 +1,457 @@
/*
* 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.cert.NX509CertificateEntry
* com.tridium.crypto.core.io.ICoreKeyStore
* com.tridium.platform.daemon.BDaemonSession
* com.tridium.platform.daemon.BStationSurrogate
* com.tridium.platform.daemon.message.DaemonMessage
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.xml.XElem
* javax.baja.xml.XParser
* javax.baja.xml.XText
*/
package com.tridium.platcrypto.daemon;
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.cert.NX509CertificateEntry;
import com.tridium.crypto.core.io.ICoreKeyStore;
import com.tridium.platcrypto.daemon.BPlatCryptoBase;
import com.tridium.platcrypto.daemon.messages.CertGenerationStatusMessage;
import com.tridium.platcrypto.daemon.messages.FindCertificateMessage;
import com.tridium.platcrypto.daemon.messages.GenerateCertificateMessage;
import com.tridium.platcrypto.daemon.messages.GetKeyMessage;
import com.tridium.platcrypto.daemon.messages.KeyStoreMessage;
import com.tridium.platcrypto.daemon.messages.SetCertificateEntryMessage;
import com.tridium.platcrypto.daemon.messages.SetKeyEntryMessage;
import com.tridium.platcrypto.daemon.messages.SetKeyEntryWithResponseMessage;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.BStationSurrogate;
import com.tridium.platform.daemon.message.DaemonMessage;
import java.io.InputStream;
import java.security.Key;
import java.security.KeyStore;
import java.security.cert.X509Certificate;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.Enumeration;
import java.util.List;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.xml.XElem;
import javax.baja.xml.XParser;
import javax.baja.xml.XText;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BPlatKeyStore
extends BPlatCryptoBase
implements ICoreKeyStore {
public static final Type TYPE;
static /* synthetic */ Class class$com$tridium$platcrypto$daemon$BPlatKeyStore;
public Type getType() {
return TYPE;
}
public String getKeyStoreType() {
return "keystore";
}
private final List getAliases() throws Exception {
InputStream inputStream = this.getDaemonSession().getInputStream((DaemonMessage)new KeyStoreMessage(this.getKeyStoreType()));
XElem xElem = XParser.make((InputStream)inputStream).parse();
XElem[] xElemArray = xElem.elems("key");
int n = 0;
if (xElemArray != null) {
n = xElemArray.length;
}
ArrayList<String> arrayList = new ArrayList<String>(n);
if (xElemArray != null) {
int n2 = 0;
while (n2 < xElemArray.length) {
String string = xElemArray[n2].get("alias");
if (string != null && string.length() > 0) {
arrayList.add(string);
}
++n2;
}
}
return arrayList;
}
public Enumeration aliases() throws Exception {
return Collections.enumeration(this.getAliases());
}
public boolean containsAlias(String string) throws Exception {
return this.getAliases().contains(string);
}
public void deleteEntries(String[] stringArray) throws Exception {
int n = 0;
while (n < stringArray.length) {
this.deleteEntry(stringArray[n]);
++n;
}
}
public void deleteEntry(String string) throws Exception {
this.getDaemonSession().sendMessage((DaemonMessage)new DeleteEntryMessage(this.getKeyStoreType(), string));
}
public X509Certificate[] getCertificateChain(String string) throws Exception {
XElem[] xElemArray = this.send(new GetCertificateChainMessage(this.getKeyStoreType(), string), "certificate");
if (xElemArray == null || xElemArray.length == 0) {
return null;
}
X509Certificate[] x509CertificateArray = new X509Certificate[xElemArray.length];
int n = 0;
while (n < x509CertificateArray.length) {
if (xElemArray[n] != null && xElemArray[n].text() != null && xElemArray[n].text().length() > 0) {
x509CertificateArray[n] = NX509Certificate.decodeFromString((String)xElemArray[n].text().string());
}
++n;
}
return x509CertificateArray;
}
public Key getKey(String string, char[] cArray) throws Exception {
String string2;
XText xText;
InputStream inputStream = this.getDaemonSession().getInputStream((DaemonMessage)new GetKeyMessage(this.getKeyStoreType(), string, cArray));
XElem xElem = XParser.make((InputStream)inputStream).parse();
if (xElem != null && (xText = xElem.text()) != null && (string2 = xText.toString()) != null && string2.length() > 0) {
return NKey.decodeFromString((String)string2);
}
return null;
}
public Date getCreationDate(String string) throws Exception {
String string2;
InputStream inputStream = this.getDaemonSession().getInputStream((DaemonMessage)new KeyStoreMessage(this.getKeyStoreType(), string));
XElem[] xElemArray = XParser.make((InputStream)inputStream).parse().elems("key");
if (xElemArray.length > 0 && (string2 = xElemArray[0].get("creationDate")) != null && string2.length() == "yyyy-MM-dd HH:mm:ss".length()) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = simpleDateFormat.parse(string2);
return date;
}
return null;
}
public boolean isKeyEntry(String string) throws Exception {
InputStream inputStream = this.getDaemonSession().getInputStream((DaemonMessage)new KeyStoreMessage(this.getKeyStoreType(), string));
XElem[] xElemArray = XParser.make((InputStream)inputStream).parse().elems("key");
if (xElemArray.length > 0) {
return xElemArray[0].getb("keyEntry");
}
return false;
}
public boolean isCertificateEntry(String string) throws Exception {
InputStream inputStream = this.getDaemonSession().getInputStream((DaemonMessage)new KeyStoreMessage(this.getKeyStoreType(), string));
XElem[] xElemArray = XParser.make((InputStream)inputStream).parse().elems("key");
if (xElemArray.length > 0) {
return xElemArray[0].getb("certEntry");
}
return false;
}
public void setCertificateEntry(String string, X509Certificate x509Certificate) throws Exception {
this.send(new SetCertificateEntryMessage(this.getKeyStoreType(), string, x509Certificate));
}
public void setKeyEntry(String string, byte[] byArray, X509Certificate[] x509CertificateArray) throws Exception {
XElem xElem = this.send(new SetKeyEntryWithResponseMessage(this.getKeyStoreType(), string, byArray, x509CertificateArray));
if (xElem.text() != null) {
if (!xElem.text().string().equalsIgnoreCase("success")) {
throw new Exception(xElem.text().string());
}
} else {
this.send(new SetKeyEntryMessage(this.getKeyStoreType(), string, byArray, x509CertificateArray));
}
}
public void setKeyEntry(String string, Key key, char[] cArray, X509Certificate[] x509CertificateArray) throws Exception {
XElem xElem = this.send(new SetKeyEntryWithResponseMessage(this.getKeyStoreType(), string, key, cArray, x509CertificateArray));
if (xElem.text() != null) {
if (!xElem.text().string().equalsIgnoreCase("success")) {
throw new Exception(xElem.text().string());
}
} else {
this.send(new SetKeyEntryMessage(this.getKeyStoreType(), string, key, cArray, x509CertificateArray));
}
}
public Enumeration getCertificates() throws Exception {
XElem[] xElemArray = this.send(new GetCertificatesMessage(this.getKeyStoreType()), "certificateEntry");
int n = 0;
if (xElemArray != null) {
n = xElemArray.length;
}
ArrayList<NX509CertificateEntry> arrayList = new ArrayList<NX509CertificateEntry>(n);
if (xElemArray != null) {
int n2 = 0;
while (n2 < xElemArray.length) {
String string = xElemArray[n2].text().toString();
if (string != null && string.length() > 0) {
arrayList.add(NX509CertificateEntry.decodeFromString((String)string));
}
++n2;
}
}
return Collections.enumeration(arrayList);
}
public String findCertificate(X509Certificate x509Certificate) throws Exception {
Enumeration enumeration = this.getCertificates();
while (enumeration.hasMoreElements()) {
NX509CertificateEntry nX509CertificateEntry = (NX509CertificateEntry)enumeration.nextElement();
NX509Certificate nX509Certificate = nX509CertificateEntry.getCertificate(0);
if (nX509Certificate == null || !nX509Certificate.getPublicKey().equals(x509Certificate.getPublicKey())) continue;
return nX509CertificateEntry.getAlias();
}
return null;
}
public int generateSelfSignedCert(String string, String string2, String string3, String string4, String string5, String string6, String string7, Date date, Date date2, int n, int n2, String string8, String string9) throws Exception {
XElem xElem = this.send(new GenerateCertificateMessage(this.getKeyStoreType(), string, string2, string3, string4, string5, string6, string7, date, date2, n, n2, string8, string9));
if (xElem != null) {
return xElem.geti("requestId", -1);
}
return -1;
}
public int generateSelfSignedCert(String string, String string2, Date date, Date date2, int n, int n2, String string3, String string4) throws Exception {
XElem xElem = this.send(new GenerateCertificateMessage(this.getKeyStoreType(), string, string2, date, date2, n, n2, string3, string4));
if (xElem != null) {
return xElem.geti("requestId", -1);
}
return -1;
}
public int getCertGenerationStatus(int n) throws Exception {
XElem xElem = this.send(new CertGenerationStatusMessage(this.getKeyStoreType(), n));
if (xElem != null) {
return xElem.geti("status", -1);
}
return -1;
}
public NPKCS10CertificationRequest generateCSR(String string, String string2) throws Exception {
XElem xElem = this.send(new GenerateCsrMessage(this.getKeyStoreType(), string, string2));
if (xElem != null && xElem.text() != null) {
String string3 = xElem.text().toString();
return NPKCS10CertificationRequest.make((String)string3);
}
return null;
}
public X509Certificate getCertificate(String string) throws Exception {
XElem xElem = this.send(new GetCertificateMessage(this.getKeyStoreType(), string));
if (xElem != null && xElem.text() != null) {
String string2 = xElem.text().toString();
return NX509Certificate.decodeFromString((String)string2);
}
return null;
}
public String getCertificateAlias(X509Certificate x509Certificate) throws Exception {
InputStream inputStream = this.getDaemonSession().getInputStream((DaemonMessage)new GetCertificateAliasMessage(this.getKeyStoreType(), x509Certificate));
XElem xElem = XParser.make((InputStream)inputStream).parse();
String string = xElem.get("alias");
return string;
}
public int size() throws Exception {
return this.getAliases().size();
}
public long getLastModified() throws Exception {
return 0L;
}
public void load() throws Exception {
}
public void save() throws Exception {
this.send(new SaveMessage(this.getKeyStoreType()));
}
public KeyStore getKeyStore() throws Exception {
throw new UnsupportedOperationException("can't access raw keystore remotely");
}
public boolean canGenerateCertificate() {
boolean bl = false;
try {
BDaemonSession bDaemonSession = this.getDaemonSession();
if (bDaemonSession.getHostProperties().supportsServlet("crypto")) {
InputStream inputStream = this.getDaemonSession().getInputStream((DaemonMessage)new SendAliasesMessage(this.getKeyStoreType()));
XElem xElem = XParser.make((InputStream)inputStream).parse();
bl = xElem.attrIndex("canGenerate") != -1 ? xElem.getb("canGenerate", false) : (bDaemonSession.getHostProperties().getOsName().startsWith("qnx") ? BStationSurrogate.isAnyStationRunning((BDaemonSession)bDaemonSession) ^ true : true);
}
}
catch (Exception exception) {}
return 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());
}
}
public BPlatKeyStore() throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
public BPlatKeyStore(BDaemonSession bDaemonSession) {
super(bDaemonSession);
}
static {
Class clazz = class$com$tridium$platcrypto$daemon$BPlatKeyStore;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$daemon$BPlatKeyStore = BPlatKeyStore.class("[Lcom.tridium.platcrypto.daemon.BPlatKeyStore;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class DeleteEntryMessage
extends KeyStoreMessage {
public String getAction() {
return "deleteEntry";
}
public DeleteEntryMessage(String string, String string2) {
super(string);
this.add("alias", string2);
}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class GetCertificateChainMessage
extends KeyStoreMessage {
public String getAction() {
return "getCertificateChain";
}
public GetCertificateChainMessage(String string, String string2) {
super(string);
this.add("alias", string2);
}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class GetCertificatesMessage
extends KeyStoreMessage {
public String getAction() {
return "getCertificates";
}
public GetCertificatesMessage(String string) {
super(string);
}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class GenerateCsrMessage
extends KeyStoreMessage {
public String getAction() {
return "generateCsr";
}
public GenerateCsrMessage(String string, String string2, String string3) {
super(string);
this.add("alias", string2);
if (string3 != null) {
this.add("passwd", string3);
}
}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class GetCertificateMessage
extends KeyStoreMessage {
public String getAction() {
return "getCertificate";
}
public GetCertificateMessage(String string, String string2) {
super(string);
this.add("alias", string2);
}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class GetCertificateAliasMessage
extends FindCertificateMessage {
public String getAction() {
return "getCertificateAlias";
}
public GetCertificateAliasMessage(String string, X509Certificate x509Certificate) {
super(string, x509Certificate);
}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class SaveMessage
extends KeyStoreMessage {
public String getAction() {
return "saveKeyStore";
}
public SaveMessage(String string) {
super(string);
}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class SendAliasesMessage
extends KeyStoreMessage {
public String getAction() {
return "sendAliases";
}
public SendAliasesMessage(String string) {
super(string);
}
}
}
@@ -0,0 +1,94 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.io.ICoreProviderInfo
* com.tridium.crypto.core.provider.IProvider
* com.tridium.crypto.core.provider.NProvider
* com.tridium.platform.daemon.BDaemonSession
* com.tridium.platform.daemon.message.DaemonMessage
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.xml.XElem
* javax.baja.xml.XParser
*/
package com.tridium.platcrypto.daemon;
import com.tridium.crypto.core.io.ICoreProviderInfo;
import com.tridium.crypto.core.provider.IProvider;
import com.tridium.crypto.core.provider.NProvider;
import com.tridium.platcrypto.daemon.BPlatCryptoBase;
import com.tridium.platcrypto.daemon.messages.GetProviderMessage;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.message.DaemonMessage;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.xml.XElem;
import javax.baja.xml.XParser;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BPlatProviderInfo
extends BPlatCryptoBase
implements ICoreProviderInfo {
public static final Type TYPE;
static /* synthetic */ Class class$com$tridium$platcrypto$daemon$BPlatProviderInfo;
public Type getType() {
return TYPE;
}
public IProvider getProvider(String string) throws Exception {
InputStream inputStream = this.getDaemonSession().getInputStream((DaemonMessage)new GetProviderMessage(string));
XElem[] xElemArray = XParser.make((InputStream)inputStream).parse().elems("provider");
if (xElemArray != null && xElemArray.length > 0) {
return NProvider.decodeFromString((String)xElemArray[0].text().string());
}
return null;
}
public Enumeration providers() throws Exception {
InputStream inputStream = this.getDaemonSession().getInputStream((DaemonMessage)new GetProviderMessage());
XElem[] xElemArray = XParser.make((InputStream)inputStream).parse().elems("provider");
ArrayList<NProvider> arrayList = new ArrayList<NProvider>();
if (xElemArray != null && xElemArray.length > 0) {
arrayList.add(NProvider.decodeFromString((String)xElemArray[0].text().string()));
}
return Collections.enumeration(arrayList);
}
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 BPlatProviderInfo() throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
public BPlatProviderInfo(BDaemonSession bDaemonSession) {
super(bDaemonSession);
}
static {
Class clazz = class$com$tridium$platcrypto$daemon$BPlatProviderInfo;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$daemon$BPlatProviderInfo = BPlatProviderInfo.class("[Lcom.tridium.platcrypto.daemon.BPlatProviderInfo;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,61 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.platform.daemon.BDaemonSession
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platcrypto.daemon;
import com.tridium.platcrypto.daemon.BPlatKeyStore;
import com.tridium.platform.daemon.BDaemonSession;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BPlatTrustStore
extends BPlatKeyStore {
public static final Type TYPE;
static /* synthetic */ Class class$com$tridium$platcrypto$daemon$BPlatTrustStore;
public Type getType() {
return TYPE;
}
public String getKeyStoreType() {
return "truststore";
}
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 BPlatTrustStore() throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
public BPlatTrustStore(BDaemonSession bDaemonSession) {
super(bDaemonSession);
}
static {
Class clazz = class$com$tridium$platcrypto$daemon$BPlatTrustStore;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$daemon$BPlatTrustStore = BPlatTrustStore.class("[Lcom.tridium.platcrypto.daemon.BPlatTrustStore;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,19 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platcrypto.daemon.messages;
import com.tridium.platcrypto.daemon.messages.KeyStoreMessage;
public class CertGenerationStatusMessage
extends KeyStoreMessage {
public String getAction() {
return "genCertStatus";
}
public CertGenerationStatusMessage(String string, int n) {
super(string);
this.add("requestId", "" + n);
}
}
@@ -0,0 +1,47 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.platform.daemon.message.DaemonMessage
*/
package com.tridium.platcrypto.daemon.messages;
import com.tridium.platform.daemon.message.DaemonMessage;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
public class CryptoServletMessage
extends DaemonMessage {
private static final String ENC = "UTF-8";
private StringBuilder message = new StringBuilder("crypto");
public String getAction() {
return "sendAliases";
}
public String getMessageString() {
return this.message.toString();
}
protected void add(String string, String string2) {
this.message.append("&").append(CryptoServletMessage.encode(string)).append("=").append(CryptoServletMessage.encode(string2));
}
private static final String encode(String string) {
String string2 = "";
if (string != null) {
try {
string2 = URLEncoder.encode(string, ENC);
}
catch (UnsupportedEncodingException unsupportedEncodingException) {
string2 = URLEncoder.encode(string);
}
}
return string2;
}
public CryptoServletMessage() {
this.message.append("?action=").append(this.getAction());
}
}
@@ -0,0 +1,59 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platcrypto.daemon.messages;
import com.tridium.platcrypto.daemon.messages.KeyStoreMessage;
import java.io.OutputStream;
import java.security.cert.X509Certificate;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class FindCertificateMessage
extends KeyStoreMessage {
private X509Certificate cert;
public String getMethod() {
return "POST";
}
public String getAction() {
return "findCertificate";
}
/*
* Exception decompiling
*/
public void write(OutputStream var1_1) {
/*
* 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 2[TRYBLOCK] [2 : 62->66)] 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.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");
}
private final /* synthetic */ void this() {
this.cert = null;
}
public FindCertificateMessage(String string, X509Certificate x509Certificate) {
super(string);
this.this();
this.cert = x509Certificate;
}
}
@@ -0,0 +1,53 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platcrypto.daemon.messages;
import com.tridium.platcrypto.daemon.messages.KeyStoreMessage;
import java.text.SimpleDateFormat;
import java.util.Date;
public class GenerateCertificateMessage
extends KeyStoreMessage {
private final void setCommon(Date date, Date date2, int n, int n2, String string, String string2) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
this.add("notBefore", simpleDateFormat.format(date));
this.add("notAfter", simpleDateFormat.format(date2));
this.add("keySize", String.valueOf(n));
this.add("keyUsage", String.valueOf(n2));
this.add("email", string);
if (string2 != null) {
this.add("password", string2);
}
}
public String getAction() {
return "generateCert";
}
public GenerateCertificateMessage(String string, String string2, String string3, String string4, String string5, String string6, String string7, String string8, Date date, Date date2, int n, int n2, String string9, String string10) {
super(string);
this.add("alias", string2);
this.add("cn", string3);
if (string4 != null) {
this.add("ou", string4);
}
this.add("o", string5);
if (string6 != null) {
this.add("l", string6);
}
if (string7 != null) {
this.add("st", string7);
}
this.add("c", string8);
this.setCommon(date, date2, n, n2, string9, string10);
}
public GenerateCertificateMessage(String string, String string2, String string3, Date date, Date date2, int n, int n2, String string4, String string5) {
super(string);
this.add("alias", string2);
this.add("dn", string3);
this.setCommon(date, date2, n, n2, string4, string5);
}
}
@@ -0,0 +1,30 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.nre.util.LegacyStorageUtil
*/
package com.tridium.platcrypto.daemon.messages;
import com.tridium.nre.util.LegacyStorageUtil;
import com.tridium.platcrypto.daemon.messages.KeyStoreMessage;
import java.io.IOException;
public class GetKeyMessage
extends KeyStoreMessage {
public String getAction() {
return "getKey";
}
public GetKeyMessage(String string, String string2, char[] cArray) {
super(string);
this.add("alias", string2);
if (cArray != null && cArray.length > 0) {
try {
this.add("password", LegacyStorageUtil.encode((String)String.valueOf(cArray)));
}
catch (IOException iOException) {}
}
}
}
@@ -0,0 +1,21 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platcrypto.daemon.messages;
import com.tridium.platcrypto.daemon.messages.CryptoServletMessage;
public class GetProviderMessage
extends CryptoServletMessage {
public String getAction() {
return "getProvider";
}
public GetProviderMessage() {
}
public GetProviderMessage(String string) {
this.add("name", string);
}
}
@@ -0,0 +1,19 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platcrypto.daemon.messages;
import com.tridium.platcrypto.daemon.messages.CryptoServletMessage;
public class KeyStoreMessage
extends CryptoServletMessage {
public KeyStoreMessage(String string) {
this.add("keyStoreType", string);
}
public KeyStoreMessage(String string, String string2) {
this.add("keyStoreType", string);
this.add("alias", string2);
}
}
@@ -0,0 +1,54 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platcrypto.daemon.messages;
import com.tridium.platcrypto.daemon.messages.KeyStoreMessage;
import java.io.OutputStream;
import java.security.cert.X509Certificate;
public class SetCertificateEntryMessage
extends KeyStoreMessage {
private String alias;
private X509Certificate cert;
public String getAction() {
return "setCertificateEntry";
}
public String getMethod() {
return "POST";
}
/*
* Exception decompiling
*/
public void write(OutputStream var1_1) {
/*
* 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 2[TRYBLOCK] [2 : 95->99)] 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.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 SetCertificateEntryMessage(String string, String string2, X509Certificate x509Certificate) {
super(string);
this.add("alias", string2);
this.alias = string2;
this.cert = x509Certificate;
}
}
@@ -0,0 +1,69 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platcrypto.daemon.messages;
import com.tridium.platcrypto.daemon.messages.KeyStoreMessage;
import java.io.OutputStream;
import java.security.Key;
import java.security.cert.X509Certificate;
public class SetKeyEntryMessage
extends KeyStoreMessage {
private String alias;
private Key key;
private byte[] rawKey;
private char[] password;
private X509Certificate[] chain;
public String getAction() {
return "setKeyEntry";
}
public String getMethod() {
return "POST";
}
/*
* Exception decompiling
*/
public void write(OutputStream var1_1) {
/*
* 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 5[TRYBLOCK] [5 : 279->283)] 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.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 SetKeyEntryMessage(String string, String string2, byte[] byArray, X509Certificate[] x509CertificateArray) {
super(string);
this.add("alias", string2);
this.alias = string2;
this.chain = x509CertificateArray;
this.rawKey = byArray;
this.password = null;
}
public SetKeyEntryMessage(String string, String string2, Key key, char[] cArray, X509Certificate[] x509CertificateArray) {
super(string);
this.add("alias", string2);
this.alias = string2;
this.chain = x509CertificateArray;
this.key = key;
this.password = cArray;
}
}
@@ -0,0 +1,24 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platcrypto.daemon.messages;
import com.tridium.platcrypto.daemon.messages.SetKeyEntryMessage;
import java.security.Key;
import java.security.cert.X509Certificate;
public class SetKeyEntryWithResponseMessage
extends SetKeyEntryMessage {
public String getAction() {
return "setKeyEntryWithResponse";
}
public SetKeyEntryWithResponseMessage(String string, String string2, byte[] byArray, X509Certificate[] x509CertificateArray) {
super(string, string2, byArray, x509CertificateArray);
}
public SetKeyEntryWithResponseMessage(String string, String string2, Key key, char[] cArray, X509Certificate[] x509CertificateArray) {
super(string, string2, key, cArray, x509CertificateArray);
}
}
@@ -0,0 +1,99 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.platform.ui.BDaemonCnxHandler
* com.tridium.workbench.ord.BHostOrdFE
* javax.baja.naming.BOrd
* javax.baja.naming.OrdQuery
* javax.baja.security.BICredentials
* javax.baja.security.BUsernameAndPassword
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.util.Lexicon
*/
package com.tridium.platcrypto.daemon.ui;
import com.tridium.platcrypto.daemon.BDaemonSecureScheme;
import com.tridium.platcrypto.daemon.ui.BDaemonSecureSessionOrdFE;
import com.tridium.platform.ui.BDaemonCnxHandler;
import com.tridium.workbench.ord.BHostOrdFE;
import javax.baja.naming.BOrd;
import javax.baja.naming.OrdQuery;
import javax.baja.security.BICredentials;
import javax.baja.security.BUsernameAndPassword;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.util.Lexicon;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BDaemonSecureCnxHandler
extends BDaemonCnxHandler {
public static final Type TYPE;
private static final String KEY = "open.ssl.daemon";
static /* synthetic */ Class class$com$tridium$platcrypto$daemon$ui$BDaemonSecureCnxHandler;
public Type getType() {
return TYPE;
}
public boolean isSecure() {
return true;
}
protected void saveHostAddress() throws Exception {
BOrd bOrd;
this.ordFE.setAutoSaveHistory(false);
this.hostOrd = bOrd = (BOrd)this.ordFE.saveValue();
this.port = 5011;
if (!bOrd.isNull()) {
OrdQuery[] ordQueryArray = bOrd.parse();
int n = 1;
while (n < ordQueryArray.length) {
if (ordQueryArray[n] instanceof BDaemonSecureScheme.DaemonQuery) {
BDaemonSecureScheme.DaemonQuery daemonQuery = (BDaemonSecureScheme.DaemonQuery)ordQueryArray[n];
this.port = daemonQuery.getPort();
this.tunnelAuthorities = daemonQuery.getTunnelAuthorities();
break;
}
++n;
}
}
}
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 BDaemonSecureCnxHandler() {
super(BDaemonSecureScheme.INSTANCE.getId(), 5011, (BHostOrdFE)new BDaemonSecureSessionOrdFE(), (BICredentials)new BUsernameAndPassword(), TYPE.getModule().getLexicon(), KEY);
}
public BDaemonSecureCnxHandler(Lexicon lexicon, String string) {
super(BDaemonSecureScheme.INSTANCE.getId(), 5011, (BHostOrdFE)new BDaemonSecureSessionOrdFE(), (BICredentials)new BUsernameAndPassword(), lexicon, string);
}
public BDaemonSecureCnxHandler(String string, int n, BHostOrdFE bHostOrdFE, BICredentials bICredentials, Lexicon lexicon, String string2) {
super(string, n, bHostOrdFE, bICredentials, lexicon, string2);
}
static {
Class clazz = class$com$tridium$platcrypto$daemon$ui$BDaemonSecureCnxHandler;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$daemon$ui$BDaemonSecureCnxHandler = BDaemonSecureCnxHandler.class("[Lcom.tridium.platcrypto.daemon.ui.BDaemonSecureCnxHandler;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,68 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.platform.daemon.BDaemonSession
* com.tridium.workbench.nav.BSessionAgent
* javax.baja.naming.BHost
* javax.baja.naming.BISession
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.xml.XElem
*/
package com.tridium.platcrypto.daemon.ui;
import com.tridium.platcrypto.daemon.BDaemonSecureSession;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.workbench.nav.BSessionAgent;
import javax.baja.naming.BHost;
import javax.baja.naming.BISession;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.xml.XElem;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BDaemonSecureSessionAgent
extends BSessionAgent {
public static final BDaemonSecureSessionAgent INSTANCE = new BDaemonSecureSessionAgent();
public static final Type TYPE;
static /* synthetic */ Class class$com$tridium$platcrypto$daemon$ui$BDaemonSecureSessionAgent;
public Type getType() {
return TYPE;
}
public void pickle(BISession bISession, XElem xElem) {
BDaemonSession bDaemonSession = (BDaemonSession)bISession;
xElem.addAttr("port", "" + bDaemonSession.getPort());
}
public BISession unpickle(BHost bHost, XElem xElem) {
int n = xElem.geti("port", 5011);
return BDaemonSecureSession.make(bHost, n, 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$daemon$ui$BDaemonSecureSessionAgent;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$daemon$ui$BDaemonSecureSessionAgent = BDaemonSecureSessionAgent.class("[Lcom.tridium.platcrypto.daemon.ui.BDaemonSecureSessionAgent;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,61 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.platform.ui.BDaemonSessionOrdFE
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platcrypto.daemon.ui;
import com.tridium.platform.ui.BDaemonSessionOrdFE;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BDaemonSecureSessionOrdFE
extends BDaemonSessionOrdFE {
public static final Type TYPE;
private static final int HTTPS_TUNNEL_PORT = 443;
static /* synthetic */ Class class$com$tridium$platcrypto$daemon$ui$BDaemonSecureSessionOrdFE;
public Type getType() {
return TYPE;
}
protected int getDefaultPort() {
return 5011;
}
protected int getDefaultTunnelPort() {
return 443;
}
protected String getDefaultOrdScheme() {
return "platformssl";
}
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$daemon$ui$BDaemonSecureSessionOrdFE;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$daemon$ui$BDaemonSecureSessionOrdFE = BDaemonSecureSessionOrdFE.class("[Lcom.tridium.platcrypto.daemon.ui.BDaemonSecureSessionOrdFE;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,911 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.cert.CertUtils
* com.tridium.crypto.core.cert.NHostExemption
* com.tridium.crypto.core.cert.NKey
* com.tridium.crypto.core.cert.NPKCS10CertificationRequest
* com.tridium.crypto.core.cert.NX509Certificate
* com.tridium.crypto.core.cert.NX509CertificateEntry
* com.tridium.crypto.core.io.CoreCryptoManager
* com.tridium.crypto.core.io.ICoreCryptoManager
* com.tridium.crypto.core.io.ICoreExemptionStore
* com.tridium.crypto.core.io.ICoreKeyStore
* com.tridium.crypto.core.provider.IProvider
* com.tridium.crypto.core.provider.NProvider
* com.tridium.fox.session.FoxRequest
* com.tridium.fox.session.FoxResponse
* com.tridium.fox.session.InvalidCommandException
* com.tridium.fox.sys.BFoxChannel
* com.tridium.fox.sys.BFoxSession
* com.tridium.nre.security.ISecurityInfoProvider
* com.tridium.nre.util.LegacyStorageUtil
* com.tridium.sys.Nre
* javax.baja.file.BFileSystem
* javax.baja.file.FilePath
* javax.baja.log.Log
* javax.baja.naming.BISession
* javax.baja.naming.BLocalHost
* javax.baja.naming.BOrd
* javax.baja.naming.OrdQuery
* javax.baja.nre.util.Array
* javax.baja.sys.BComponent
* javax.baja.sys.Sys
* javax.baja.sys.Type
* org.bouncycastle.jce.PrincipalUtil
* org.bouncycastle.jce.X509Principal
*/
package com.tridium.platcrypto.fox;
import com.tridium.crypto.core.cert.CertUtils;
import com.tridium.crypto.core.cert.NHostExemption;
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.cert.NX509CertificateEntry;
import com.tridium.crypto.core.io.CoreCryptoManager;
import com.tridium.crypto.core.io.ICoreCryptoManager;
import com.tridium.crypto.core.io.ICoreExemptionStore;
import com.tridium.crypto.core.io.ICoreKeyStore;
import com.tridium.crypto.core.provider.IProvider;
import com.tridium.crypto.core.provider.NProvider;
import com.tridium.fox.session.FoxRequest;
import com.tridium.fox.session.FoxResponse;
import com.tridium.fox.session.InvalidCommandException;
import com.tridium.fox.sys.BFoxChannel;
import com.tridium.fox.sys.BFoxSession;
import com.tridium.nre.security.ISecurityInfoProvider;
import com.tridium.nre.util.LegacyStorageUtil;
import com.tridium.platcrypto.fox.ChannelCryptoManager;
import com.tridium.sys.Nre;
import java.io.File;
import java.io.IOException;
import java.security.Key;
import java.security.UnrecoverableKeyException;
import java.security.cert.X509Certificate;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.Enumeration;
import java.util.List;
import java.util.Vector;
import javax.baja.file.BFileSystem;
import javax.baja.file.FilePath;
import javax.baja.log.Log;
import javax.baja.naming.BISession;
import javax.baja.naming.BLocalHost;
import javax.baja.naming.BOrd;
import javax.baja.naming.OrdQuery;
import javax.baja.nre.util.Array;
import javax.baja.sys.BComponent;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import org.bouncycastle.jce.PrincipalUtil;
import org.bouncycastle.jce.X509Principal;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BCryptoChannel
extends BFoxChannel {
public static final Type TYPE;
private static Log log;
private ICoreCryptoManager service;
private boolean validChannel;
static /* synthetic */ Class class$com$tridium$platcrypto$fox$BCryptoChannel;
static /* synthetic */ Class class$com$tridium$crypto$core$cert$NX509CertificateEntry;
static /* synthetic */ Class class$com$tridium$crypto$core$cert$NHostExemption;
public Type getType() {
return TYPE;
}
public void sessionOpened() throws Exception {
if (this.isRunning()) {
Log.getLog((String)"crypto").trace("pairing CertManagerService with CryptoChannel");
BISession bISession = this.getSession();
if (bISession instanceof BLocalHost) {
this.service = CoreCryptoManager.get((ISecurityInfoProvider)Nre.getSecurityInfoProvider());
} else if (bISession instanceof BFoxSession) {
this.service = new ChannelCryptoManager((BComponent)this);
}
}
}
public void sessionClosed(Throwable throwable) throws Exception {
Log.getLog((String)"crypto").trace("unpairing CertManagerService with CryptoChannel");
}
public FoxResponse process(FoxRequest foxRequest) throws Throwable {
String string = foxRequest.command;
if (string == "keystore.serverAliases") {
return this.keyStoreServerAliases(foxRequest);
}
if (string == "keystore.aliases") {
return this.keyStoreAliases(foxRequest);
}
if (string == "keystore.containsAlias") {
return this.keyStoreContainsAlias(foxRequest);
}
if (string == "keystore.deleteEntry") {
return this.keyStoreDeleteEntry(foxRequest);
}
if (string == "keystore.getCertificate") {
return this.keyStoreGetCertificate(foxRequest);
}
if (string == "keystore.getCertificateAlias") {
return this.keyStoreGetCertificateAlias(foxRequest);
}
if (string == "keystore.getCertificateChain") {
return this.keyStoreGetCertificateChain(foxRequest);
}
if (string == "keystore.getCreationDate") {
return this.keyStoreGetCreationDate(foxRequest);
}
if (string == "keystore.getKey") {
return this.keyStoreGetKey(foxRequest);
}
if (string == "keystore.isCertificateEntry") {
return this.keyStoreIsCertificateEntry(foxRequest);
}
if (string == "keystore.isKeyEntry") {
return this.keyStoreIsKeyEntry(foxRequest);
}
if (string == "keystore.setCertificateEntry") {
return this.keyStoreSetCertificateEntry(foxRequest);
}
if (string == "keystore.setKeyEntry0") {
return this.keyStoreSetKeyEntry0(foxRequest);
}
if (string == "keystore.setKeyEntry1") {
return this.keyStoreSetKeyEntry1(foxRequest);
}
if (string == "keystore.size") {
return this.keyStoreSize(foxRequest);
}
if (string == "keystore.save") {
return this.keyStoreSave(foxRequest);
}
if (string == "keystore.getCertificates") {
return this.keyStoreGetCertificates(foxRequest);
}
if (string == "keystore.deleteEntries") {
return this.keyStoreDeleteEntries(foxRequest);
}
if (string == "keystore.findCertificate") {
return this.keyStoreFindCertificate(foxRequest);
}
if (string == "keystore.generateSelfSignedCert") {
return this.keyStoreGenerateSelfSignedCert(foxRequest);
}
if (string == "keystore.getCertGenerationStatus") {
return this.keyGetCertGenerationStatus(foxRequest);
}
if (string == "keystore.generateCSR") {
return this.keyStoreGenerateCSR(foxRequest);
}
if (string == "provider.Providers") {
return this.providerProviders(foxRequest);
}
if (string == "provider.getProvider") {
return this.providerGetProvider(foxRequest);
}
if (string == "exemption.exemptions") {
return this.exemptionExemptions(foxRequest);
}
if (string == "exemption.setExemption") {
return this.exemptionSetExemption(foxRequest);
}
if (string == "exemption.deleteExemption") {
return this.exemptionDeleteExemption(foxRequest);
}
if (string == "exemption.getExemption") {
return this.exemptionGetExemption(foxRequest);
}
if (string == "exemption.save") {
return this.exemptionSave(foxRequest);
}
throw new InvalidCommandException(string);
}
public Enumeration keyStoreServerAliases() throws Exception {
FoxRequest foxRequest = this.makeRequest("keystore.serverAliases");
foxRequest.add("useTrustStore", false);
FoxResponse foxResponse = this.sendSync(foxRequest);
String[] stringArray = foxResponse.listStrings("alias");
List<String> list = Arrays.asList(stringArray);
Enumeration<String> enumeration = Collections.enumeration(list);
return enumeration;
}
private final FoxResponse keyStoreServerAliases(FoxRequest foxRequest) throws Exception {
FoxResponse foxResponse = new FoxResponse(foxRequest);
ICoreKeyStore iCoreKeyStore = this.getCorrectKeyStore(foxRequest);
Enumeration enumeration = iCoreKeyStore.aliases();
while (enumeration.hasMoreElements()) {
String string = (String)enumeration.nextElement();
if (!CertUtils.isValidServerCert((String)string, (ICoreKeyStore)iCoreKeyStore)) continue;
foxResponse.add("alias", string);
}
return foxResponse;
}
public Enumeration keyStoreAliases(boolean bl) throws Exception {
FoxRequest foxRequest = this.makeRequest("keystore.aliases");
foxRequest.add("useTrustStore", bl);
FoxResponse foxResponse = this.sendSync(foxRequest);
String[] stringArray = foxResponse.listStrings("alias");
List<String> list = Arrays.asList(stringArray);
Enumeration<String> enumeration = Collections.enumeration(list);
return enumeration;
}
private final FoxResponse keyStoreAliases(FoxRequest foxRequest) throws Exception {
FoxResponse foxResponse = new FoxResponse(foxRequest);
ICoreKeyStore iCoreKeyStore = this.getCorrectKeyStore(foxRequest);
Enumeration enumeration = iCoreKeyStore.aliases();
while (enumeration.hasMoreElements()) {
String string = (String)enumeration.nextElement();
foxResponse.add("alias", string);
}
return foxResponse;
}
public boolean keyStoreContainsAlias(boolean bl, String string) throws Exception {
FoxRequest foxRequest = this.makeRequest("keystore.containsAlias");
foxRequest.add("useTrustStore", bl);
foxRequest.add("alias", string);
FoxResponse foxResponse = this.sendSync(foxRequest);
return foxResponse.getBoolean("containsAlias");
}
private final FoxResponse keyStoreContainsAlias(FoxRequest foxRequest) throws Exception {
FoxResponse foxResponse = new FoxResponse(foxRequest);
ICoreKeyStore iCoreKeyStore = this.getCorrectKeyStore(foxRequest);
foxResponse.add("containsAlias", iCoreKeyStore.containsAlias(foxRequest.getString("alias")));
return foxResponse;
}
public void keyStoreDeleteEntry(boolean bl, String string) throws Exception {
FoxRequest foxRequest = this.makeRequest("keystore.deleteEntry");
foxRequest.add("useTrustStore", bl);
foxRequest.add("alias", string);
this.sendSync(foxRequest);
}
private final FoxResponse keyStoreDeleteEntry(FoxRequest foxRequest) throws Exception {
FoxResponse foxResponse = new FoxResponse(foxRequest);
ICoreKeyStore iCoreKeyStore = this.getCorrectKeyStore(foxRequest);
iCoreKeyStore.deleteEntry(foxRequest.getString("alias"));
return foxResponse;
}
public X509Certificate keyStoreGetCertificate(boolean bl, String string) throws Exception {
FoxRequest foxRequest = this.makeRequest("keystore.getCertificate");
foxRequest.add("useTrustStore", bl);
foxRequest.add("alias", string);
FoxResponse foxResponse = this.sendSync(foxRequest);
String string2 = foxResponse.getString("certificate", null);
if (string2 != null) {
X509Certificate x509Certificate = NX509Certificate.decodeFromString((String)string2);
return x509Certificate;
}
return null;
}
private final FoxResponse keyStoreGetCertificate(FoxRequest foxRequest) throws Exception {
FoxResponse foxResponse = new FoxResponse(foxRequest);
ICoreKeyStore iCoreKeyStore = this.getCorrectKeyStore(foxRequest);
X509Certificate x509Certificate = iCoreKeyStore.getCertificate(foxRequest.getString("alias"));
if (x509Certificate != null) {
foxResponse.add("certificate", NX509Certificate.encodeToString((X509Certificate)x509Certificate));
}
return foxResponse;
}
public String keyStoreGetCertificateAlias(boolean bl, X509Certificate x509Certificate) throws Exception {
FoxRequest foxRequest = this.makeRequest("keystore.getCertificateAlias");
foxRequest.add("useTrustStore", bl);
foxRequest.add("certificate", NX509Certificate.encodeToString((X509Certificate)x509Certificate));
FoxResponse foxResponse = this.sendSync(foxRequest);
return foxResponse.getString("alias", null);
}
private final FoxResponse keyStoreGetCertificateAlias(FoxRequest foxRequest) throws Exception {
X509Certificate x509Certificate;
FoxResponse foxResponse = new FoxResponse(foxRequest);
ICoreKeyStore iCoreKeyStore = this.getCorrectKeyStore(foxRequest);
String string = iCoreKeyStore.getCertificateAlias(x509Certificate = NX509Certificate.decodeFromString((String)foxRequest.getString("certificate")));
if (string != null) {
foxResponse.add("alias", string);
}
return foxResponse;
}
public X509Certificate[] keyStoreGetCertificateChain(boolean bl, String string) throws Exception {
FoxRequest foxRequest = this.makeRequest("keystore.getCertificateChain");
foxRequest.add("useTrustStore", bl);
foxRequest.add("alias", string);
FoxResponse foxResponse = this.sendSync(foxRequest);
String[] stringArray = foxResponse.listStrings("certificateChain");
X509Certificate[] x509CertificateArray = null;
if (stringArray.length > 0) {
x509CertificateArray = new X509Certificate[stringArray.length];
int n = 0;
while (n < stringArray.length) {
x509CertificateArray[n] = NX509Certificate.decodeFromString((String)stringArray[n]);
++n;
}
}
return x509CertificateArray;
}
private final FoxResponse keyStoreGetCertificateChain(FoxRequest foxRequest) throws Exception {
FoxResponse foxResponse = new FoxResponse(foxRequest);
ICoreKeyStore iCoreKeyStore = this.getCorrectKeyStore(foxRequest);
X509Certificate[] x509CertificateArray = iCoreKeyStore.getCertificateChain(foxRequest.getString("alias"));
if (x509CertificateArray != null) {
int n = 0;
while (n < x509CertificateArray.length) {
foxResponse.add("certificateChain", NX509Certificate.encodeToString((X509Certificate)x509CertificateArray[n]));
++n;
}
}
return foxResponse;
}
public Date keyStoreGetCreationDate(boolean bl, String string) throws Exception {
FoxRequest foxRequest = this.makeRequest("keystore.getCreationDate");
foxRequest.add("useTrustStore", bl);
foxRequest.add("alias", string);
FoxResponse foxResponse = this.sendSync(foxRequest);
Date date = new Date(foxResponse.getTime("creationDate"));
return date;
}
private final FoxResponse keyStoreGetCreationDate(FoxRequest foxRequest) throws Exception {
FoxResponse foxResponse = new FoxResponse(foxRequest);
ICoreKeyStore iCoreKeyStore = this.getCorrectKeyStore(foxRequest);
Date date = iCoreKeyStore.getCreationDate(foxRequest.getString("alias"));
foxResponse.add("creationDate", date.getTime());
return foxResponse;
}
public Key keyStoreGetKey(boolean bl, String string, char[] cArray) throws Exception {
Object object;
Object object2;
FoxRequest foxRequest = this.makeRequest("keystore.getKey");
foxRequest.add("useTrustStore", bl);
foxRequest.add("alias", string);
if (cArray != null) {
object2 = new String(cArray);
object = LegacyStorageUtil.encode((String)object2);
foxRequest.add("password", (String)object);
}
object2 = this.sendSync(foxRequest);
object = null;
boolean bl2 = object2.getBoolean("success", false);
if (bl2) {
String string2 = object2.getString("key", null);
if (string2 != null) {
object = NKey.decodeFromString((String)string2);
}
return object;
}
throw new UnrecoverableKeyException("unable to recover key");
}
private final FoxResponse keyStoreGetKey(FoxRequest foxRequest) throws Exception {
FoxResponse foxResponse = new FoxResponse(foxRequest);
ICoreKeyStore iCoreKeyStore = this.getCorrectKeyStore(foxRequest);
try {
Key key;
char[] cArray = null;
if (foxRequest.getString("password", null) != null) {
cArray = LegacyStorageUtil.decode((String)foxRequest.getString("password")).toCharArray();
}
if ((key = iCoreKeyStore.getKey(foxRequest.getString("alias"), cArray)) != null) {
foxResponse.add("success", true);
foxResponse.add("key", NKey.encodeToString((Key)key));
} else {
foxResponse.add("success", false);
}
return foxResponse;
}
catch (UnrecoverableKeyException unrecoverableKeyException) {
foxResponse.add("success", false);
return foxResponse;
}
}
public boolean keyStoreIsCertificateEntry(boolean bl, String string) throws Exception {
FoxRequest foxRequest = this.makeRequest("keystore.isCertificateEntry");
foxRequest.add("useTrustStore", bl);
foxRequest.add("alias", string);
FoxResponse foxResponse = this.sendSync(foxRequest);
return foxResponse.getBoolean("isCertificateEntry");
}
private final FoxResponse keyStoreIsCertificateEntry(FoxRequest foxRequest) throws Exception {
FoxResponse foxResponse = new FoxResponse(foxRequest);
ICoreKeyStore iCoreKeyStore = this.getCorrectKeyStore(foxRequest);
foxResponse.add("isCertificateEntry", iCoreKeyStore.isCertificateEntry(foxRequest.getString("alias")));
return foxResponse;
}
public boolean keyStoreIsKeyEntry(boolean bl, String string) throws Exception {
FoxRequest foxRequest = this.makeRequest("keystore.isKeyEntry");
foxRequest.add("useTrustStore", bl);
foxRequest.add("alias", string);
FoxResponse foxResponse = this.sendSync(foxRequest);
return foxResponse.getBoolean("isKeyEntry");
}
private final FoxResponse keyStoreIsKeyEntry(FoxRequest foxRequest) throws Exception {
FoxResponse foxResponse = new FoxResponse(foxRequest);
ICoreKeyStore iCoreKeyStore = this.getCorrectKeyStore(foxRequest);
foxResponse.add("isKeyEntry", iCoreKeyStore.isKeyEntry(foxRequest.getString("alias")));
return foxResponse;
}
public void keyStoreSetCertificateEntry(boolean bl, String string, X509Certificate x509Certificate) throws Exception {
FoxRequest foxRequest = this.makeRequest("keystore.setCertificateEntry");
foxRequest.add("useTrustStore", bl);
foxRequest.add("alias", string);
foxRequest.add("certificate", NX509Certificate.encodeToString((X509Certificate)x509Certificate));
this.sendSync(foxRequest);
}
private final FoxResponse keyStoreSetCertificateEntry(FoxRequest foxRequest) throws Exception {
FoxResponse foxResponse = new FoxResponse(foxRequest);
ICoreKeyStore iCoreKeyStore = this.getCorrectKeyStore(foxRequest);
X509Certificate x509Certificate = NX509Certificate.decodeFromString((String)foxRequest.getString("certificate"));
iCoreKeyStore.setCertificateEntry(foxRequest.getString("alias"), x509Certificate);
return foxResponse;
}
public void keyStoreSetKeyEntry0(boolean bl, String string, byte[] byArray, X509Certificate[] x509CertificateArray) throws Exception {
FoxRequest foxRequest = this.makeRequest("keystore.setKeyEntry0");
foxRequest.add("useTrustStore", bl);
foxRequest.add("alias", string);
foxRequest.add("key", byArray);
if (x509CertificateArray != null) {
int n = 0;
while (n < x509CertificateArray.length) {
foxRequest.add("chain", NX509Certificate.encodeToString((X509Certificate)x509CertificateArray[n]));
++n;
}
}
this.sendSync(foxRequest);
}
private final FoxResponse keyStoreSetKeyEntry0(FoxRequest foxRequest) throws Exception {
FoxResponse foxResponse = new FoxResponse(foxRequest);
ICoreKeyStore iCoreKeyStore = this.getCorrectKeyStore(foxRequest);
byte[] byArray = foxRequest.getBlob("key");
X509Certificate[] x509CertificateArray = null;
String[] stringArray = null;
try {
stringArray = foxRequest.listStrings("chain");
x509CertificateArray = new X509Certificate[stringArray.length];
int n = 0;
while (n < stringArray.length) {
x509CertificateArray[n] = NX509Certificate.decodeFromString((String)stringArray[n]);
++n;
}
}
catch (IOException iOException) {}
iCoreKeyStore.setKeyEntry(foxRequest.getString("alias"), byArray, x509CertificateArray);
return foxResponse;
}
public void keyStoreSetKeyEntry1(boolean bl, String string, Key key, char[] cArray, X509Certificate[] x509CertificateArray) throws Exception {
FoxRequest foxRequest = this.makeRequest("keystore.setKeyEntry1");
foxRequest.add("useTrustStore", bl);
foxRequest.add("alias", string);
foxRequest.add("key", NKey.encodeToString((Key)key));
if (cArray != null) {
String string2 = new String(cArray);
String string3 = LegacyStorageUtil.encode((String)string2);
foxRequest.add("password", string3);
}
if (x509CertificateArray != null) {
int n = 0;
while (n < x509CertificateArray.length) {
foxRequest.add("chain", NX509Certificate.encodeToString((X509Certificate)x509CertificateArray[n]));
++n;
}
}
this.sendSync(foxRequest);
}
private final FoxResponse keyStoreSetKeyEntry1(FoxRequest foxRequest) throws Exception {
FoxResponse foxResponse = new FoxResponse(foxRequest);
ICoreKeyStore iCoreKeyStore = this.getCorrectKeyStore(foxRequest);
Key key = NKey.decodeFromString((String)foxRequest.getString("key"));
char[] cArray = null;
if (foxRequest.getString("password", null) != null) {
cArray = LegacyStorageUtil.decode((String)foxRequest.getString("password")).toCharArray();
}
X509Certificate[] x509CertificateArray = null;
String[] stringArray = null;
try {
stringArray = foxRequest.listStrings("chain");
x509CertificateArray = new X509Certificate[stringArray.length];
int n = 0;
while (n < stringArray.length) {
x509CertificateArray[n] = NX509Certificate.decodeFromString((String)stringArray[n]);
++n;
}
}
catch (IOException iOException) {}
iCoreKeyStore.setKeyEntry(foxRequest.getString("alias"), key, cArray, x509CertificateArray);
return foxResponse;
}
public int keyStoreSize(boolean bl) throws Exception {
FoxRequest foxRequest = this.makeRequest("keystore.size");
foxRequest.add("useTrustStore", bl);
FoxResponse foxResponse = this.sendSync(foxRequest);
return foxResponse.getInt("size");
}
private final FoxResponse keyStoreSize(FoxRequest foxRequest) throws Exception {
FoxResponse foxResponse = new FoxResponse(foxRequest);
ICoreKeyStore iCoreKeyStore = this.getCorrectKeyStore(foxRequest);
foxResponse.add("size", iCoreKeyStore.size());
return foxResponse;
}
public void keyStoreSave(boolean bl) throws Exception {
FoxRequest foxRequest = this.makeRequest("keystore.save");
foxRequest.add("useTrustStore", bl);
this.sendSync(foxRequest);
}
private final FoxResponse keyStoreSave(FoxRequest foxRequest) throws Exception {
FoxResponse foxResponse = new FoxResponse(foxRequest);
ICoreKeyStore iCoreKeyStore = this.getCorrectKeyStore(foxRequest);
iCoreKeyStore.save();
return foxResponse;
}
public Enumeration keyStoreGetCertificates(boolean bl) throws Exception {
FoxRequest foxRequest = this.makeRequest("keystore.getCertificates");
foxRequest.add("useTrustStore", bl);
FoxResponse foxResponse = this.sendSync(foxRequest);
String[] stringArray = foxResponse.listStrings("cert");
Class clazz = class$com$tridium$crypto$core$cert$NX509CertificateEntry;
if (clazz == null) {
clazz = class$com$tridium$crypto$core$cert$NX509CertificateEntry = BCryptoChannel.class("[Lcom.tridium.crypto.core.cert.NX509CertificateEntry;", false);
}
Array array = new Array(clazz);
int n = 0;
while (n < stringArray.length) {
NX509CertificateEntry nX509CertificateEntry = NX509CertificateEntry.decodeFromString((String)stringArray[n]);
array.add((Object)nX509CertificateEntry);
++n;
}
Enumeration enumeration = Collections.enumeration(array.list());
return enumeration;
}
private final FoxResponse keyStoreGetCertificates(FoxRequest foxRequest) throws Exception {
FoxResponse foxResponse = new FoxResponse(foxRequest);
ICoreKeyStore iCoreKeyStore = this.getCorrectKeyStore(foxRequest);
Enumeration enumeration = iCoreKeyStore.getCertificates();
while (enumeration.hasMoreElements()) {
NX509CertificateEntry nX509CertificateEntry = (NX509CertificateEntry)enumeration.nextElement();
foxResponse.add("cert", nX509CertificateEntry.encodeToString());
}
return foxResponse;
}
public String keyStoreFindCertificate(boolean bl, X509Certificate x509Certificate) throws Exception {
FoxRequest foxRequest = this.makeRequest("keystore.findCertificate");
foxRequest.add("useTrustStore", bl);
foxRequest.add("certificate", NX509Certificate.encodeToString((X509Certificate)x509Certificate));
FoxResponse foxResponse = this.sendSync(foxRequest);
return foxResponse.getString("alias", null);
}
private final FoxResponse keyStoreFindCertificate(FoxRequest foxRequest) throws Exception {
FoxResponse foxResponse = new FoxResponse(foxRequest);
ICoreKeyStore iCoreKeyStore = this.getCorrectKeyStore(foxRequest);
X509Certificate x509Certificate = NX509Certificate.decodeFromString((String)foxRequest.getString("certificate"));
X509Principal x509Principal = PrincipalUtil.getSubjectX509Principal((X509Certificate)x509Certificate);
Enumeration enumeration = iCoreKeyStore.aliases();
while (enumeration.hasMoreElements()) {
String string = (String)enumeration.nextElement();
X509Certificate x509Certificate2 = iCoreKeyStore.getCertificate(string);
if (!x509Certificate2.getType().equals("X.509")) continue;
X509Certificate x509Certificate3 = x509Certificate2;
X509Principal x509Principal2 = PrincipalUtil.getSubjectX509Principal((X509Certificate)x509Certificate3);
if (!x509Principal.equals((Object)x509Principal2)) break;
foxResponse.add("alias", string);
break;
}
return foxResponse;
}
public void keyStoreDeleteEntries(boolean bl, String[] stringArray) throws Exception {
FoxRequest foxRequest = this.makeRequest("keystore.deleteEntries");
foxRequest.add("useTrustStore", bl);
int n = 0;
while (n < stringArray.length) {
foxRequest.add("alias", stringArray[n]);
++n;
}
this.sendSync(foxRequest);
}
private final FoxResponse keyStoreDeleteEntries(FoxRequest foxRequest) throws Exception {
FoxResponse foxResponse = new FoxResponse(foxRequest);
ICoreKeyStore iCoreKeyStore = this.getCorrectKeyStore(foxRequest);
String[] stringArray = foxRequest.listStrings("alias");
int n = 0;
while (n < stringArray.length) {
log.trace("deleting entry " + stringArray[n]);
iCoreKeyStore.deleteEntry(stringArray[n]);
++n;
}
return foxResponse;
}
public int keyStoreGenerateSelfSignedCert(boolean bl, String string, String string2, Date date, Date date2, int n, int n2, String string3, String string4) throws Exception {
FoxRequest foxRequest = this.makeRequest("keystore.generateSelfSignedCert");
foxRequest.add("useTrustStore", bl);
foxRequest.add("alias", string);
foxRequest.add("dn", string2);
foxRequest.add("notBefore", date.getTime());
foxRequest.add("notAfter", date2.getTime());
foxRequest.add("keySize", n);
foxRequest.add("keyUsage", n2);
foxRequest.add("email", string3);
foxRequest.add("password", string4);
FoxResponse foxResponse = this.sendSync(foxRequest);
return foxResponse.getInt("requestId", -1);
}
private final FoxResponse keyStoreGenerateSelfSignedCert(FoxRequest foxRequest) throws Exception {
FoxResponse foxResponse = new FoxResponse(foxRequest);
ICoreKeyStore iCoreKeyStore = this.getCorrectKeyStore(foxRequest);
String string = foxRequest.getString("alias");
String string2 = foxRequest.getString("dn");
Date date = new Date(foxRequest.getTime("notBefore"));
Date date2 = new Date(foxRequest.getTime("notAfter"));
int n = foxRequest.getInt("keySize");
int n2 = foxRequest.getInt("keyUsage");
String string3 = foxRequest.getString("email", null);
String string4 = foxRequest.getString("password", null);
int n3 = iCoreKeyStore.generateSelfSignedCert(string, string2, date, date2, n, n2, string3, string4);
foxResponse.add("requestId", n3);
return foxResponse;
}
public int keyGetCertGenerationStatus(boolean bl, int n) throws Exception {
FoxRequest foxRequest = this.makeRequest("keystore.getCertGenerationStatus");
foxRequest.add("useTrustStore", bl);
foxRequest.add("requestId", n);
FoxResponse foxResponse = this.sendSync(foxRequest);
return foxResponse.getInt("status", -1);
}
private final FoxResponse keyGetCertGenerationStatus(FoxRequest foxRequest) throws Exception {
FoxResponse foxResponse = new FoxResponse(foxRequest);
ICoreKeyStore iCoreKeyStore = this.getCorrectKeyStore(foxRequest);
int n = foxRequest.getInt("requestId", -1);
int n2 = iCoreKeyStore.getCertGenerationStatus(n);
foxResponse.add("requestId", n);
foxResponse.add("status", n2);
return foxResponse;
}
public NPKCS10CertificationRequest keyStoreGenerateCSR(boolean bl, String string, String string2) throws Exception {
FoxRequest foxRequest = this.makeRequest("keystore.generateCSR");
foxRequest.add("useTrustStore", bl);
foxRequest.add("alias", string);
if (string2 != null) {
foxRequest.add("passwd", string2);
}
FoxResponse foxResponse = this.sendSync(foxRequest);
NPKCS10CertificationRequest nPKCS10CertificationRequest = NPKCS10CertificationRequest.make((String)foxResponse.getString("csr"));
return nPKCS10CertificationRequest;
}
private final FoxResponse keyStoreGenerateCSR(FoxRequest foxRequest) throws Exception {
FoxResponse foxResponse = new FoxResponse(foxRequest);
ICoreKeyStore iCoreKeyStore = this.getCorrectKeyStore(foxRequest);
String string = foxRequest.getString("alias");
String string2 = foxRequest.getString("passwd", null);
NPKCS10CertificationRequest nPKCS10CertificationRequest = iCoreKeyStore.generateCSR(string, string2);
foxResponse.add("csr", nPKCS10CertificationRequest.encodeToString());
return foxResponse;
}
public Enumeration providerProviders() throws Exception {
FoxRequest foxRequest = this.makeRequest("provider.Providers");
FoxResponse foxResponse = this.sendSync(foxRequest);
Vector<NProvider> vector = new Vector<NProvider>();
String[] stringArray = foxResponse.listStrings("provider");
int n = 0;
while (n < stringArray.length) {
vector.add(NProvider.decodeFromString((String)stringArray[n]));
++n;
}
return vector.elements();
}
private final FoxResponse providerProviders(FoxRequest foxRequest) throws Exception {
FoxResponse foxResponse = new FoxResponse(foxRequest);
NProvider[] nProviderArray = NProvider.getProviders();
int n = 0;
while (n < nProviderArray.length) {
foxResponse.add("provider", nProviderArray[n].encodeToString());
++n;
}
return foxResponse;
}
public IProvider providerGetProvider(String string) throws Exception {
FoxRequest foxRequest = this.makeRequest("provider.getProvider");
foxRequest.add("name", string);
FoxResponse foxResponse = this.sendSync(foxRequest);
return NProvider.decodeFromString((String)foxResponse.getString("provider"));
}
private final FoxResponse providerGetProvider(FoxRequest foxRequest) throws Exception {
FoxResponse foxResponse = new FoxResponse(foxRequest);
NProvider[] nProviderArray = NProvider.getProviders();
int n = 0;
while (n < nProviderArray.length) {
foxResponse.add("provider", nProviderArray[n].encodeToString());
++n;
}
return foxResponse;
}
public Enumeration exemptionExemptions() throws Exception {
FoxRequest foxRequest = this.makeRequest("exemption.exemptions");
FoxResponse foxResponse = this.sendSync(foxRequest);
String[] stringArray = foxResponse.listStrings("exemption");
Class clazz = class$com$tridium$crypto$core$cert$NHostExemption;
if (clazz == null) {
clazz = class$com$tridium$crypto$core$cert$NHostExemption = BCryptoChannel.class("[Lcom.tridium.crypto.core.cert.NHostExemption;", false);
}
Array array = new Array(clazz);
int n = 0;
while (n < stringArray.length) {
array.push((Object)NHostExemption.decodeFromString((String)stringArray[n]));
++n;
}
Enumeration enumeration = Collections.enumeration(array.list());
return enumeration;
}
private final FoxResponse exemptionExemptions(FoxRequest foxRequest) throws Exception {
FoxResponse foxResponse = new FoxResponse(foxRequest);
ICoreExemptionStore iCoreExemptionStore = this.service.getExemptionStore();
Enumeration enumeration = iCoreExemptionStore.exemptions();
while (enumeration.hasMoreElements()) {
NHostExemption nHostExemption = (NHostExemption)enumeration.nextElement();
foxResponse.add("exemption", nHostExemption.encodeToString());
}
return foxResponse;
}
public void exemptionSetExemption(NHostExemption nHostExemption) throws Exception {
FoxRequest foxRequest = this.makeRequest("exemption.setExemption");
foxRequest.add("exemption", nHostExemption.encodeToString());
this.sendSync(foxRequest);
}
private final FoxResponse exemptionSetExemption(FoxRequest foxRequest) throws Exception {
FoxResponse foxResponse = new FoxResponse(foxRequest);
ICoreExemptionStore iCoreExemptionStore = this.service.getExemptionStore();
NHostExemption nHostExemption = NHostExemption.make((String)foxRequest.getString("exemption"));
iCoreExemptionStore.setExemption(nHostExemption);
return foxResponse;
}
public void exemptionDeleteExemption(String string) throws Exception {
FoxRequest foxRequest = this.makeRequest("exemption.deleteExemption");
foxRequest.add("host", string);
this.sendSync(foxRequest);
}
private final FoxResponse exemptionDeleteExemption(FoxRequest foxRequest) throws Exception {
FoxResponse foxResponse = new FoxResponse(foxRequest);
ICoreExemptionStore iCoreExemptionStore = this.service.getExemptionStore();
String string = foxRequest.getString("host");
iCoreExemptionStore.deleteExemption(string);
return foxResponse;
}
public NHostExemption exemptionGetExemption(String string) throws Exception {
FoxRequest foxRequest = this.makeRequest("exemption.getExemption");
foxRequest.add("host", string);
FoxResponse foxResponse = this.sendSync(foxRequest);
String string2 = foxResponse.getString("exemption");
NHostExemption nHostExemption = NHostExemption.make((String)string2);
return nHostExemption;
}
private final FoxResponse exemptionGetExemption(FoxRequest foxRequest) throws Exception {
FoxResponse foxResponse = new FoxResponse(foxRequest);
ICoreExemptionStore iCoreExemptionStore = this.service.getExemptionStore();
String string = foxRequest.getString("host");
NHostExemption nHostExemption = iCoreExemptionStore.getExemption(string);
foxResponse.add("exemption", nHostExemption.encodeToString());
return foxResponse;
}
public void exemptionSave() throws Exception {
FoxRequest foxRequest = this.makeRequest("exemption.save");
this.sendSync(foxRequest);
}
private final FoxResponse exemptionSave(FoxRequest foxRequest) throws Exception {
FoxResponse foxResponse = new FoxResponse(foxRequest);
ICoreExemptionStore iCoreExemptionStore = this.service.getExemptionStore();
iCoreExemptionStore.save();
return foxResponse;
}
private final ICoreKeyStore getCorrectKeyStore(FoxRequest foxRequest) throws Exception {
boolean bl = foxRequest.getBoolean("useTrustStore");
if (bl) {
return this.service.getTrustStore();
}
return this.service.getKeyStore();
}
public File getBaseDir() {
try {
return new File(BCryptoChannel.getFilePath(BOrd.make((String)"file:!")));
}
catch (Exception exception) {
return Sys.getBajaHome();
}
}
private static final String getFilePath(BOrd bOrd) throws IOException {
OrdQuery[] ordQueryArray = bOrd.parse();
FilePath filePath = (FilePath)ordQueryArray[ordQueryArray.length - 1];
File file = BFileSystem.INSTANCE.pathToLocalFile(filePath);
return file.getPath();
}
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.validChannel = false;
}
public BCryptoChannel() {
super("crypto");
this.this();
}
static {
Class clazz = class$com$tridium$platcrypto$fox$BCryptoChannel;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$fox$BCryptoChannel = BCryptoChannel.class("[Lcom.tridium.platcrypto.fox.BCryptoChannel;", false);
}
TYPE = Sys.loadType((Class)clazz);
log = Log.getLog((String)"crypto");
}
}
@@ -0,0 +1,64 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.fox.sys.BFoxSession
* javax.baja.naming.BLocalHost
* javax.baja.security.crypto.CertManagerFactory
* javax.baja.sys.BComponent
*/
package com.tridium.platcrypto.fox;
import com.tridium.fox.sys.BFoxSession;
import com.tridium.platcrypto.fox.BCryptoChannel;
import java.io.IOException;
import javax.baja.naming.BLocalHost;
import javax.baja.security.crypto.CertManagerFactory;
import javax.baja.sys.BComponent;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public abstract class ChannelBase {
protected BCryptoChannel channel;
private BComponent parent;
protected void checkChannel() throws IOException {
if (!CertManagerFactory.isCertManagerActive()) {
return;
}
BFoxSession bFoxSession = (BFoxSession)this.parent.getSession();
this.channel = (BCryptoChannel)bFoxSession.getConnection().getChannels().get("crypto", BCryptoChannel.TYPE);
if (this.channel == null) {
throw new IOException("crypto fox channel not found");
}
}
public boolean isSecure() {
boolean bl = false;
if (!CertManagerFactory.isCertManagerActive()) {
return false;
}
BFoxSession bFoxSession = (BFoxSession)this.parent.getSession();
this.channel = (BCryptoChannel)bFoxSession.getConnection().getChannels().get("crypto", BCryptoChannel.TYPE);
if (this.channel != null) {
if (bFoxSession.getUseFoxs()) {
bl = true;
} else if (bFoxSession.getHost() instanceof BLocalHost) {
bl = true;
}
}
return bl;
}
private final /* synthetic */ void this() {
this.channel = null;
this.parent = null;
}
public ChannelBase(BComponent bComponent) {
this.this();
this.parent = bComponent;
}
}
@@ -0,0 +1,49 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.io.ICoreCryptoManager
* com.tridium.crypto.core.io.ICoreExemptionStore
* com.tridium.crypto.core.io.ICoreKeyStore
* com.tridium.crypto.core.io.ICoreProviderInfo
* javax.baja.sys.BComponent
*/
package com.tridium.platcrypto.fox;
import com.tridium.crypto.core.io.ICoreCryptoManager;
import com.tridium.crypto.core.io.ICoreExemptionStore;
import com.tridium.crypto.core.io.ICoreKeyStore;
import com.tridium.crypto.core.io.ICoreProviderInfo;
import com.tridium.platcrypto.fox.ChannelBase;
import com.tridium.platcrypto.fox.ChannelExemptionStore;
import com.tridium.platcrypto.fox.ChannelKeyStore;
import com.tridium.platcrypto.fox.ChannelProviderInfo;
import javax.baja.sys.BComponent;
public class ChannelCryptoManager
extends ChannelBase
implements ICoreCryptoManager {
private BComponent parent;
public ICoreKeyStore getKeyStore() throws Exception {
return new ChannelKeyStore(this.parent, false);
}
public ICoreKeyStore getTrustStore() throws Exception {
return new ChannelKeyStore(this.parent, true);
}
public ICoreExemptionStore getExemptionStore() throws Exception {
return new ChannelExemptionStore(this.parent);
}
public ICoreProviderInfo getProviderInfo() throws Exception {
return new ChannelProviderInfo(this.parent);
}
public ChannelCryptoManager(BComponent bComponent) {
super(bComponent);
this.parent = bComponent;
}
}
@@ -0,0 +1,58 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.cert.NHostExemption
* com.tridium.crypto.core.io.ICoreExemptionStore
* javax.baja.sys.BComponent
*/
package com.tridium.platcrypto.fox;
import com.tridium.crypto.core.cert.NHostExemption;
import com.tridium.crypto.core.io.ICoreExemptionStore;
import com.tridium.platcrypto.fox.ChannelBase;
import java.util.Enumeration;
import javax.baja.sys.BComponent;
public class ChannelExemptionStore
extends ChannelBase
implements ICoreExemptionStore {
public Enumeration exemptions() throws Exception {
this.checkChannel();
return this.channel.exemptionExemptions();
}
public void setExemption(NHostExemption nHostExemption) throws Exception {
this.checkChannel();
this.channel.exemptionSetExemption(nHostExemption);
}
public void deleteExemption(String string) throws Exception {
this.checkChannel();
this.channel.exemptionDeleteExemption(string);
}
public NHostExemption getExemption(String string) throws Exception {
this.checkChannel();
return this.channel.exemptionGetExemption(string);
}
public long getLastModified() throws Exception {
this.checkChannel();
return 0L;
}
public void load() throws Exception {
this.checkChannel();
}
public void save() throws Exception {
this.checkChannel();
this.channel.exemptionSave();
}
public ChannelExemptionStore(BComponent bComponent) {
super(bComponent);
}
}
@@ -0,0 +1,174 @@
/*
* 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.io.ICoreKeyStore
* javax.baja.log.Log
* javax.baja.security.crypto.IKeyStore
* javax.baja.sys.BComponent
*/
package com.tridium.platcrypto.fox;
import com.tridium.crypto.core.cert.CertUtils;
import com.tridium.crypto.core.cert.NPKCS10CertificationRequest;
import com.tridium.crypto.core.io.ICoreKeyStore;
import com.tridium.platcrypto.fox.ChannelBase;
import java.security.Key;
import java.security.KeyStore;
import java.security.cert.X509Certificate;
import java.util.Date;
import java.util.Enumeration;
import javax.baja.log.Log;
import javax.baja.security.crypto.IKeyStore;
import javax.baja.sys.BComponent;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class ChannelKeyStore
extends ChannelBase
implements IKeyStore,
ICoreKeyStore {
protected static Log log = Log.getLog((String)"crypto");
private boolean isTrustStore;
public Enumeration aliases() throws Exception {
this.checkChannel();
return this.channel.keyStoreAliases(this.isTrustStore);
}
public boolean containsAlias(String string) throws Exception {
this.checkChannel();
return this.channel.keyStoreContainsAlias(this.isTrustStore, string);
}
public void deleteEntry(String string) throws Exception {
this.checkChannel();
this.channel.keyStoreDeleteEntry(this.isTrustStore, string);
}
public X509Certificate getCertificate(String string) throws Exception {
this.checkChannel();
return this.channel.keyStoreGetCertificate(this.isTrustStore, string);
}
public String getCertificateAlias(X509Certificate x509Certificate) throws Exception {
this.checkChannel();
return this.channel.keyStoreGetCertificateAlias(this.isTrustStore, x509Certificate);
}
public X509Certificate[] getCertificateChain(String string) throws Exception {
this.checkChannel();
return this.channel.keyStoreGetCertificateChain(this.isTrustStore, string);
}
public Date getCreationDate(String string) throws Exception {
this.checkChannel();
return this.channel.keyStoreGetCreationDate(this.isTrustStore, string);
}
public Key getKey(String string, char[] cArray) throws Exception {
this.checkChannel();
return this.channel.keyStoreGetKey(this.isTrustStore, string, cArray);
}
public boolean isCertificateEntry(String string) throws Exception {
this.checkChannel();
return this.channel.keyStoreIsCertificateEntry(this.isTrustStore, string);
}
public boolean isKeyEntry(String string) throws Exception {
this.checkChannel();
return this.channel.keyStoreIsKeyEntry(this.isTrustStore, string);
}
public void setCertificateEntry(String string, X509Certificate x509Certificate) throws Exception {
this.checkChannel();
this.channel.keyStoreSetCertificateEntry(this.isTrustStore, string, x509Certificate);
}
public void setKeyEntry(String string, byte[] byArray, X509Certificate[] x509CertificateArray) throws Exception {
this.checkChannel();
this.channel.keyStoreSetKeyEntry0(this.isTrustStore, string, byArray, x509CertificateArray);
}
public void setKeyEntry(String string, Key key, char[] cArray, X509Certificate[] x509CertificateArray) throws Exception {
this.checkChannel();
this.channel.keyStoreSetKeyEntry1(this.isTrustStore, string, key, cArray, x509CertificateArray);
}
public int size() throws Exception {
this.checkChannel();
return this.channel.keyStoreSize(this.isTrustStore);
}
public long getLastModified() throws Exception {
this.checkChannel();
return 0L;
}
public void load() throws Exception {
this.checkChannel();
}
public void save() throws Exception {
this.checkChannel();
this.channel.keyStoreSave(this.isTrustStore);
}
public Enumeration getCertificates() throws Exception {
this.checkChannel();
return this.channel.keyStoreGetCertificates(this.isTrustStore);
}
public String findCertificate(X509Certificate x509Certificate) throws Exception {
this.checkChannel();
return this.channel.keyStoreFindCertificate(this.isTrustStore, x509Certificate);
}
public void deleteEntries(String[] stringArray) throws Exception {
this.checkChannel();
this.channel.keyStoreDeleteEntries(this.isTrustStore, stringArray);
}
public KeyStore getKeyStore() throws Exception {
throw new UnsupportedOperationException("can't access raw keystore remotely");
}
public int generateSelfSignedCert(String string, String string2, String string3, String string4, String string5, String string6, String string7, Date date, Date date2, int n, int n2, String string8, String string9) throws Exception {
this.checkChannel();
String string10 = CertUtils.assembleDN((String)string2, (String)string3, (String)string4, (String)string5, (String)string6, (String)string7);
return this.channel.keyStoreGenerateSelfSignedCert(this.isTrustStore, string, string10, date, date2, n, n2, string8, string9);
}
public int generateSelfSignedCert(String string, String string2, Date date, Date date2, int n, int n2, String string3, String string4) throws Exception {
this.checkChannel();
return this.channel.keyStoreGenerateSelfSignedCert(this.isTrustStore, string, string2, date, date2, n, n2, string3, string4);
}
public int getCertGenerationStatus(int n) throws Exception {
return this.channel.keyGetCertGenerationStatus(this.isTrustStore, n);
}
public NPKCS10CertificationRequest generateCSR(String string, String string2) throws Exception {
this.checkChannel();
return this.channel.keyStoreGenerateCSR(this.isTrustStore, string, string2);
}
public boolean canGenerateCertificate() {
return true;
}
private final /* synthetic */ void this() {
this.isTrustStore = false;
}
public ChannelKeyStore(BComponent bComponent, boolean bl) {
super(bComponent);
this.this();
this.isTrustStore = bl;
}
}
@@ -0,0 +1,36 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.io.ICoreProviderInfo
* com.tridium.crypto.core.provider.IProvider
* javax.baja.sys.BComponent
*/
package com.tridium.platcrypto.fox;
import com.tridium.crypto.core.io.ICoreProviderInfo;
import com.tridium.crypto.core.provider.IProvider;
import com.tridium.platcrypto.core.IProviderInfo;
import com.tridium.platcrypto.fox.ChannelBase;
import java.util.Enumeration;
import javax.baja.sys.BComponent;
public class ChannelProviderInfo
extends ChannelBase
implements IProviderInfo,
ICoreProviderInfo {
public Enumeration providers() throws Exception {
this.checkChannel();
return this.channel.providerProviders();
}
public IProvider getProvider(String string) throws Exception {
this.checkChannel();
return this.channel.providerGetProvider(string);
}
public ChannelProviderInfo(BComponent bComponent) {
super(bComponent);
}
}
@@ -0,0 +1,102 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.fox.sys.BFoxsScheme$FoxQuery
* com.tridium.workbench.nav.BFoxCnxHandler
* com.tridium.workbench.ord.BFoxsSessionOrdFE
* com.tridium.workbench.ord.BHostOrdFE
* javax.baja.naming.BOrd
* javax.baja.naming.OrdQuery
* javax.baja.security.BICredentials
* javax.baja.security.BUsernameAndPassword
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.util.Lexicon
*/
package com.tridium.platcrypto.fox.ui;
import com.tridium.fox.sys.BFoxsScheme;
import com.tridium.workbench.nav.BFoxCnxHandler;
import com.tridium.workbench.ord.BFoxsSessionOrdFE;
import com.tridium.workbench.ord.BHostOrdFE;
import javax.baja.naming.BOrd;
import javax.baja.naming.OrdQuery;
import javax.baja.security.BICredentials;
import javax.baja.security.BUsernameAndPassword;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.util.Lexicon;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BFoxSCnxHandler
extends BFoxCnxHandler {
public static final Type TYPE;
private static final String KEY = "open.ssl.station";
static /* synthetic */ Class class$com$tridium$platcrypto$fox$ui$BFoxSCnxHandler;
public Type getType() {
return TYPE;
}
protected void saveHostAddress() throws Exception {
this.ordFE.setAutoSaveHistory(false);
BOrd bOrd = (BOrd)this.ordFE.saveValue();
OrdQuery[] ordQueryArray = bOrd.parse();
this.hostOrd = BOrd.make((OrdQuery)ordQueryArray[0]);
int n = this.defaultPort;
String[] stringArray = null;
int n2 = 1;
while (n2 < ordQueryArray.length) {
if (ordQueryArray[n2] instanceof BFoxsScheme.FoxQuery) {
BFoxsScheme.FoxQuery foxQuery = (BFoxsScheme.FoxQuery)ordQueryArray[n2];
n = foxQuery.getPort();
stringArray = foxQuery.getTunnelAuthorities();
break;
}
++n2;
}
this.port = n;
this.tunnelAuthorities = stringArray;
}
public boolean isSecure() {
return true;
}
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 BFoxSCnxHandler() {
super("foxs", 4911, (BHostOrdFE)new BFoxsSessionOrdFE(), (BICredentials)new BUsernameAndPassword(), TYPE.getModule().getLexicon(), KEY);
}
public BFoxSCnxHandler(Lexicon lexicon, String string) {
super("foxs", 4911, (BHostOrdFE)new BFoxsSessionOrdFE(), (BICredentials)new BUsernameAndPassword(), lexicon, string);
}
public BFoxSCnxHandler(String string, int n, BHostOrdFE bHostOrdFE, BICredentials bICredentials, Lexicon lexicon, String string2) {
super(string, n, bHostOrdFE, bICredentials, lexicon, string2);
}
static {
Class clazz = class$com$tridium$platcrypto$fox$ui$BFoxSCnxHandler;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$fox$ui$BFoxSCnxHandler = BFoxSCnxHandler.class("[Lcom.tridium.platcrypto.fox.ui.BFoxSCnxHandler;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,73 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.fox.sys.BFoxSession
* com.tridium.workbench.nav.BFoxSessionAgent
* javax.baja.naming.BHost
* javax.baja.naming.BISession
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.xml.XElem
*/
package com.tridium.platcrypto.fox.ui;
import com.tridium.fox.sys.BFoxSession;
import com.tridium.workbench.nav.BFoxSessionAgent;
import javax.baja.naming.BHost;
import javax.baja.naming.BISession;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.xml.XElem;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BFoxSslSessionAgent
extends BFoxSessionAgent {
public static final BFoxSslSessionAgent INSTANCE = new BFoxSslSessionAgent();
public static final Type TYPE;
static /* synthetic */ Class class$com$tridium$platcrypto$fox$ui$BFoxSslSessionAgent;
public Type getType() {
return TYPE;
}
public void pickle(BISession bISession, XElem xElem) {
BFoxSession bFoxSession = (BFoxSession)bISession;
xElem.addAttr("port", "" + bFoxSession.getPort());
xElem.addAttr("useFoxs", "true");
if (bFoxSession.getStationName() != null) {
xElem.addAttr("stationName", bFoxSession.getStationName());
}
}
public BISession unpickle(BHost bHost, XElem xElem) {
int n = xElem.geti("port", 4911);
String string = xElem.get("stationName", null);
boolean bl = xElem.getb("useFoxs", true);
return BFoxSession.make((String)string, (BHost)bHost, (int)n, (boolean)true);
}
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$fox$ui$BFoxSslSessionAgent;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$fox$ui$BFoxSslSessionAgent = BFoxSslSessionAgent.class("[Lcom.tridium.platcrypto.fox.ui.BFoxSslSessionAgent;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,24 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.nre.security.ISecurityInfoProvider
*/
package com.tridium.platcrypto.socket;
import com.tridium.nre.security.ISecurityInfoProvider;
import com.tridium.platcrypto.socket.CryptoClientSocketFactory;
public abstract class CryptoClientNoArgSocketFactory
extends CryptoClientSocketFactory {
private static ISecurityInfoProvider secInfo = null;
public static void setBaseDir(ISecurityInfoProvider iSecurityInfoProvider) throws Exception {
secInfo = iSecurityInfoProvider;
}
public CryptoClientNoArgSocketFactory(String string) throws Exception {
super(secInfo, string);
}
}
@@ -0,0 +1,29 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.io.CryptoCoreClientSocketFactory
* com.tridium.crypto.core.util.ILogger
* com.tridium.nre.security.ISecurityInfoProvider
* javax.baja.io.net.IClientSocketFactory
* javax.baja.log.Log
*/
package com.tridium.platcrypto.socket;
import com.tridium.crypto.core.io.CryptoCoreClientSocketFactory;
import com.tridium.crypto.core.util.ILogger;
import com.tridium.nre.security.ISecurityInfoProvider;
import com.tridium.platcrypto.util.Logger;
import javax.baja.io.net.IClientSocketFactory;
import javax.baja.log.Log;
public class CryptoClientSocketFactory
extends CryptoCoreClientSocketFactory
implements IClientSocketFactory {
private static ILogger log = new Logger(Log.getLog((String)"crypto"));
public CryptoClientSocketFactory(ISecurityInfoProvider iSecurityInfoProvider, String string) throws Exception {
super(iSecurityInfoProvider, string, log);
}
}
@@ -0,0 +1,30 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.security.crypto.BTlsEnum
*/
package com.tridium.platcrypto.socket;
import com.tridium.platcrypto.socket.CryptoClientNoArgSocketFactory;
import javax.baja.security.crypto.BTlsEnum;
import javax.net.SocketFactory;
import javax.net.ssl.SSLSocketFactory;
public final class CryptoClientTlsSocketFactory
extends CryptoClientNoArgSocketFactory {
public static final SocketFactory getDefault() {
try {
return new CryptoClientTlsSocketFactory();
}
catch (Exception exception) {
exception.printStackTrace();
return SSLSocketFactory.getDefault();
}
}
public CryptoClientTlsSocketFactory() throws Exception {
super(BTlsEnum.DEFAULT.getTag());
}
}
@@ -0,0 +1,29 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.io.CryptoCoreServerSocketFactory
* com.tridium.crypto.core.util.ILogger
* com.tridium.nre.security.ISecurityInfoProvider
* javax.baja.io.net.IServerSocketFactory
* javax.baja.log.Log
*/
package com.tridium.platcrypto.socket;
import com.tridium.crypto.core.io.CryptoCoreServerSocketFactory;
import com.tridium.crypto.core.util.ILogger;
import com.tridium.nre.security.ISecurityInfoProvider;
import com.tridium.platcrypto.util.Logger;
import javax.baja.io.net.IServerSocketFactory;
import javax.baja.log.Log;
public class CryptoServerSocketFactory
extends CryptoCoreServerSocketFactory
implements IServerSocketFactory {
private static ILogger log = new Logger(Log.getLog((String)"crypto"));
public CryptoServerSocketFactory(ISecurityInfoProvider iSecurityInfoProvider, String string, boolean bl, String string2) throws Exception {
super(iSecurityInfoProvider, string, string2, log);
}
}
@@ -0,0 +1,29 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.io.CryptoSupport
*/
package com.tridium.platcrypto.socket;
import com.tridium.crypto.core.io.CryptoSupport;
import com.tridium.platcrypto.socket.CryptoClientSocketFactory;
import com.tridium.platcrypto.util.TridiumAppletX509TrustManager;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
public class CryptoWbAppletClientSocketFactory
extends CryptoClientSocketFactory {
protected SSLContext createSSLContext(String string) throws Exception {
SSLContext sSLContext = SSLContext.getInstance(CryptoSupport.getProtocolName((String)string));
this.trustMgr = new TridiumAppletX509TrustManager();
TrustManager[] trustManagerArray = new TrustManager[]{this.trustMgr};
sSLContext.init(null, trustManagerArray, null);
return sSLContext;
}
public CryptoWbAppletClientSocketFactory(String string) throws Exception {
super(null, string);
}
}
@@ -0,0 +1,37 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.io.CoreCryptoManager
* com.tridium.crypto.core.io.CryptoSupport
* com.tridium.nre.security.ISecurityInfoProvider
* com.tridium.sys.Nre
*/
package com.tridium.platcrypto.socket;
import com.tridium.crypto.core.io.CoreCryptoManager;
import com.tridium.crypto.core.io.CryptoSupport;
import com.tridium.nre.security.ISecurityInfoProvider;
import com.tridium.platcrypto.socket.CryptoClientSocketFactory;
import com.tridium.platcrypto.ui.TridiumUIX509TrustManager;
import com.tridium.sys.Nre;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
public class CryptoWbClientSocketFactory
extends CryptoClientSocketFactory {
protected SSLContext createSSLContext(String string) throws Exception {
SSLContext sSLContext = SSLContext.getInstance(CryptoSupport.getProtocolName((String)string));
CoreCryptoManager coreCryptoManager = CoreCryptoManager.get((ISecurityInfoProvider)Nre.getSecurityInfoProvider());
this.trustMgr = new TridiumUIX509TrustManager(Nre.getSecurityInfoProvider());
TrustManager[] trustManagerArray = new X509TrustManager[]{this.trustMgr};
sSLContext.init(null, trustManagerArray, null);
return sSLContext;
}
public CryptoWbClientSocketFactory(ISecurityInfoProvider iSecurityInfoProvider, String string) throws Exception {
super(iSecurityInfoProvider, string);
}
}
@@ -0,0 +1,175 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.cert.NX509Certificate
* com.tridium.crypto.core.cert.NX509CertificateEntry
* com.tridium.crypto.core.io.CryptoSupport
* com.tridium.crypto.core.provider.IProvider
* com.tridium.crypto.core.provider.IProviderEntry
* com.tridium.crypto.core.provider.IProviderSection
* com.tridium.nre.security.SecurityInitializer
* javax.baja.security.crypto.CertManagerFactory
* javax.baja.security.crypto.IKeyStore
* javax.baja.spy.Spy
* javax.baja.spy.SpyDir
* javax.baja.spy.SpyWriter
*/
package com.tridium.platcrypto.spy;
import com.tridium.crypto.core.cert.NX509Certificate;
import com.tridium.crypto.core.cert.NX509CertificateEntry;
import com.tridium.crypto.core.io.CryptoSupport;
import com.tridium.crypto.core.provider.IProvider;
import com.tridium.crypto.core.provider.IProviderEntry;
import com.tridium.crypto.core.provider.IProviderSection;
import com.tridium.nre.security.SecurityInitializer;
import com.tridium.platcrypto.core.IExtCryptoManager;
import java.security.cert.Certificate;
import java.security.cert.X509Certificate;
import java.util.Enumeration;
import javax.baja.security.crypto.CertManagerFactory;
import javax.baja.security.crypto.IKeyStore;
import javax.baja.spy.Spy;
import javax.baja.spy.SpyDir;
import javax.baja.spy.SpyWriter;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class CryptoPlatformPage
extends SpyDir {
private IExtCryptoManager service;
public void write(SpyWriter spyWriter) throws Exception {
Object object;
Object object2;
String[] stringArray;
Object object3;
if (this.service == null) {
this.service = (IExtCryptoManager)CertManagerFactory.getInstanceEx();
}
try {
object3 = this.service.getTrustStore();
if (object3 != null) {
stringArray = object3.aliases();
while (stringArray.hasMoreElements()) {
String string = (String)stringArray.nextElement();
object2 = object3.getCertificate(string);
if (!((Certificate)object2).getType().equals("X.509")) continue;
object = NX509CertificateEntry.make((String)string, (X509Certificate[])new X509Certificate[]{object2}, null);
this.add(string, (Spy)new CertificatePage((NX509CertificateEntry)object));
}
}
}
catch (Exception exception) {}
spyWriter.startProps("FIPS");
spyWriter.prop((Object)"fips mode", (Object)(SecurityInitializer.isFips() ? "ON" : "OFF"));
spyWriter.endProps();
spyWriter.startTable(false);
spyWriter.trTitle((Object)"Providers", 3);
spyWriter.w((Object)"<tr>").th((Object)"Provider").th((Object)"Version").th((Object)"Description").w((Object)"</tr>\n");
object3 = this.service.getProviderInfo().providers();
while (object3.hasMoreElements()) {
stringArray = (IProvider)object3.nextElement();
this.add(stringArray.getName(), (Spy)new ProviderPage((IProvider)stringArray));
spyWriter.w((Object)"<tr><td>").a(stringArray.getName()).w((Object)"</td>").td((Object)("" + stringArray.getVersion())).w((Object)("<td align='left'>" + stringArray.getDescription() + "</td>")).w((Object)"</tr>");
}
spyWriter.endTable();
spyWriter.startProps("Supported Ciphers");
stringArray = CryptoSupport.getSupportedCiphers();
int n = 0;
while (n < stringArray.length) {
spyWriter.prop((Object)stringArray[n], (Object)"");
++n;
}
spyWriter.endProps();
IKeyStore iKeyStore = this.service.getTrustStore();
if (iKeyStore != null) {
spyWriter.startTable(false);
spyWriter.trTitle((Object)"Trusted Certificates", 4);
spyWriter.w((Object)"<tr>").th((Object)"Alias").th((Object)"Issued To").th((Object)"Issued By").th((Object)"Expires").w((Object)"</tr>\n");
object2 = iKeyStore.aliases();
while (object2.hasMoreElements()) {
object = (String)object2.nextElement();
X509Certificate x509Certificate = iKeyStore.getCertificate((String)object);
if (!x509Certificate.getType().equals("X.509")) continue;
NX509Certificate nX509Certificate = NX509Certificate.make((X509Certificate)x509Certificate);
spyWriter.w((Object)"<tr><td>").a((String)object).w((Object)"</td>").td(object).td((Object)nX509Certificate.getIssuer()).td((Object)nX509Certificate.getNotAfter()).w((Object)"</tr>");
}
spyWriter.endTable();
}
}
private final /* synthetic */ void this() {
this.service = null;
}
public CryptoPlatformPage() {
this.this();
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
private class CertificatePage
extends SpyDir {
private NX509CertificateEntry cert;
public void write(SpyWriter spyWriter) throws Exception {
if (CryptoPlatformPage.this.service == null) {
CryptoPlatformPage.this.service = (IExtCryptoManager)CertManagerFactory.getInstanceEx();
}
spyWriter.startProps(this.cert.getAlias());
spyWriter.prop((Object)"Version", (Object)("v" + this.cert.getCertificate(0).getVersion()));
spyWriter.prop((Object)"Serial Number", (Object)this.cert.getCertificate(0).getSerialNumber());
spyWriter.prop((Object)"Issued By", (Object)this.cert.getCertificate(0).getIssuer());
spyWriter.prop((Object)"Subject", (Object)this.cert.getCertificate(0).getSubject());
spyWriter.prop((Object)"Not Before", (Object)this.cert.getCertificate(0).getNotBefore());
spyWriter.prop((Object)"Not After", (Object)this.cert.getCertificate(0).getNotAfter());
spyWriter.prop((Object)"Signature Algorithm", (Object)this.cert.getCertificate(0).getSignatureAlgorithm());
spyWriter.prop((Object)"Basic Constraints", (Object)this.cert.getCertificate(0).getBasicConstraints());
spyWriter.prop((Object)"Key Usage", (Object)this.cert.getCertificate(0).getKeyUsage());
spyWriter.prop((Object)"Extended Key Usage", (Object)this.cert.getCertificate(0).getExtendedKeyUsage());
spyWriter.prop((Object)"MD5 Fingerprint", (Object)this.cert.getCertificate(0).getMD5Fingerprint());
spyWriter.prop((Object)"SHA1 Fingerprint", (Object)this.cert.getCertificate(0).getSHA1Fingerprint());
spyWriter.endProps();
}
public CertificatePage(NX509CertificateEntry nX509CertificateEntry) {
this.cert = nX509CertificateEntry;
}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
private class ProviderPage
extends SpyDir {
private IProvider provider;
public void write(SpyWriter spyWriter) throws Exception {
spyWriter.startProps("info");
spyWriter.prop((Object)"provider", (Object)this.provider.getName());
spyWriter.prop((Object)"name", (Object)("" + this.provider.getVersion()));
spyWriter.prop((Object)"description", (Object)this.provider.getDescription());
spyWriter.endProps();
Enumeration enumeration = this.provider.sections();
while (enumeration.hasMoreElements()) {
IProviderSection iProviderSection = (IProviderSection)enumeration.nextElement();
spyWriter.startProps(iProviderSection.getName());
Enumeration enumeration2 = iProviderSection.entries();
while (enumeration2.hasMoreElements()) {
IProviderEntry iProviderEntry = (IProviderEntry)enumeration2.nextElement();
spyWriter.prop((Object)iProviderEntry.getKey(), (Object)iProviderEntry.getValue());
}
spyWriter.endProps();
}
}
public ProviderPage(IProvider iProvider) {
this.provider = iProvider;
}
}
}
@@ -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")));
}
}
@@ -0,0 +1,60 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.file.BDataFile
* javax.baja.sys.BIcon
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.util.Lexicon
*/
package com.tridium.platcrypto.util;
import javax.baja.file.BDataFile;
import javax.baja.sys.BIcon;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.util.Lexicon;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BPemFile
extends BDataFile {
public static final Type TYPE;
private static final Lexicon lex;
private static final BIcon icon;
static /* synthetic */ Class class$com$tridium$platcrypto$util$BPemFile;
public Type getType() {
return TYPE;
}
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$util$BPemFile;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$util$BPemFile = BPemFile.class("[Lcom.tridium.platcrypto.util.BPemFile;", false);
}
TYPE = Sys.loadType((Class)clazz);
lex = Lexicon.make((String)"platCrypto");
icon = BIcon.std((String)"files/certificate.png");
}
}
@@ -0,0 +1,177 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.cert.CertValidationResult
* com.tridium.crypto.core.cert.NX509Certificate
* com.tridium.crypto.core.cert.TridiumCertValidator
* com.tridium.crypto.core.io.CryptoSupport
* com.tridium.crypto.core.io.ICoreCryptoManager
* com.tridium.util.BSessionInfo
* javax.baja.security.crypto.CertManagerFactory
* javax.baja.sys.BAbsTime
* javax.baja.sys.BIcon
* javax.baja.sys.Context
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.util.Lexicon
*/
package com.tridium.platcrypto.util;
import com.tridium.crypto.core.cert.CertValidationResult;
import com.tridium.crypto.core.cert.NX509Certificate;
import com.tridium.crypto.core.cert.TridiumCertValidator;
import com.tridium.crypto.core.io.CryptoSupport;
import com.tridium.crypto.core.io.ICoreCryptoManager;
import com.tridium.platcrypto.core.IExtCryptoManager;
import com.tridium.util.BSessionInfo;
import java.net.Socket;
import java.security.cert.Certificate;
import javax.baja.security.crypto.CertManagerFactory;
import javax.baja.sys.BAbsTime;
import javax.baja.sys.BIcon;
import javax.baja.sys.Context;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.util.Lexicon;
import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSocket;
import javax.security.cert.X509Certificate;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BSslSessionInfo
extends BSessionInfo {
public static final Type TYPE;
private static Lexicon lex;
private NX509Certificate cert;
private String protocol;
private String cipherSuite;
private boolean hostnameVerified;
private boolean validCertChain;
private boolean certExpired;
static /* synthetic */ Class class$com$tridium$platcrypto$util$BSslSessionInfo;
public Type getType() {
return TYPE;
}
public static BSessionInfo make(String string, BAbsTime bAbsTime, Socket socket, String string2) {
return new BSslSessionInfo(string, bAbsTime, socket, string2);
}
public BIcon getIdentityVerifiedIcon() {
if (!this.hostnameVerified || !this.validCertChain || this.certExpired) {
return BIcon.make((String)lex.getText("session.info.identityVerified.failed.icon"));
}
return BIcon.make((String)lex.getText("session.info.identityVerified.succeeded.icon"));
}
public String getIdentityVerifiedMessage() {
if (!this.hostnameVerified || !this.validCertChain || this.certExpired) {
StringBuffer stringBuffer = new StringBuffer(lex.getText("session.info.identityVerified.failed.title")).append("\n");
if (!this.hostnameVerified) {
stringBuffer.append(" - " + lex.getText("session.info.identityVerified.failed.hostnameMismatch")).append("\n");
}
if (!this.validCertChain) {
stringBuffer.append(" - " + lex.getText("session.info.identityVerified.failed.certValidation")).append("\n");
}
if (this.certExpired) {
stringBuffer.append(" - " + lex.getText("session.info.identityVerified.failed.certExpired")).append("\n");
}
return stringBuffer.toString();
}
return lex.getText("session.info.identityVerified.succeeded", new Object[]{this.cert.getIssuer()});
}
public BIcon getSessionEncryptedIcon() {
return BIcon.make((String)lex.getText("session.info.sessionEncrypted.icon"));
}
public String getSessionEncryptedMessage() {
return lex.getText("session.info.sessionEncrypted", new Object[]{this.hostname, "" + CryptoSupport.getEncryptionBits((String)this.cipherSuite), this.protocol, CryptoSupport.getEncryptionCipher((String)this.cipherSuite), CryptoSupport.getMessageAuthCipher((String)this.cipherSuite), CryptoSupport.getKeyExchangeCipher((String)this.cipherSuite)});
}
public String getProtocol() {
return this.protocol;
}
public NX509Certificate getCertificate() {
return this.cert;
}
public String toString(Context context) {
return "SslSessionInfo: cert=" + this.cert.getSubject() + ", protocol=" + this.protocol + ", cipherSuite=" + this.cipherSuite + ", hostnameVerified=" + this.hostnameVerified + ", validCertChain=" + this.validCertChain + ", certExpired=" + this.certExpired;
}
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.cert = null;
this.protocol = null;
this.cipherSuite = null;
this.hostnameVerified = false;
this.validCertChain = false;
this.certExpired = false;
}
public BSslSessionInfo() {
this.this();
}
public BSslSessionInfo(String string, BAbsTime bAbsTime, Socket socket, String string2) {
super(string, bAbsTime, string2);
this.this();
SSLSocket sSLSocket = (SSLSocket)socket;
SSLSession sSLSession = sSLSocket.getSession();
if (sSLSession != null) {
this.cipherSuite = sSLSession.getCipherSuite();
this.protocol = sSLSession.getProtocol();
try {
Certificate[] certificateArray = sSLSession.getPeerCertificates();
if (certificateArray != null && certificateArray.length > 0 && certificateArray[0] instanceof java.security.cert.X509Certificate) {
this.cert = NX509Certificate.make((java.security.cert.X509Certificate)((java.security.cert.X509Certificate)certificateArray[0]));
}
X509Certificate[] x509CertificateArray = sSLSession.getPeerCertificateChain();
java.security.cert.X509Certificate[] x509CertificateArray2 = new java.security.cert.X509Certificate[x509CertificateArray.length];
int n = 0;
while (n < x509CertificateArray.length) {
x509CertificateArray2[n] = NX509Certificate.convert((X509Certificate)x509CertificateArray[n]);
++n;
}
IExtCryptoManager iExtCryptoManager = (IExtCryptoManager)CertManagerFactory.getInstanceEx();
String string3 = sSLSession.getPeerHost();
String string4 = sSLSession.getPeerHost() + ':' + sSLSession.getPeerPort();
CertValidationResult certValidationResult = TridiumCertValidator.validateCertificate((java.security.cert.X509Certificate[])x509CertificateArray2, (ICoreCryptoManager)iExtCryptoManager.getCoreCryptoManager(), (String)string3, (String)string4);
this.hostnameVerified = certValidationResult.isHostnameVerified();
this.validCertChain = certValidationResult.isValidCertChain();
this.certExpired = certValidationResult.isCertExpired();
}
catch (Exception exception) {
exception.printStackTrace();
}
}
}
static {
Class clazz = class$com$tridium$platcrypto$util$BSslSessionInfo;
if (clazz == null) {
clazz = class$com$tridium$platcrypto$util$BSslSessionInfo = BSslSessionInfo.class("[Lcom.tridium.platcrypto.util.BSslSessionInfo;", false);
}
TYPE = Sys.loadType((Class)clazz);
lex = Lexicon.make((String)"platCrypto");
}
}
@@ -0,0 +1,14 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platcrypto.util;
import javax.net.ssl.SSLException;
public class HostValidationException
extends SSLException {
public HostValidationException(String string) {
super(string);
}
}
@@ -0,0 +1,81 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.util.ILogger
* javax.baja.log.Log
*/
package com.tridium.platcrypto.util;
import com.tridium.crypto.core.util.ILogger;
import javax.baja.log.Log;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class Logger
implements ILogger {
private Log log;
public void error(String string) {
this.log.error(string);
}
public void error(String string, Throwable throwable) {
this.log.error(string, throwable);
}
public void warning(String string) {
this.log.warning(string);
}
public void warning(String string, Throwable throwable) {
this.log.warning(string, throwable);
}
public void message(String string) {
this.log.message(string);
}
public void message(String string, Throwable throwable) {
this.log.message(string, throwable);
}
public void trace(String string) {
this.log.trace(string);
}
public void trace(String string, Throwable throwable) {
this.log.trace(string, throwable);
}
public void trace(byte[] byArray) {
this.log.trace(byArray);
}
public void trace(byte[] byArray, int n, int n2) {
this.log.trace(byArray, n, n2);
}
public void trace(String string, byte[] byArray) {
this.log.trace(string, byArray);
}
public void trace(String string, byte[] byArray, int n, int n2) {
this.log.trace(string, byArray, n, n2);
}
public boolean isTraceOn() {
return this.log.isTraceOn();
}
private final /* synthetic */ void this() {
this.log = null;
}
public Logger(Log log) {
this.this();
this.log = log;
}
}
@@ -0,0 +1,64 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.crypto.core.cert.TridiumX509TrustManager
* javax.baja.nre.util.ByteArrayUtil
*/
package com.tridium.platcrypto.util;
import com.tridium.crypto.core.cert.TridiumX509TrustManager;
import java.security.KeyStore;
import java.security.MessageDigest;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import javax.baja.nre.util.ByteArrayUtil;
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.X509TrustManager;
public class TridiumAppletX509TrustManager
extends TridiumX509TrustManager
implements X509TrustManager {
public void checkServerTrusted(X509Certificate[] x509CertificateArray, String string) throws CertificateException {
block2: {
try {
this.defaultTrustManager.checkServerTrusted(x509CertificateArray, string);
}
catch (Exception exception) {
String string2 = TridiumAppletX509TrustManager.extractSHA1Fingerprint(x509CertificateArray[0]);
String string3 = System.getProperty("sha1FingerPrint", "");
if (string2.equalsIgnoreCase(string3)) break block2;
throw new CertificateException("sha1 fingerprints don't match", exception);
}
}
}
private static final String extractSHA1Fingerprint(X509Certificate x509Certificate) {
byte[] byArray;
try {
MessageDigest messageDigest = MessageDigest.getInstance("SHA1");
byArray = messageDigest.digest(x509Certificate.getEncoded());
}
catch (Exception exception) {
return "???";
}
return ByteArrayUtil.toHexString((byte[])byArray, (String)":");
}
public TridiumAppletX509TrustManager() throws Exception {
TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance("SunX509");
trustManagerFactory.init((KeyStore)null);
TrustManager[] trustManagerArray = trustManagerFactory.getTrustManagers();
int n = 0;
while (n < trustManagerArray.length) {
if (trustManagerArray[n] instanceof X509TrustManager) {
this.defaultTrustManager = (X509TrustManager)trustManagerArray[n];
return;
}
++n;
}
throw new Exception("Error intializing trust manager");
}
}
@@ -0,0 +1,12 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platcrypto.util;
public class ValidationException
extends Exception {
public ValidationException(String string) {
super(string);
}
}