MT Manager v2.15.3版本的 MD5 值为:27f0d62ac7123fbbaefff319fdab9f13

以下内容为反编译后的 C13464.java 源代码,内容仅作参考


package l;

import com.google.android.material.motion.MotionUtils;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.Iterator;
import org.bouncycastle.i18n.LocalizedMessage;

public final class C13464 implements InterfaceC10096 {

    public static final ArrayList f40244;

    public static final C6074 f40245 = C6074.m15114(C13464.class);

    public static final int f40246 = 0;

    public C5885 f40248;

    public final SecureRandom f40254;

    public final C13606 f40255;

    public C14821 f40256;

    public byte[] f40257;

    public C2190 f40258;

    public C10938 f40259;

    public int f40251 = 0;

    public final Object f40247 = new Object();

    public C8687 f40252 = null;

    public boolean f40253 = false;

    public boolean f40249 = false;

    public C13761 f40250 = new Object();

    private void m28652(C14821 c14821) {
    }

    public final synchronized void m28657(C14821 c14821, C13761 c13761) {
        this.f40256 = c14821;
        m28652(c14821);
        this.f40250 = c13761;
        if (this.f40248 == null) {
            C5885 c5885 = new C5885();
            this.f40248 = c5885;
            c5885.f18023 = c13761;
            C5232 c5232 = new C5232(this.f40256, this.f40254);
            this.f40248.f18018 = c5232;
            this.f40255.m28871(c5232.m13171());
        }
    }

    static {
        ArrayList arrayList = new ArrayList();
        Iterator it = C7569.m17916().iterator();
        while (it.hasNext()) {
            arrayList.add(arrayList.size(), ((AbstractC1675) it.next()).mo2830());
        }
        f40244 = arrayList;
    }

    private void m28651() {
        if (this.f40257 == null) {
            this.f40257 = this.f40248.f18013;
        }
        try {
            int m11142 = C4248.m11142(this.f40248.f18021.f375);
            int m14009 = C5558.m14009(this.f40248.f18021.f382);
            int m14005 = C5558.m14005(this.f40248.f18021.f382);
            int m111422 = C4248.m11142(this.f40248.f18021.f378);
            int m140092 = C5558.m14009(this.f40248.f18021.f376);
            int m140052 = C5558.m14005(this.f40248.f18021.f376);
            String m14765 = this.f40248.m14765();
            C5885 c5885 = this.f40248;
            this.f40258 = C2190.m6426(m14765, c5885.f18013, c5885.f18019, this.f40257, m14009, m14005, m11142, m140092, m140052, m111422);
        } catch (IllegalArgumentException unused) {
        }
        this.f40255.m28871(new Object().m21871());
        try {
            String str = this.f40248.f18021.f382;
            C2190 c2190 = this.f40258;
            InterfaceC13137 m14006 = C5558.m14006(str, true, c2190.f7874, c2190.f7879);
            C4248 c4248 = new C4248(this.f40248.f18021.f375, this.f40258.f7876);
            C7711 c7711 = this.f40255.f40560;
            c7711.getClass();
            if (!(m14006 instanceof C14353)) {
                c7711.f22582 = true;
            }
            c7711.f22585.m31622(m14006);
            c7711.f22580 = c4248;
            c7711.f22586 = new byte[c4248.m11148()];
            int blockSize = m14006.getBlockSize();
            c7711.f22587 = blockSize;
            if (blockSize < 8) {
                c7711.f22587 = 8;
            }
            C13606 c13606 = this.f40255;
            synchronized (c13606.f40558) {
                c13606.f40561 = false;
                c13606.f40558.notifyAll();
            }
        } catch (IllegalArgumentException e) {
            throw new IOException("Fatal error during MAC startup!", e);
        }
    }

    public static String[] m28656() {
        ArrayList arrayList = f40244;
        return (String[]) arrayList.toArray(new String[arrayList.size()]);
    }

    @Override
    public final void mo14969(IOException iOException) {
        synchronized (this.f40247) {
            this.f40253 = true;
            this.f40247.notifyAll();
        }
    }

