APK反编译源代码展示 - 南明离火平台提供

应用版本信息
应用名称:GENIEX Service
版本号:2.2.062
包名称:com.geniex.vsimhelper

MD5 校验值:13dc6b335e0f136597784161f314cd8e

反编译源代码说明

e.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。


package z0;

import a1.c;
import java.nio.ByteBuffer;
import java.security.GeneralSecurityException;
import java.security.KeyStore;
import java.security.NoSuchAlgorithmException;
import java.security.cert.X509Certificate;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLEngineResult;
import javax.net.ssl.SSLException;
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.X509TrustManager;
import org.apache.http.conn.ssl.StrictHostnameVerifier;

public final class e implements q, u, z0.d {

    public static SSLContext f4056u;

    public q f4057a;

    public s f4058b;

    public boolean f4059c;

    public SSLEngine f4060d;

    public boolean f4061e;

    public String f4062f;

    public boolean f4063g;

    public HostnameVerifier f4064h;

    public d f4065i;

    public X509Certificate[] f4066j;

    public a1.e f4067k;

    public a1.c f4068l;

    public TrustManager[] f4069m;

    public boolean f4070n;

    public boolean f4071o;

    public Exception f4072p;

    public final t f4073q = new t();

    public final b f4074r;

    public t f4075s;

    public a1.a f4076t;

    public class a implements X509TrustManager {
        @Override
        public final void checkClientTrusted(X509Certificate[] x509CertificateArr, String str) {
        }

        @Override
        public final void checkServerTrusted(X509Certificate[] x509CertificateArr, String str) {
            for (X509Certificate x509Certificate : x509CertificateArr) {
                if (x509Certificate != null && x509Certificate.getCriticalExtensionOIDs() != null) {
                    x509Certificate.getCriticalExtensionOIDs().remove("2.5.29.15");
                }
            }
        }

        @Override
        public final X509Certificate[] getAcceptedIssuers() {
            return new X509Certificate[0];
        }
    }

    public class b implements a1.c {

        public final k1.a f4077a;

        public final t f4078b;

        public b() {
            k1.a aVar = new k1.a();
            aVar.f2846c = 8192;
            this.f4077a = aVar;
            this.f4078b = new t();
        }

        @Override
        public final void onDataAvailable(u uVar, t tVar) {
            a1.a aVar;
            e eVar = e.this;
            if (eVar.f4059c) {
                return;
            }
            try {
                try {
                    eVar.f4059c = true;
                    tVar.e(this.f4078b);
                    if (this.f4078b.k()) {
                        this.f4078b.a(this.f4078b.h());
                    }
                    ByteBuffer byteBuffer = t.f4146j;
                    while (true) {
                        if (byteBuffer.remaining() == 0 && this.f4078b.r() > 0) {
                            byteBuffer = this.f4078b.q();
                        }
                        int remaining = byteBuffer.remaining();
                        int i4 = e.this.f4073q.f4149c;
                        k1.a aVar2 = this.f4077a;
                        ByteBuffer l4 = t.l(Math.min(Math.max(aVar2.f2845b, aVar2.f2846c), aVar2.f2844a));
                        SSLEngineResult unwrap = e.this.f4060d.unwrap(byteBuffer, l4);
                        t tVar2 = e.this.f4073q;
                        l4.flip();
                        if (l4.hasRemaining()) {
                            tVar2.a(l4);
                        } else {
                            t.o(l4);
                        }
                        this.f4077a.f2845b = (e.this.f4073q.f4149c - i4) * 2;
                        if (unwrap.getStatus() != SSLEngineResult.Status.BUFFER_OVERFLOW) {
                            if (unwrap.getStatus() == SSLEngineResult.Status.BUFFER_UNDERFLOW) {
                                this.f4078b.c(byteBuffer);
                                if (this.f4078b.r() <= 1) {
                                    break;
                                }
                                this.f4078b.c(this.f4078b.h());
                                byteBuffer = t.f4146j;
                            }
                            e.this.i(unwrap.getHandshakeStatus());
                            if (byteBuffer.remaining() != remaining && i4 == e.this.f4073q.f4149c) {
                                this.f4078b.c(byteBuffer);
                                break;
                            }
                        } else {
                            this.f4077a.f2846c *= 2;
                        }
                        remaining = -1;
                        e.this.i(unwrap.getHandshakeStatus());
                        if (byteBuffer.remaining() != remaining) {
                        }
                    }
                    e eVar2 = e.this;
                    c0.e0.f(eVar2, eVar2.f4073q);
                    if (eVar2.f4071o && !eVar2.f4073q.k() && (aVar = eVar2.f4076t) != null) {
                        aVar.onCompleted(eVar2.f4072p);
                    }
                } catch (SSLException e4) {
                    e4.printStackTrace();
                    e.this.j(e4);
                }
            } finally {
                e.this.f4059c = false;
            }
        }
    }

