导航菜单

页面标题

页面副标题

Chaupal v3.2 - f.java 源代码

正在查看: Chaupal v3.2 应用的 f.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package io.grpc.okhttp;

import io.grpc.internal.GrpcUtil;
import io.grpc.okhttp.internal.Platform;
import io.grpc.okhttp.internal.Protocol;
import java.io.IOException;
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.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;

class f {
    private static final Logger b = Logger.getLogger(f.class.getName());
    private static final Platform c = Platform.e();
    private static f d = d(f.class.getClassLoader());
    protected final Platform a;

    static final class a extends f {
        private static final io.grpc.okhttp.internal.d<Socket> e;
        private static final io.grpc.okhttp.internal.d<Socket> f;
        private static final io.grpc.okhttp.internal.d<Socket> g;
        private static final io.grpc.okhttp.internal.d<Socket> h;
        private static final io.grpc.okhttp.internal.d<Socket> i;
        private static final io.grpc.okhttp.internal.d<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;
            e = new io.grpc.okhttp.internal.d<>(null, "setUseSessionTickets", cls2);
            f = new io.grpc.okhttp.internal.d<>(null, "setHostname", String.class);
            g = new io.grpc.okhttp.internal.d<>(byte[].class, "getAlpnSelectedProtocol", new Class[0]);
            h = new io.grpc.okhttp.internal.d<>(null, "setAlpnProtocols", byte[].class);
            i = new io.grpc.okhttp.internal.d<>(byte[].class, "getNpnSelectedProtocol", new Class[0]);
            j = new io.grpc.okhttp.internal.d<>(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 e2) {
                            e = e2;
                            method4 = null;
                        } catch (NoSuchMethodException e3) {
                            e = e3;
                            method4 = null;
                        }
                    } catch (ClassNotFoundException e4) {
                        e = e4;
                        method3 = null;
                        method4 = method3;
                        f.b.log(Level.FINER, "Failed to find Android 10.0+ APIs", (Throwable) 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 e5) {
                        e = e5;
                        method3 = null;
                        method4 = method3;
                        f.b.log(Level.FINER, "Failed to find Android 10.0+ APIs", (Throwable) 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 e6) {
                        e = e6;
                        f.b.log(Level.FINER, "Failed to find Android 10.0+ APIs", (Throwable) 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 e7) {
                        e = e7;
                        f.b.log(Level.FINER, "Failed to find Android 10.0+ APIs", (Throwable) 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 e8) {
                    e = e8;
                    method = null;
                    method3 = null;
                } catch (NoSuchMethodException e9) {
                    e = e9;
                    method = null;
                    method3 = null;
                }
            } catch (ClassNotFoundException e10) {
                e = e10;
                method = null;
                method2 = null;
                method3 = null;
            } catch (NoSuchMethodException e11) {
                e = e11;
                method = null;
                method2 = null;
                method3 = null;
            }
            m = method2;
            n = method;
            o = method3;
            k = method4;
            l = method5;
            try {
                method6 = SSLParameters.class.getMethod("setServerNames", List.class);
            } catch (ClassNotFoundException e12) {
                e = e12;
                method6 = null;
            } catch (NoSuchMethodException e13) {
                e = e13;
                method6 = null;
            }
            try {
                constructor = Class.forName("javax.net.ssl.SNIHostName").getConstructor(String.class);
            } catch (ClassNotFoundException e14) {
                e = e14;
                f.b.log(Level.FINER, "Failed to find Android 7.0+ APIs", (Throwable) e);
                p = method6;
                q = constructor;
            } catch (NoSuchMethodException e15) {
                e = e15;
                f.b.log(Level.FINER, "Failed to find Android 7.0+ APIs", (Throwable) e);
                p = method6;
                q = constructor;
            }
            p = method6;
            q = constructor;
        }

        a(Platform platform) {
            super(platform);
        }

        @Override
        protected void c(javax.net.ssl.SSLSocket r9, java.lang.String r10, java.util.List<io.grpc.okhttp.internal.Protocol> r11) {
            throw new UnsupportedOperationException("Method not decompiled: io.grpc.okhttp.f.a.c(javax.net.ssl.SSLSocket, java.lang.String, java.util.List):void");
        }

        @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);
                    }
                    f.b.log(Level.FINER, "Socket unsupported for getApplicationProtocol, will try old methods");
                }
            }
            if (this.a.i() == Platform.TlsExtensionType.ALPN_AND_NPN) {
                try {
                    byte[] bArr = (byte[]) g.f(sSLSocket, new Object[0]);
                    if (bArr != null) {
                        return new String(bArr, io.grpc.okhttp.internal.e.c);
                    }
                } catch (Exception e4) {
                    f.b.log(Level.FINE, "Failed calling getAlpnSelectedProtocol()", (Throwable) e4);
                }
            }
            if (this.a.i() == Platform.TlsExtensionType.NONE) {
                return null;
            }
            try {
                byte[] bArr2 = (byte[]) i.f(sSLSocket, new Object[0]);
                if (bArr2 != null) {
                    return new String(bArr2, io.grpc.okhttp.internal.e.c);
                }
                return null;
            } catch (Exception e5) {
                f.b.log(Level.FINE, "Failed calling getNpnSelectedProtocol()", (Throwable) e5);
                return null;
            }
        }

        @Override
        public String h(SSLSocket sSLSocket, String str, List<Protocol> list) throws IOException {
            String f3 = f(sSLSocket);
            return f3 == null ? super.h(sSLSocket, str, list) : f3;
        }
    }

    f(Platform platform) {
        this.a = (Platform) com.google.common.base.l.p(platform, "platform");
    }

    static f d(ClassLoader classLoader) {
        boolean z;
        try {
            classLoader.loadClass("com.android.org.conscrypt.OpenSSLSocketImpl");
        } catch (ClassNotFoundException e) {
            b.log(Level.FINE, "Unable to find Conscrypt. Skipping", (Throwable) e);
            try {
                classLoader.loadClass("org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl");
            } catch (ClassNotFoundException e2) {
                b.log(Level.FINE, "Unable to find any OpenSSLSocketImpl. Skipping", (Throwable) e2);
                z = false;
            }
        }
        z = true;
        return z ? new a(c) : new f(c);
    }

    public static f e() {
        return d;
    }

    static boolean g(String str) {
        if (str.contains("_")) {
            return false;
        }
        try {
            GrpcUtil.c(str);
            return true;
        } catch (IllegalArgumentException unused) {
            return false;
        }
    }

    public static String[] i(List<Protocol> list) {
        ArrayList arrayList = new ArrayList();
        Iterator<Protocol> 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<Protocol> 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<Protocol> list) throws IOException {
        if (list != null) {
            c(sSLSocket, str, list);
        }
        try {
            sSLSocket.startHandshake();
            String f = f(sSLSocket);
            if (f != null) {
                return f;
            }
            throw new RuntimeException("TLS ALPN negotiation failed with protocols: " + list);
        } finally {
            this.a.a(sSLSocket);
        }
    }
}