    @Override
    public final synchronized void mo14968(int i, byte[] bArr) {
        byte[] bytes;
        byte[] bytes2;
        byte[] bytes3;
        byte[] bytes4;
        C5885 c5885 = this.f40248;
        if (c5885 == null && bArr[0] != 20) {
            throw new IOException("Unexpected KEX message (type " + ((int) bArr[0]) + MotionUtils.EASING_TYPE_FORMAT_END);
        }
        if (this.f40249) {
            this.f40249 = false;
            return;
        }
        byte b = bArr[0];
        if (b == 20) {
            if (c5885 != null && c5885.f18020 != 0) {
                throw new IOException("Unexpected SSH_MSG_KEXINIT message during on-going kex exchange!");
            }
            C5232 c5232 = new C5232(bArr, i);
            C5885 c58852 = this.f40248;
            c58852.f18016 = c5232;
            c58852.f18021 = m28650(c58852.f18018.m13170(), this.f40248.f18016.m13170());
            C5885 c58853 = this.f40248;
            if (c58853.f18021 == null) {
                throw new IOException("Cannot negotiate, proposals do not match.");
            }
            if (c58853.f18016.m13172() && !this.f40248.f18021.f377) {
                this.f40249 = true;
            }
            if (!this.f40248.f18021.f381.equals("diffie-hellman-group-exchange-sha1") && !this.f40248.f18021.f381.equals("diffie-hellman-group-exchange-sha256")) {
                if (!this.f40248.f18021.f381.equals("diffie-hellman-group1-sha1") && !this.f40248.f18021.f381.equals("curve25519-sha256") && !this.f40248.f18021.f381.equals("curve25519-sha256@libssh.org") && !this.f40248.f18021.f381.equals("diffie-hellman-group14-sha1") && !this.f40248.f18021.f381.equals("ecdh-sha2-nistp521") && !this.f40248.f18021.f381.equals("ecdh-sha2-nistp384") && !this.f40248.f18021.f381.equals("ecdh-sha2-nistp256")) {
                    throw new IllegalStateException("Unkown KEX method!");
                }
                C5885 c58854 = this.f40248;
                c58854.f18017 = AbstractC9301.m21490(c58854.f18021.f381);
                C5885 c58855 = this.f40248;
                c58855.f18017.mo5106(c58855.f18021.f381);
                C5885 c58856 = this.f40248;
                c58856.m14766(c58856.f18017.mo5110());
                this.f40255.m28871(new C2706(this.f40248.f18017.mo5108()).m7652());
                this.f40248.f18020 = 1;
                return;
            }
            this.f40248.f18023.getClass();
            this.f40255.m28871(new C4390(this.f40248.f18023).m11347());
            C5885 c58857 = this.f40248;
            c58857.f18020 = 1;
            if (c58857.f18021.f381.endsWith("sha1")) {
                this.f40248.m14766("SHA1");
            } else {
                this.f40248.m14766("SHA-256");
            }
            return;
        }
        if (b == 21) {
            C2190 c2190 = this.f40258;
            if (c2190 == null) {
                throw new IOException("Peer sent SSH_MSG_NEWKEYS, but I have no key material ready!");
            }
            try {
                this.f40255.m28865(C5558.m14006(c5885.f18021.f376, false, c2190.f7877, c2190.f7875), new C4248(this.f40248.f18021.f378, this.f40258.f7878));
                C8687 c8687 = new C8687();
                int i2 = this.f40251 + 1;
                this.f40251 = i2;
                String str = this.f40248.f18021.f381;
                c8687.f25319 = i2;
                synchronized (this.f40247) {
                    this.f40252 = c8687;
                    this.f40247.notifyAll();
                }
                this.f40248 = null;
                return;
            } catch (IllegalArgumentException unused) {
                throw new IOException("Fatal error during MAC startup!");
            }
        }
        if (c5885 == null || c5885.f18020 == 0) {
            throw new IOException("Unexpected Kex submessage!");
        }
        if (!c5885.f18021.f381.equals("diffie-hellman-group-exchange-sha1") && !this.f40248.f18021.f381.equals("diffie-hellman-group-exchange-sha256")) {
            if ((this.f40248.f18021.f381.equals("diffie-hellman-group1-sha1") || this.f40248.f18021.f381.equals("diffie-hellman-group14-sha1") || this.f40248.f18021.f381.equals("ecdh-sha2-nistp256") || this.f40248.f18021.f381.equals("ecdh-sha2-nistp384") || this.f40248.f18021.f381.equals("ecdh-sha2-nistp521") || this.f40248.f18021.f381.equals("curve25519-sha256") || this.f40248.f18021.f381.equals("curve25519-sha256@libssh.org")) && this.f40248.f18020 == 1) {
                C8601 c8601 = new C8601(bArr, i);
                this.f40248.f18014 = c8601.m20327();
                this.f40248.f18017.mo5107(c8601.m20326().toByteArray());
                try {
                    C5885 c58858 = this.f40248;
                    AbstractC9301 abstractC9301 = c58858.f18017;
                    this.f40259.getClass();
                    try {
                        bytes3 = "SSH-2.0-TrileadSSH2Java_213".getBytes(LocalizedMessage.DEFAULT_ENCODING);
                    } catch (UnsupportedEncodingException unused2) {
                        bytes3 = "SSH-2.0-TrileadSSH2Java_213".getBytes();
                    }
                    byte[] bArr2 = bytes3;
                    String str2 = this.f40259.f31246;
                    try {
                        bytes4 = str2.getBytes(LocalizedMessage.DEFAULT_ENCODING);
                    } catch (UnsupportedEncodingException unused3) {
                        bytes4 = str2.getBytes();
                    }
                    c58858.f18013 = abstractC9301.m21491(bArr2, bytes4, this.f40248.f18018.m13171(), this.f40248.f18016.m13171(), c8601.m20327());
                    if (!m28653(c8601.m20328(), this.f40248.f18014)) {
                        throw new IOException("Hostkey signature sent by remote is wrong!");
                    }
                    C5885 c58859 = this.f40248;
                    c58859.f18019 = c58859.f18017.m21492();
                    m28651();
                    this.f40248.f18020 = -1;
                    return;
                } catch (IllegalArgumentException e) {
                    throw new IOException("KEX error.", e);
                }
            }
            throw new IllegalStateException("Unkown KEX method! (" + this.f40248.f18021.f381 + MotionUtils.EASING_TYPE_FORMAT_END);
        }
        int i3 = this.f40248.f18020;
        if (i3 == 1) {
            C11969 c11969 = new C11969(bArr, i);
            this.f40248.f18015 = new C11827(c11969.m25862(), c11969.m25861());
            this.f40248.f18015.m25631(this.f40254);
            this.f40255.m28871(new C10285(this.f40248.f18015.m25629()).m23104());
            this.f40248.f18020 = 2;
            return;
        }
        if (i3 == 2) {
            C12811 c12811 = new C12811(bArr, i);
            this.f40248.f18014 = c12811.m27410();
            this.f40248.f18015.m25630(c12811.m27409());
            try {
                C5885 c588510 = this.f40248;
                C11827 c11827 = c588510.f18015;
                String m14765 = c588510.m14765();
                this.f40259.getClass();
                try {
                    bytes = "SSH-2.0-TrileadSSH2Java_213".getBytes(LocalizedMessage.DEFAULT_ENCODING);
                } catch (UnsupportedEncodingException unused4) {
                    bytes = "SSH-2.0-TrileadSSH2Java_213".getBytes();
                }
                byte[] bArr3 = bytes;
                String str3 = this.f40259.f31246;
                try {
                    bytes2 = str3.getBytes(LocalizedMessage.DEFAULT_ENCODING);
                } catch (UnsupportedEncodingException unused5) {
                    bytes2 = str3.getBytes();
                }
                c588510.f18013 = c11827.m25632(m14765, bArr3, bytes2, this.f40248.f18018.m13171(), this.f40248.f18016.m13171(), c12811.m27410(), this.f40248.f18023);
                if (!m28653(c12811.m27411(), this.f40248.f18014)) {
                    throw new IOException("Hostkey signature sent by remote is wrong!");
                }
                C5885 c588511 = this.f40248;
                c588511.f18019 = c588511.f18015.m25633();
                m28651();
                this.f40248.f18020 = -1;
                return;
            } catch (IllegalArgumentException e2) {
                throw new IOException("KEX error.", e2);
            }
        }
        throw new IllegalStateException("Illegal State in KEX Exchange!");
    }