    public class c implements Runnable {
        public c() {
        }

        @Override
        public final void run() {
            a1.e eVar = e.this.f4067k;
            if (eVar != null) {
                eVar.onWriteable();
            }
        }
    }

    public interface d {
        void a(Exception exc, z0.d dVar);
    }

    static {
        try {
            f4056u = SSLContext.getInstance("Default");
        } catch (Exception e4) {
            try {
                SSLContext sSLContext = SSLContext.getInstance("TLS");
                f4056u = sSLContext;
                sSLContext.init(null, new TrustManager[]{new a()}, null);
            } catch (Exception e5) {
                e4.printStackTrace();
                e5.printStackTrace();
            }
        }
    }

    public e(q qVar, String str, SSLEngine sSLEngine) {
        b bVar = new b();
        this.f4074r = bVar;
        this.f4075s = new t();
        this.f4057a = qVar;
        this.f4064h = null;
        this.f4070n = true;
        this.f4069m = null;
        this.f4060d = sSLEngine;
        this.f4062f = str;
        sSLEngine.setUseClientMode(true);
        s sVar = new s(qVar);
        this.f4058b = sVar;
        sVar.f4133d = new g(this);
        this.f4057a.b(new h(this));
        this.f4057a.f(bVar);
    }

    @Override
    public final m a() {
        return this.f4057a.a();
    }

    @Override
    public final void b(a1.a aVar) {
        this.f4076t = aVar;
    }

    @Override
    public final String c() {
        return null;
    }

    @Override
    public final void close() {
        this.f4057a.close();
    }

    @Override
    public final void d(a1.a aVar) {
        this.f4057a.d(aVar);
    }

    @Override
    public final void e(t tVar) {
        ByteBuffer byteBuffer;
        SSLException e4;
        SSLEngineResult sSLEngineResult;
        if (!this.f4063g && this.f4058b.f4132c.f4149c <= 0) {
            this.f4063g = true;
            int i4 = (tVar.f4149c * 3) / 2;
            if (i4 == 0) {
                i4 = 8192;
            }
            ByteBuffer l4 = t.l(i4);
            SSLEngineResult sSLEngineResult2 = null;
            do {
                if (!this.f4061e || tVar.f4149c != 0) {
                    int i5 = tVar.f4149c;
                    try {
                        ByteBuffer[] byteBufferArr = (ByteBuffer[]) tVar.f4147a.toArray(new ByteBuffer[tVar.f4147a.size()]);
                        tVar.f4147a.clear();
                        tVar.f4149c = 0;
                        sSLEngineResult2 = this.f4060d.wrap(byteBufferArr, l4);
                        tVar.b(byteBufferArr);
                        l4.flip();
                        this.f4075s.a(l4);
                        t tVar2 = this.f4075s;
                        if (tVar2.f4149c > 0) {
                            this.f4058b.b(tVar2, false);
                        }
                        int capacity = l4.capacity();
                        try {
                            if (sSLEngineResult2.getStatus() == SSLEngineResult.Status.BUFFER_OVERFLOW) {
                                l4 = t.l(capacity * 2);
                                i5 = -1;
                            } else {
                                int i6 = (tVar.f4149c * 3) / 2;
                                if (i6 == 0) {
                                    i6 = 8192;
                                }
                                l4 = t.l(i6);
                                i(sSLEngineResult2.getHandshakeStatus());
                            }
                        } catch (SSLException e5) {
                            e4 = e5;
                            sSLEngineResult = sSLEngineResult2;
                            byteBuffer = null;
                            j(e4);
                            l4 = byteBuffer;
                            sSLEngineResult2 = sSLEngineResult;
                            if (i5 != tVar.f4149c) {
                            }
                        }
                    } catch (SSLException e6) {
                        SSLEngineResult sSLEngineResult3 = sSLEngineResult2;
                        byteBuffer = l4;
                        e4 = e6;
                        sSLEngineResult = sSLEngineResult3;
                    }
                    if (i5 != tVar.f4149c && (sSLEngineResult2 == null || sSLEngineResult2.getHandshakeStatus() != SSLEngineResult.HandshakeStatus.NEED_WRAP)) {
                        break;
                    }
                } else {
                    break;
                }
            } while (this.f4058b.f4132c.f4149c == 0);
            this.f4063g = false;
            t.o(l4);
        }
    }

