正在查看: bbinstant v6.24.0 应用的 e.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: bbinstant v6.24.0 应用的 e.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.paytm.pgsdk;
import android.content.Context;
import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.security.KeyStore;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.Enumeration;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
public class e extends SSLSocketFactory {
private static final String PKCS12 = "pkcs12";
private static final String RAW = "raw";
private static final String TLS = "TLS";
private static final String X509 = "X509";
private volatile SSLContext mSSLContext;
class a implements X509TrustManager {
a() {
}
@Override
public void checkClientTrusted(X509Certificate[] x509CertificateArr, String str) throws CertificateException {
}
@Override
public void checkServerTrusted(X509Certificate[] x509CertificateArr, String str) throws CertificateException {
}
@Override
public X509Certificate[] getAcceptedIssuers() {
return null;
}
}
protected e(Context context, com.paytm.pgsdk.a aVar) {
a aVar2 = new a();
if (aVar != null) {
try {
if (aVar.mFileName != null) {
PaytmUtility.debugLog("Reading the certificate " + aVar.mFileName + ".p12");
KeyStore keyStore = KeyStore.getInstance(PKCS12);
keyStore.load(context.getResources().openRawResource(context.getResources().getIdentifier(aVar.mFileName, RAW, context.getPackageName())), aVar.mPassword.toCharArray());
Enumeration<String> aliases = keyStore.aliases();
while (aliases.hasMoreElements()) {
PaytmUtility.debugLog(keyStore.getCertificate(aliases.nextElement().toString()).toString());
}
KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(X509);
keyManagerFactory.init(keyStore, aVar.mPassword.toCharArray());
this.mSSLContext = SSLContext.getInstance(TLS);
this.mSSLContext.init(keyManagerFactory.getKeyManagers(), new TrustManager[]{aVar2}, null);
PaytmUtility.debugLog("Client certificate attached.");
return;
}
} catch (Exception e2) {
PaytmUtility.debugLog("Exception while attaching Client certificate.");
PaytmUtility.printStackTrace(e2);
try {
PaytmUtility.debugLog("so, setting only the trust manager");
this.mSSLContext = SSLContext.getInstance(TLS);
this.mSSLContext.init(null, new TrustManager[]{aVar2}, null);
PaytmUtility.debugLog("set trust manager");
return;
} catch (Exception e3) {
PaytmUtility.debugLog("Exception while setting the trust manager");
PaytmUtility.printStackTrace(e3);
return;
}
}
}
PaytmUtility.debugLog("Client certificate is not found");
PaytmUtility.debugLog("so, setting only the trust manager");
this.mSSLContext = SSLContext.getInstance(TLS);
this.mSSLContext.init(null, new TrustManager[]{aVar2}, null);
PaytmUtility.debugLog("set trust manager");
}
@Override
public synchronized Socket createSocket(Socket socket, String str, int i2, boolean z) throws IOException {
if (this.mSSLContext != null) {
return this.mSSLContext.getSocketFactory().createSocket(socket, str, i2, z);
}
return SSLSocketFactory.getDefault().createSocket(str, i2);
}
@Override
public synchronized String[] getDefaultCipherSuites() {
return null;
}
@Override
public synchronized String[] getSupportedCipherSuites() {
return null;
}
@Override
public synchronized Socket createSocket(String str, int i2) throws IOException, UnknownHostException {
if (this.mSSLContext != null) {
return this.mSSLContext.getSocketFactory().createSocket(str, i2);
}
return SSLSocketFactory.getDefault().createSocket(str, i2);
}
@Override
public synchronized Socket createSocket(InetAddress inetAddress, int i2) throws IOException {
if (this.mSSLContext != null) {
return this.mSSLContext.getSocketFactory().createSocket(inetAddress, i2);
}
return SSLSocketFactory.getDefault().createSocket(inetAddress, i2);
}
@Override
public synchronized Socket createSocket(String str, int i2, InetAddress inetAddress, int i3) throws IOException, UnknownHostException {
if (this.mSSLContext != null) {
return this.mSSLContext.getSocketFactory().createSocket(str, i2, inetAddress, i3);
}
return SSLSocketFactory.getDefault().createSocket(str, i2);
}
@Override
public synchronized Socket createSocket(InetAddress inetAddress, int i2, InetAddress inetAddress2, int i3) throws IOException {
if (this.mSSLContext != null) {
return this.mSSLContext.getSocketFactory().createSocket(inetAddress, i2, inetAddress2, i3);
}
return SSLSocketFactory.getDefault().createSocket(inetAddress, i2, inetAddress2, i3);
}
}