MD5 校验值:4bc781c930851c75a6ce46bc3a7af00a
j.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package f.c.p1; import f.c.o1.r0; import f.c.p1.r.h; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.Socket; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import javax.net.ssl.SSLParameters; import javax.net.ssl.SSLSocket; public class j { private static final Logger b = Logger.getLogger(j.class.getName()); private static final f.c.p1.r.h c = f.c.p1.r.h.e(); private static j f1195d = d(j.class.getClassLoader()); protected final f.c.p1.r.h a; public static final class a extends j { private static final f.c.p1.r.g<Socket> f1196e; private static final f.c.p1.r.g<Socket> f1197f; private static final f.c.p1.r.g<Socket> f1198g; private static final f.c.p1.r.g<Socket> f1199h; private static final f.c.p1.r.g<Socket> i; private static final f.c.p1.r.g<Socket> j; private static final Method k; private static final Method l; private static final Method m; private static final Method n; private static final Method o; private static final Method p; private static final Constructor<?> q; static { Method method; Method method2; Method method3; Method method4; Method method5; Method method6; Class<?> cls; Class<?> cls2 = Boolean.TYPE; Constructor<?> constructor = null; f1196e = new f.c.p1.r.g<>(null, "setUseSessionTickets", cls2); f1197f = new f.c.p1.r.g<>(null, "setHostname", String.class); f1198g = new f.c.p1.r.g<>(byte[].class, "getAlpnSelectedProtocol", new Class[0]); f1199h = new f.c.p1.r.g<>(null, "setAlpnProtocols", byte[].class); i = new f.c.p1.r.g<>(byte[].class, "getNpnSelectedProtocol", new Class[0]); j = new f.c.p1.r.g<>(null, "setNpnProtocols", byte[].class); try { method2 = SSLParameters.class.getMethod("setApplicationProtocols", String[].class); try { method = SSLParameters.class.getMethod("getApplicationProtocols", new Class[0]); try { method3 = SSLSocket.class.getMethod("getApplicationProtocol", new Class[0]); try { cls = Class.forName("android.net.ssl.SSLSockets"); method4 = cls.getMethod("isSupportedSocket", SSLSocket.class); } catch (ClassNotFoundException | NoSuchMethodException e2) { e = e2; method4 = null; } } catch (ClassNotFoundException e3) { e = e3; method3 = null; method4 = method3; j.b.log(Level.FINER, "Failed to find Android 10.0+ APIs", e); method5 = null; m = method2; n = method; o = method3; k = method4; l = method5; method6 = SSLParameters.class.getMethod("setServerNames", List.class); try { constructor = Class.forName("javax.net.ssl.SNIHostName").getConstructor(String.class); } catch (ClassNotFoundException e4) { e = e4; j.b.log(Level.FINER, "Failed to find Android 7.0+ APIs", e); p = method6; q = constructor; } catch (NoSuchMethodException e5) { e = e5; j.b.log(Level.FINER, "Failed to find Android 7.0+ APIs", e); p = method6; q = constructor; } p = method6; q = constructor; } catch (NoSuchMethodException e6) { e = e6; method3 = null; method4 = method3; j.b.log(Level.FINER, "Failed to find Android 10.0+ APIs", e); method5 = null; m = method2; n = method; o = method3; k = method4; l = method5; method6 = SSLParameters.class.getMethod("setServerNames", List.class); constructor = Class.forName("javax.net.ssl.SNIHostName").getConstructor(String.class); p = method6; q = constructor; } try { method5 = cls.getMethod("setUseSessionTickets", SSLSocket.class, cls2); } catch (ClassNotFoundException e7) { e = e7; j.b.log(Level.FINER, "Failed to find Android 10.0+ APIs", e); method5 = null; m = method2; n = method; o = method3; k = method4; l = method5; method6 = SSLParameters.class.getMethod("setServerNames", List.class); constructor = Class.forName("javax.net.ssl.SNIHostName").getConstructor(String.class); p = method6; q = constructor; } catch (NoSuchMethodException e8) { e = e8; j.b.log(Level.FINER, "Failed to find Android 10.0+ APIs", e); method5 = null; m = method2; n = method; o = method3; k = method4; l = method5; method6 = SSLParameters.class.getMethod("setServerNames", List.class); constructor = Class.forName("javax.net.ssl.SNIHostName").getConstructor(String.class); p = method6; q = constructor; } } catch (ClassNotFoundException e9) { e = e9; method = null; method3 = null; } catch (NoSuchMethodException e10) { e = e10; method = null; method3 = null; } } catch (ClassNotFoundException e11) { e = e11; method = null; method2 = null; method3 = null; } catch (NoSuchMethodException e12) { e = e12; method = null; method2 = null; method3 = null; } m = method2; n = method; o = method3; k = method4; l = method5; try { method6 = SSLParameters.class.getMethod("setServerNames", List.class); constructor = Class.forName("javax.net.ssl.SNIHostName").getConstructor(String.class); } catch (ClassNotFoundException | NoSuchMethodException e13) { e = e13; method6 = null; } p = method6; q = constructor; } a(f.c.p1.r.h hVar) { super(hVar); } @Override protected void c(SSLSocket sSLSocket, String str, List<f.c.p1.r.i> list) { Constructor<?> constructor; boolean z; Method method; Boolean bool = Boolean.TRUE; String[] i2 = j.i(list); SSLParameters sSLParameters = sSLSocket.getSSLParameters(); if (str != null) { try { try { if (j.g(str)) { Method method2 = k; if (method2 == null || !((Boolean) method2.invoke(null, sSLSocket)).booleanValue()) { f1196e.e(sSLSocket, bool); } else { l.invoke(null, sSLSocket, bool); } Method method3 = p; if (method3 == null || (constructor = q) == null) { f1197f.e(sSLSocket, str); } else { method3.invoke(sSLParameters, Collections.singletonList(constructor.newInstance(str))); } } } catch (InvocationTargetException e2) { throw new RuntimeException(e2); } } catch (IllegalAccessException e3) { throw new RuntimeException(e3); } catch (InstantiationException e4) { throw new RuntimeException(e4); } } Method method4 = o; if (method4 != null) { try { method4.invoke(sSLSocket, new Object[0]); m.invoke(sSLParameters, i2); z = true; } catch (InvocationTargetException e5) { if (!(e5.getTargetException() instanceof UnsupportedOperationException)) { throw e5; } j.b.log(Level.FINER, "setApplicationProtocol unsupported, will try old methods"); } sSLSocket.setSSLParameters(sSLParameters); if (z || (method = n) == null || !Arrays.equals(i2, (String[]) method.invoke(sSLSocket.getSSLParameters(), new Object[0]))) { Object[] objArr = {f.c.p1.r.h.b(list)}; if (this.a.i() == h.EnumC0080h.ALPN_AND_NPN) { f1199h.f(sSLSocket, objArr); } if (this.a.i() != h.EnumC0080h.NONE) { throw new RuntimeException("We can not do TLS handshake on this Android version, please install the Google Play Services Dynamic Security Provider to use TLS"); } j.f(sSLSocket, objArr); return; } return; } z = false; sSLSocket.setSSLParameters(sSLParameters); if (z) { } Object[] objArr2 = {f.c.p1.r.h.b(list)}; if (this.a.i() == h.EnumC0080h.ALPN_AND_NPN) { } if (this.a.i() != h.EnumC0080h.NONE) { } } @Override public String f(SSLSocket sSLSocket) { Method method = o; if (method != null) { try { return (String) method.invoke(sSLSocket, new Object[0]); } catch (IllegalAccessException e2) { throw new RuntimeException(e2); } catch (InvocationTargetException e3) { if (!(e3.getTargetException() instanceof UnsupportedOperationException)) { throw new RuntimeException(e3); } j.b.log(Level.FINER, "Socket unsupported for getApplicationProtocol, will try old methods"); } } if (this.a.i() == h.EnumC0080h.ALPN_AND_NPN) { try { byte[] bArr = (byte[]) f1198g.f(sSLSocket, new Object[0]); if (bArr != null) { return new String(bArr, f.c.p1.r.l.b); } } catch (Exception e4) { j.b.log(Level.FINE, "Failed calling getAlpnSelectedProtocol()", (Throwable) e4); } } if (this.a.i() == h.EnumC0080h.NONE) { return null; } try { byte[] bArr2 = (byte[]) i.f(sSLSocket, new Object[0]); if (bArr2 != null) { return new String(bArr2, f.c.p1.r.l.b); } return null; } catch (Exception e5) { j.b.log(Level.FINE, "Failed calling getNpnSelectedProtocol()", (Throwable) e5); return null; } } @Override public String h(SSLSocket sSLSocket, String str, List<f.c.p1.r.i> list) { String f2 = f(sSLSocket); return f2 == null ? super.h(sSLSocket, str, list) : f2; } } j(f.c.p1.r.h hVar) { e.a.c.a.k.o(hVar, "platform"); this.a = hVar; } static j d(ClassLoader classLoader) { boolean z; try { classLoader.loadClass("com.android.org.conscrypt.OpenSSLSocketImpl"); } catch (ClassNotFoundException e2) { b.log(Level.FINE, "Unable to find Conscrypt. Skipping", (Throwable) e2); try { classLoader.loadClass("org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl"); } catch (ClassNotFoundException e3) { b.log(Level.FINE, "Unable to find any OpenSSLSocketImpl. Skipping", (Throwable) e3); z = false; } } z = true; return z ? new a(c) : new j(c); } public static j e() { return f1195d; } static boolean g(String str) { if (str.contains("_")) { return false; } try { r0.c(str); return true; } catch (IllegalArgumentException unused) { return false; } } public static String[] i(List<f.c.p1.r.i> list) { ArrayList arrayList = new ArrayList(); Iterator<f.c.p1.r.i> it = list.iterator(); while (it.hasNext()) { arrayList.add(it.next().toString()); } return (String[]) arrayList.toArray(new String[0]); } protected void c(SSLSocket sSLSocket, String str, List<f.c.p1.r.i> list) { this.a.c(sSLSocket, str, list); } public String f(SSLSocket sSLSocket) { return this.a.h(sSLSocket); } public String h(SSLSocket sSLSocket, String str, List<f.c.p1.r.i> list) { if (list != null) { c(sSLSocket, str, list); } try { sSLSocket.startHandshake(); String f2 = f(sSLSocket); if (f2 != null) { return f2; } throw new RuntimeException("TLS ALPN negotiation failed with protocols: " + list); } finally { this.a.a(sSLSocket); } } }