    @Override
    public final void end() {
        this.f4057a.end();
    }

    @Override
    public final void f(a1.c cVar) {
        this.f4068l = cVar;
    }

    @Override
    public final void g(a1.e eVar) {
        this.f4067k = eVar;
    }

    @Override
    public final a1.c h() {
        return this.f4068l;
    }

    public final void i(SSLEngineResult.HandshakeStatus handshakeStatus) {
        a1.a aVar;
        if (handshakeStatus == SSLEngineResult.HandshakeStatus.NEED_TASK) {
            this.f4060d.getDelegatedTask().run();
        }
        if (handshakeStatus == SSLEngineResult.HandshakeStatus.NEED_WRAP) {
            e(this.f4075s);
        }
        if (handshakeStatus == SSLEngineResult.HandshakeStatus.NEED_UNWRAP) {
            this.f4074r.onDataAvailable(this, new t());
        }
        try {
            if (this.f4061e) {
                return;
            }
            if (this.f4060d.getHandshakeStatus() == SSLEngineResult.HandshakeStatus.NOT_HANDSHAKING || this.f4060d.getHandshakeStatus() == SSLEngineResult.HandshakeStatus.FINISHED) {
                if (this.f4070n) {
                    TrustManager[] trustManagerArr = this.f4069m;
                    if (trustManagerArr == null) {
                        TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
                        trustManagerFactory.init((KeyStore) null);
                        trustManagerArr = trustManagerFactory.getTrustManagers();
                    }
                    boolean z3 = false;
                    Exception e4 = null;
                    int i4 = 0;
                    while (true) {
                        if (i4 >= trustManagerArr.length) {
                            break;
                        }
                        try {
                            X509TrustManager x509TrustManager = (X509TrustManager) trustManagerArr[i4];
                            X509Certificate[] x509CertificateArr = (X509Certificate[]) this.f4060d.getSession().getPeerCertificates();
                            this.f4066j = x509CertificateArr;
                            x509TrustManager.checkServerTrusted(x509CertificateArr, "SSL");
                            String str = this.f4062f;
                            if (str != null) {
                                HostnameVerifier hostnameVerifier = this.f4064h;
                                if (hostnameVerifier == null) {
                                    new StrictHostnameVerifier().verify(this.f4062f, StrictHostnameVerifier.getCNs(this.f4066j[0]), StrictHostnameVerifier.getDNSSubjectAlts(this.f4066j[0]));
                                } else if (!hostnameVerifier.verify(str, this.f4060d.getSession())) {
                                    throw new SSLException("hostname <" + this.f4062f + "> has been denied");
                                }
                            }
                            z3 = true;
                        } catch (GeneralSecurityException | SSLException | Exception e5) {
                            e4 = e5;
                            i4++;
                        }
                    }
                    this.f4061e = true;
                    if (!z3) {
                        z0.c cVar = new z0.c(e4);
                        j(cVar);
                        throw cVar;
                    }
                } else {
                    this.f4061e = true;
                }
                this.f4065i.a(null, this);
                this.f4065i = null;
                this.f4057a.d(null);
                a().d(new c());
                c0.e0.f(this, this.f4073q);
                if (!this.f4071o || this.f4073q.k() || (aVar = this.f4076t) == null) {
                    return;
                }
                aVar.onCompleted(this.f4072p);
            }
        } catch (NoSuchAlgorithmException e6) {
            throw new RuntimeException(e6);
        } catch (GeneralSecurityException e7) {
            j(e7);
        } catch (z0.c e8) {
            j(e8);
        }
    }

    @Override
    public final boolean isOpen() {
        return this.f4057a.isOpen();
    }

    @Override
    public final boolean isPaused() {
        return this.f4057a.isPaused();
    }

    public final void j(Exception exc) {
        d dVar = this.f4065i;
        if (dVar == null) {
            a1.a aVar = this.f4076t;
            if (aVar != null) {
                aVar.onCompleted(exc);
                return;
            }
            return;
        }
        this.f4065i = null;
        this.f4057a.f(new c.a());
        this.f4057a.end();
        this.f4057a.d(null);
        this.f4057a.close();
        dVar.a(exc, null);
    }
}