link start!
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.security.crypto;
|
||||
|
||||
import javax.baja.sys.BFrozenEnum;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public final class BSslTlsEnum
|
||||
extends BFrozenEnum {
|
||||
public static final int SSLV_3 = 1;
|
||||
public static final int TLSV_1 = 2;
|
||||
public static final int SSLV_3ANDTLSV_1 = 4;
|
||||
public static final BSslTlsEnum sslv3 = new BSslTlsEnum(1);
|
||||
public static final BSslTlsEnum tlsv1 = new BSslTlsEnum(2);
|
||||
public static final BSslTlsEnum sslv3andtlsv1 = new BSslTlsEnum(4);
|
||||
public static final Type TYPE;
|
||||
public static final BSslTlsEnum DEFAULT;
|
||||
static /* synthetic */ Class class$javax$baja$security$crypto$BSslTlsEnum;
|
||||
|
||||
public final Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static final BSslTlsEnum make(int n) {
|
||||
return (BSslTlsEnum)sslv3.getRange().get(n, false);
|
||||
}
|
||||
|
||||
public static final BSslTlsEnum make(String string) {
|
||||
return (BSslTlsEnum)sslv3.getRange().get(string);
|
||||
}
|
||||
|
||||
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 BSslTlsEnum(int n) {
|
||||
super(n);
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$security$crypto$BSslTlsEnum;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$security$crypto$BSslTlsEnum = BSslTlsEnum.class("[Ljavax.baja.security.crypto.BSslTlsEnum;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
DEFAULT = sslv3andtlsv1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.security.crypto;
|
||||
|
||||
import javax.baja.sys.BFrozenEnum;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public final class BTlsEnum
|
||||
extends BFrozenEnum {
|
||||
public static final int TLSV_1 = 0;
|
||||
public static final int TLSV_1_1 = 1;
|
||||
public static final int TLSV_1_2 = 2;
|
||||
public static final BTlsEnum tlsv1 = new BTlsEnum(0);
|
||||
public static final BTlsEnum tlsv1_1 = new BTlsEnum(1);
|
||||
public static final BTlsEnum tlsv1_2 = new BTlsEnum(2);
|
||||
public static final Type TYPE;
|
||||
public static final BTlsEnum DEFAULT;
|
||||
public static final int DEFAULT_ORDINAL;
|
||||
static /* synthetic */ Class class$javax$baja$security$crypto$BTlsEnum;
|
||||
|
||||
public final Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static final BTlsEnum make(int n) {
|
||||
return (BTlsEnum)tlsv1.getRange().get(n, false);
|
||||
}
|
||||
|
||||
public static final BTlsEnum make(String string) {
|
||||
return (BTlsEnum)tlsv1.getRange().get(string);
|
||||
}
|
||||
|
||||
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 BTlsEnum(int n) {
|
||||
super(n);
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$security$crypto$BTlsEnum;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$security$crypto$BTlsEnum = BTlsEnum.class("[Ljavax.baja.security.crypto.BTlsEnum;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
DEFAULT = tlsv1;
|
||||
DEFAULT_ORDINAL = DEFAULT.getOrdinal();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.security.crypto;
|
||||
|
||||
import com.tridium.sys.Nre;
|
||||
import java.lang.reflect.Method;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.security.crypto.ICryptoManager;
|
||||
import javax.baja.security.crypto.ICryptoManagerEx;
|
||||
import javax.baja.sys.NotRunningException;
|
||||
import javax.baja.sys.ServiceNotFoundException;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public class CertManagerFactory {
|
||||
private static Log log = Log.getLog("crypto");
|
||||
private static ICryptoManagerEx instance = null;
|
||||
private static Object mutex = new Object();
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
* Converted monitor instructions to comments
|
||||
* Lifted jumps to return sites
|
||||
*/
|
||||
public static boolean isCertManagerActive() {
|
||||
try {
|
||||
CertManagerFactory.getInstanceEx();
|
||||
Object object = mutex;
|
||||
// MONITORENTER : object
|
||||
if (instance != null) {
|
||||
// MONITOREXIT : object
|
||||
return true;
|
||||
}
|
||||
// MONITOREXIT : object
|
||||
return false;
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static ICryptoManager getInstance() throws Exception {
|
||||
return CertManagerFactory.getInstanceEx();
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public static ICryptoManagerEx getInstanceEx() throws Exception {
|
||||
Object object = mutex;
|
||||
synchronized (object) {
|
||||
block9: {
|
||||
block10: {
|
||||
if (instance != null) break block9;
|
||||
if (Nre.stationHome == null) break block10;
|
||||
if (Sys.getStation() == null) {
|
||||
throw new NotRunningException("station hasn't finished loading services, can't retrieve ICryptoManagerEx instance");
|
||||
}
|
||||
if (Sys.getStation().isRunning() && (instance = (ICryptoManagerEx)((Object)Sys.getService(Sys.getType("platCrypto:CertManagerService")))) == null) {
|
||||
throw new ServiceNotFoundException("unable to find CertManagerService");
|
||||
}
|
||||
break block9;
|
||||
}
|
||||
if (Nre.bootEnv.isRemote()) {
|
||||
Type type = Sys.getType("platCrypto:WbAppletCertManager");
|
||||
instance = CertManagerFactory.make(type.getTypeClass());
|
||||
if (instance == null) {
|
||||
throw new ServiceNotFoundException("unable to find WbAppletCertManager instance");
|
||||
}
|
||||
} else {
|
||||
Type type = Sys.getType("platCrypto:WbCertManager");
|
||||
instance = CertManagerFactory.make(type.getTypeClass());
|
||||
if (instance == null) {
|
||||
throw new ServiceNotFoundException("unable to find WbCertManager instance");
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
private static final ICryptoManagerEx make(Class clazz) {
|
||||
try {
|
||||
Method method = clazz.getMethod("make", null);
|
||||
ICryptoManagerEx iCryptoManagerEx = (ICryptoManagerEx)method.invoke((Object)clazz, null);
|
||||
return iCryptoManagerEx;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
if (log.isTraceOn()) {
|
||||
log.error("unable to call make on " + clazz.getName(), exception);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.security.crypto;
|
||||
|
||||
import javax.baja.io.net.IClientSocketFactory;
|
||||
import javax.baja.io.net.IServerSocketFactory;
|
||||
import javax.baja.security.crypto.BSslTlsEnum;
|
||||
import javax.baja.security.crypto.IKeyStore;
|
||||
|
||||
public interface ICryptoManager {
|
||||
public IKeyStore getTrustStore() throws Exception;
|
||||
|
||||
public IKeyStore getKeyStore() throws Exception;
|
||||
|
||||
public IServerSocketFactory getServerSocketFactory(BSslTlsEnum var1, boolean var2, String var3) throws Exception;
|
||||
|
||||
public IClientSocketFactory getClientSocketFactory(BSslTlsEnum var1) throws Exception;
|
||||
|
||||
public String getClientSocketFactoryClass(BSslTlsEnum var1) throws Exception;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.security.crypto;
|
||||
|
||||
import javax.baja.io.net.IClientSocketFactory;
|
||||
import javax.baja.io.net.IServerSocketFactory;
|
||||
import javax.baja.security.crypto.ICryptoManager;
|
||||
|
||||
public interface ICryptoManagerEx
|
||||
extends ICryptoManager {
|
||||
public IServerSocketFactory getServerSocketFactory(String var1, boolean var2, String var3) throws Exception;
|
||||
|
||||
public IClientSocketFactory getClientSocketFactory(String var1) throws Exception;
|
||||
|
||||
public String getClientSocketFactoryClass(String var1) throws Exception;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.security.crypto;
|
||||
|
||||
import java.security.Key;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.Date;
|
||||
import java.util.Enumeration;
|
||||
|
||||
public interface IKeyStore {
|
||||
public Enumeration aliases() throws Exception;
|
||||
|
||||
public boolean containsAlias(String var1) throws Exception;
|
||||
|
||||
public void deleteEntry(String var1) throws Exception;
|
||||
|
||||
public X509Certificate getCertificate(String var1) throws Exception;
|
||||
|
||||
public String getCertificateAlias(X509Certificate var1) throws Exception;
|
||||
|
||||
public X509Certificate[] getCertificateChain(String var1) throws Exception;
|
||||
|
||||
public Date getCreationDate(String var1) throws Exception;
|
||||
|
||||
public Key getKey(String var1, char[] var2) throws Exception;
|
||||
|
||||
public boolean isCertificateEntry(String var1) throws Exception;
|
||||
|
||||
public boolean isKeyEntry(String var1) throws Exception;
|
||||
|
||||
public void setCertificateEntry(String var1, X509Certificate var2) throws Exception;
|
||||
|
||||
public void setKeyEntry(String var1, byte[] var2, X509Certificate[] var3) throws Exception;
|
||||
|
||||
public void setKeyEntry(String var1, Key var2, char[] var3, X509Certificate[] var4) throws Exception;
|
||||
|
||||
public int size() throws Exception;
|
||||
|
||||
public void save() throws Exception;
|
||||
|
||||
public Enumeration getCertificates() throws Exception;
|
||||
|
||||
public String findCertificate(X509Certificate var1) throws Exception;
|
||||
|
||||
public void deleteEntries(String[] var1) throws Exception;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.security.crypto.se;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.Socket;
|
||||
import java.net.UnknownHostException;
|
||||
import javax.baja.security.crypto.BTlsEnum;
|
||||
import javax.baja.security.crypto.CertManagerFactory;
|
||||
import javax.net.SocketFactory;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BajaSSLSocketFactory
|
||||
extends SSLSocketFactory {
|
||||
private SSLSocketFactory factory;
|
||||
|
||||
public static SocketFactory getDefault() {
|
||||
try {
|
||||
return new BajaSSLSocketFactory();
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
return SSLSocketFactory.getDefault();
|
||||
}
|
||||
}
|
||||
|
||||
public Socket createSocket(Socket socket, String string, int n, boolean bl) throws IOException {
|
||||
return this.factory.createSocket(socket, string, n, bl);
|
||||
}
|
||||
|
||||
public Socket createSocket(String string, int n) throws IOException, UnknownHostException {
|
||||
return this.factory.createSocket(string, n);
|
||||
}
|
||||
|
||||
public Socket createSocket(InetAddress inetAddress, int n) throws IOException {
|
||||
return this.factory.createSocket(inetAddress, n);
|
||||
}
|
||||
|
||||
public Socket createSocket(String string, int n, InetAddress inetAddress, int n2) throws IOException, UnknownHostException {
|
||||
return this.factory.createSocket(string, n, inetAddress, n2);
|
||||
}
|
||||
|
||||
public Socket createSocket(InetAddress inetAddress, int n, InetAddress inetAddress2, int n2) throws IOException {
|
||||
return this.factory.createSocket(inetAddress, n, inetAddress2, n2);
|
||||
}
|
||||
|
||||
public String[] getDefaultCipherSuites() {
|
||||
return this.factory.getDefaultCipherSuites();
|
||||
}
|
||||
|
||||
public String[] getSupportedCipherSuites() {
|
||||
return this.factory.getSupportedCipherSuites();
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return this.factory.hashCode();
|
||||
}
|
||||
|
||||
public boolean equals(Object object) {
|
||||
return this.factory.equals(object);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.factory.toString();
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.factory = null;
|
||||
}
|
||||
|
||||
public BajaSSLSocketFactory() throws Exception {
|
||||
this.this();
|
||||
this.factory = (SSLSocketFactory)((Object)CertManagerFactory.getInstanceEx().getClientSocketFactory(BTlsEnum.DEFAULT.getTag()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user