link start!
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user