MD5 校验值:12538e99b43ae4a3db9c6dfff4aad74d
k.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package ob; import io.grpc.internal.t0; 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; import pb.h; public class k { private static final Logger f19545b = Logger.getLogger(k.class.getName()); private static final pb.h f19546c = pb.h.e(); private static k f19547d = d(k.class.getClassLoader()); protected final pb.h f19548a; public static final class a extends k { private static final pb.g<Socket> f19549e; private static final pb.g<Socket> f19550f; private static final pb.g<Socket> f19551g; private static final pb.g<Socket> f19552h; private static final pb.g<Socket> f19553i; private static final pb.g<Socket> f19554j; private static final Method f19555k; private static final Method f19556l; private static final Method f19557m; private static final Method f19558n; private static final Method f19559o; private static final Method f19560p; private static final Constructor<?> f19561q; static { Method method; Method method2; Method method3; Method method4; Method method5; Method method6; Class<?> cls; Class<?> cls2 = Boolean.TYPE; Constructor<?> constructor = null; f19549e = new pb.g<>(null, "setUseSessionTickets", cls2); f19550f = new pb.g<>(null, "setHostname", String.class); f19551g = new pb.g<>(byte[].class, "getAlpnSelectedProtocol", new Class[0]); f19552h = new pb.g<>(null, "setAlpnProtocols", byte[].class); f19553i = new pb.g<>(byte[].class, "getNpnSelectedProtocol", new Class[0]); f19554j = new pb.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 e10) { e = e10; method4 = null; } } catch (ClassNotFoundException e11) { e = e11; method3 = null; method4 = method3; k.f19545b.log(Level.FINER, "Failed to find Android 10.0+ APIs", e); method5 = null; f19557m = method2; f19558n = method; f19559o = method3; f19555k = method4; f19556l = method5; method6 = SSLParameters.class.getMethod("setServerNames", List.class); try { constructor = Class.forName("javax.net.ssl.SNIHostName").getConstructor(String.class); } catch (ClassNotFoundException e12) { e = e12; k.f19545b.log(Level.FINER, "Failed to find Android 7.0+ APIs", e); f19560p = method6; f19561q = constructor; } catch (NoSuchMethodException e13) { e = e13; k.f19545b.log(Level.FINER, "Failed to find Android 7.0+ APIs", e); f19560p = method6; f19561q = constructor; } f19560p = method6; f19561q = constructor; } catch (NoSuchMethodException e14) { e = e14; method3 = null; method4 = method3; k.f19545b.log(Level.FINER, "Failed to find Android 10.0+ APIs", e); method5 = null; f19557m = method2; f19558n = method; f19559o = method3; f19555k = method4; f19556l = method5; method6 = SSLParameters.class.getMethod("setServerNames", List.class); constructor = Class.forName("javax.net.ssl.SNIHostName").getConstructor(String.class); f19560p = method6; f19561q = constructor; } try { method5 = cls.getMethod("setUseSessionTickets", SSLSocket.class, cls2); } catch (ClassNotFoundException e15) { e = e15; k.f19545b.log(Level.FINER, "Failed to find Android 10.0+ APIs", e); method5 = null; f19557m = method2; f19558n = method; f19559o = method3; f19555k = method4; f19556l = method5; method6 = SSLParameters.class.getMethod("setServerNames", List.class); constructor = Class.forName("javax.net.ssl.SNIHostName").getConstructor(String.class); f19560p = method6; f19561q = constructor; } catch (NoSuchMethodException e16) { e = e16; k.f19545b.log(Level.FINER, "Failed to find Android 10.0+ APIs", e); method5 = null; f19557m = method2; f19558n = method; f19559o = method3; f19555k = method4; f19556l = method5; method6 = SSLParameters.class.getMethod("setServerNames", List.class); constructor = Class.forName("javax.net.ssl.SNIHostName").getConstructor(String.class); f19560p = method6; f19561q = constructor; } } catch (ClassNotFoundException e17) { e = e17; method = null; method3 = null; } catch (NoSuchMethodException e18) { e = e18; method = null; method3 = null; } } catch (ClassNotFoundException e19) { e = e19; method = null; method2 = null; method3 = null; } catch (NoSuchMethodException e20) { e = e20; method = null; method2 = null; method3 = null; } f19557m = method2; f19558n = method; f19559o = method3; f19555k = method4; f19556l = method5; try { method6 = SSLParameters.class.getMethod("setServerNames", List.class); constructor = Class.forName("javax.net.ssl.SNIHostName").getConstructor(String.class); } catch (ClassNotFoundException | NoSuchMethodException e21) { e = e21; method6 = null; } f19560p = method6; f19561q = constructor; } a(pb.h hVar) { super(hVar); } @Override protected void c(SSLSocket sSLSocket, String str, List<pb.i> list) { Constructor<?> constructor; boolean z10; Method method; String[] i10 = k.i(list); SSLParameters sSLParameters = sSLSocket.getSSLParameters(); if (str != null) { try { try { if (k.g(str)) { Method method2 = f19555k; if (method2 == null || !((Boolean) method2.invoke(null, sSLSocket)).booleanValue()) { f19549e.e(sSLSocket, Boolean.TRUE); } else { f19556l.invoke(null, sSLSocket, Boolean.TRUE); } Method method3 = f19560p; if (method3 == null || (constructor = f19561q) == null) { f19550f.e(sSLSocket, str); } else { method3.invoke(sSLParameters, Collections.singletonList(constructor.newInstance(str))); } } } catch (InvocationTargetException e10) { throw new RuntimeException(e10); } } catch (IllegalAccessException e11) { throw new RuntimeException(e11); } catch (InstantiationException e12) { throw new RuntimeException(e12); } } Method method4 = f19559o; if (method4 != null) { try { method4.invoke(sSLSocket, new Object[0]); f19557m.invoke(sSLParameters, i10); z10 = true; } catch (InvocationTargetException e13) { if (!(e13.getTargetException() instanceof UnsupportedOperationException)) { throw e13; } k.f19545b.log(Level.FINER, "setApplicationProtocol unsupported, will try old methods"); } sSLSocket.setSSLParameters(sSLParameters); if (z10 || (method = f19558n) == null || !Arrays.equals(i10, (String[]) method.invoke(sSLSocket.getSSLParameters(), new Object[0]))) { Object[] objArr = {pb.h.b(list)}; if (this.f19548a.i() == h.EnumC0272h.ALPN_AND_NPN) { f19552h.f(sSLSocket, objArr); } if (this.f19548a.i() != h.EnumC0272h.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"); } f19554j.f(sSLSocket, objArr); return; } return; } z10 = false; sSLSocket.setSSLParameters(sSLParameters); if (z10) { } Object[] objArr2 = {pb.h.b(list)}; if (this.f19548a.i() == h.EnumC0272h.ALPN_AND_NPN) { } if (this.f19548a.i() != h.EnumC0272h.NONE) { } } @Override public String f(SSLSocket sSLSocket) { Method method = f19559o; if (method != null) { try { return (String) method.invoke(sSLSocket, new Object[0]); } catch (IllegalAccessException e10) { throw new RuntimeException(e10); } catch (InvocationTargetException e11) { if (!(e11.getTargetException() instanceof UnsupportedOperationException)) { throw new RuntimeException(e11); } k.f19545b.log(Level.FINER, "Socket unsupported for getApplicationProtocol, will try old methods"); } } if (this.f19548a.i() == h.EnumC0272h.ALPN_AND_NPN) { try { byte[] bArr = (byte[]) f19551g.f(sSLSocket, new Object[0]); if (bArr != null) { return new String(bArr, pb.l.f20052b); } } catch (Exception e12) { k.f19545b.log(Level.FINE, "Failed calling getAlpnSelectedProtocol()", (Throwable) e12); } } if (this.f19548a.i() == h.EnumC0272h.NONE) { return null; } try { byte[] bArr2 = (byte[]) f19553i.f(sSLSocket, new Object[0]); if (bArr2 != null) { return new String(bArr2, pb.l.f20052b); } return null; } catch (Exception e13) { k.f19545b.log(Level.FINE, "Failed calling getNpnSelectedProtocol()", (Throwable) e13); return null; } } @Override public String h(SSLSocket sSLSocket, String str, List<pb.i> list) { String f10 = f(sSLSocket); return f10 == null ? super.h(sSLSocket, str, list) : f10; } } k(pb.h hVar) { this.f19548a = (pb.h) n5.o.p(hVar, "platform"); } static k d(ClassLoader classLoader) { boolean z10; try { classLoader.loadClass("com.android.org.conscrypt.OpenSSLSocketImpl"); } catch (ClassNotFoundException e10) { f19545b.log(Level.FINE, "Unable to find Conscrypt. Skipping", (Throwable) e10); try { classLoader.loadClass("org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl"); } catch (ClassNotFoundException e11) { f19545b.log(Level.FINE, "Unable to find any OpenSSLSocketImpl. Skipping", (Throwable) e11); z10 = false; } } z10 = true; return z10 ? new a(f19546c) : new k(f19546c); } public static k e() { return f19547d; } static boolean g(String str) { if (str.contains("_")) { return false; } try { t0.c(str); return true; } catch (IllegalArgumentException unused) { return false; } } public static String[] i(List<pb.i> list) { ArrayList arrayList = new ArrayList(); Iterator<pb.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<pb.i> list) { this.f19548a.c(sSLSocket, str, list); } public String f(SSLSocket sSLSocket) { return this.f19548a.h(sSLSocket); } public String h(SSLSocket sSLSocket, String str, List<pb.i> list) { if (list != null) { c(sSLSocket, str, list); } try { sSLSocket.startHandshake(); String f10 = f(sSLSocket); if (f10 != null) { return f10; } throw new RuntimeException("TLS ALPN negotiation failed with protocols: " + list); } finally { this.f19548a.a(sSLSocket); } } }