    public C13464(C13606 c13606, C10938 c10938, C14821 c14821, String str, int i, SecureRandom secureRandom) {
        this.f40255 = c13606;
        this.f40259 = c10938;
        this.f40256 = c14821;
        this.f40254 = secureRandom;
    }

    public static String m28655(String[] strArr, String[] strArr2) {
        if (strArr == null || strArr2 == null) {
            throw new IllegalArgumentException();
        }
        if (strArr.length == 0) {
            return null;
        }
        for (String str : strArr) {
            for (String str2 : strArr2) {
                if (str.equals(str2)) {
                    return str;
                }
            }
        }
        throw new Exception();
    }

    public static boolean m28654(String[] strArr, String[] strArr2) {
        if (strArr == null || strArr2 == null) {
            throw new IllegalArgumentException();
        }
        if (strArr.length == 0 && strArr2.length == 0) {
            return true;
        }
        if (strArr.length == 0 || strArr2.length == 0) {
            return false;
        }
        return strArr[0].equals(strArr2[0]);
    }

    public static C0132 m28650(C5043 c5043, C5043 c50432) {
        ?? obj = new Object();
        try {
            obj.f381 = m28655(c5043.f15205, c50432.f15205);
            C6074 c6074 = f40245;
            c6074.m15115(30, "kex_algo=" + obj.f381);
            obj.f380 = m28655(c5043.f15212, c50432.f15212);
            c6074.m15115(30, "server_host_key_algo=" + obj.f380);
            obj.f382 = m28655(c5043.f15206, c50432.f15206);
            obj.f376 = m28655(c5043.f15208, c50432.f15208);
            c6074.m15115(30, "enc_algo_client_to_server=" + obj.f382);
            c6074.m15115(30, "enc_algo_server_to_client=" + obj.f376);
            obj.f375 = m28655(c5043.f15207, c50432.f15207);
            obj.f378 = m28655(c5043.f15211, c50432.f15211);
            c6074.m15115(30, "mac_algo_client_to_server=" + obj.f375);
            c6074.m15115(30, "mac_algo_server_to_client=" + obj.f378);
            obj.f374 = m28655(c5043.f15204, c50432.f15204);
            obj.f379 = m28655(c5043.f15210, c50432.f15210);
            c6074.m15115(30, "comp_algo_client_to_server=" + obj.f374);
            c6074.m15115(30, "comp_algo_server_to_client=" + obj.f379);
            try {
                m28655(c5043.f15209, c50432.f15209);
            } catch (C4201 unused) {
            }
            try {
                m28655(c5043.f15213, c50432.f15213);
            } catch (C4201 unused2) {
            }
            if (m28654(c5043.f15205, c50432.f15205) && m28654(c5043.f15212, c50432.f15212)) {
                obj.f377 = true;
            }
            return obj;
        } catch (C4201 unused3) {
            return null;
        }
    }

    private boolean m28653(byte[] bArr, byte[] bArr2) {
        for (AbstractC1675 abstractC1675 : C7569.m17916()) {
            if (abstractC1675.mo2830().equals(this.f40248.f18021.f380)) {
                return abstractC1675.m5032(abstractC1675.mo5030(bArr2), this.f40248.f18013, abstractC1675.mo5035(bArr));
            }
        }
        throw new IOException(C4043.m10765(new StringBuilder("Unknown server host key algorithm '"), this.f40248.f18021.f380, "'"));
    }
}