导航菜单

页面标题

页面副标题

MT Manager v2.13.3 - C11822.java 源代码

正在查看: MT Manager v2.13.3 应用的 C11822.java JAVA 源代码文件

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


package l;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.Socket;
import java.security.GeneralSecurityException;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLException;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.TrustManager;
import org.apache.http.conn.ssl.SSLSocketFactory;

public class C11822 extends C0899 {

    public static final String[] f35774 = {"C", "E", "S", "P"};

    public Socket f35775;

    public final boolean f35778;

    public SSLContext f35779;

    public String f35780 = SSLSocketFactory.TLS;

    public boolean f35782 = true;

    public boolean f35776 = true;

    public TrustManager f35781 = C5309.m12839();

    public final String f35777 = SSLSocketFactory.TLS;

    public C11822(boolean z) {
        this.f35778 = z;
    }

    @Override
    public final void mo2922() {
        boolean z = this.f35778;
        if (z) {
            m7259();
            m25819();
        }
        super.mo2922();
        if (z) {
            return;
        }
        int mo11038 = mo11038("AUTH", this.f35780);
        if (334 == mo11038 || 234 == mo11038) {
            m25819();
            return;
        }
        throw new SSLException(m13627());
    }

    private void m25817() {
        if (this.f35779 == null) {
            String str = this.f35777;
            TrustManager trustManager = this.f35781;
            TrustManager[] trustManagerArr = trustManager == null ? null : new TrustManager[]{trustManager};
            try {
                SSLContext sSLContext = SSLContext.getInstance(str);
                sSLContext.init(null, trustManagerArr, null);
                this.f35779 = sSLContext;
            } catch (GeneralSecurityException e) {
                IOException iOException = new IOException("Could not initialize SSL context");
                iOException.initCause(e);
                throw iOException;
            }
        }
    }

    public final void m25819() {
        this.f35775 = this.f9179;
        m25817();
        Socket socket = this.f9179;
        SSLSocket sSLSocket = socket != null ? (SSLSocket) this.f35779.getSocketFactory().createSocket(socket, this.f9176, socket.getPort(), false) : null;
        sSLSocket.setEnableSessionCreation(this.f35782);
        sSLSocket.setUseClientMode(this.f35776);
        if (!this.f35776) {
            sSLSocket.setNeedClientAuth(false);
            sSLSocket.setWantClientAuth(false);
        }
        sSLSocket.startHandshake();
        this.f9179 = sSLSocket;
        this.f19820 = new BufferedReader(new InputStreamReader(sSLSocket.getInputStream(), this.f19821));
        this.f19814 = new BufferedWriter(new OutputStreamWriter(sSLSocket.getOutputStream(), this.f19821));
    }

    public final void m25820() {
        if (200 != mo11038("PBSZ", String.valueOf(0L))) {
            throw new SSLException(m13627());
        }
    }

    public final void m25818() {
        String[] strArr = f35774;
        boolean z = false;
        int i = 0;
        while (true) {
            if (i >= 4) {
                break;
            }
            if (strArr[i].equals("P")) {
                z = true;
                break;
            }
            i++;
        }
        if (!z) {
            throw new IllegalArgumentException();
        }
        if (200 != mo11038("PROT", "P")) {
            throw new SSLException(m13627());
        }
        if ("C".equals("P")) {
            m7254((C8909) null);
            m7253((C5997) null);
        } else {
            m7254(new C8909(this.f35779));
            m7253(new C5997(this.f35779));
            m25817();
        }
    }

    @Override
    public int mo11038(String str, String str2) {
        int mo11038 = super.mo11038(str, str2);
        if ("CCC".equals(str)) {
            if (200 == mo11038) {
                this.f9179.close();
                this.f9179 = this.f35775;
                this.f19820 = new BufferedReader(new InputStreamReader(this.f9179.getInputStream(), this.f19821));
                this.f19814 = new BufferedWriter(new OutputStreamWriter(this.f9179.getOutputStream(), this.f19821));
            } else {
                throw new SSLException(m13627());
            }
        }
        return mo11038;
    }

    @Override
    public final Socket mo2916(String str, String str2) {
        Socket mo2916 = super.mo2916(str, str2);
        if (mo2916 instanceof SSLSocket) {
            SSLSocket sSLSocket = (SSLSocket) mo2916;
            sSLSocket.setUseClientMode(this.f35776);
            sSLSocket.setEnableSessionCreation(this.f35782);
            if (!this.f35776) {
                sSLSocket.setNeedClientAuth(false);
                sSLSocket.setWantClientAuth(false);
            }
            sSLSocket.startHandshake();
        }
        return mo2916;
    }

    @Override
    public final void mo2931() {
        super.mo2931();
        Socket socket = this.f35775;
        if (socket != null) {
            socket.close();
        }
        m7254((C8909) null);
        m7253((C5997) null);
    }
}