MT Manager v2.15.3版本的 MD5 值为:1cbd6ee7afdac97645dd3a8c4751ecf0

以下内容为反编译后的 C15063.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 C15063 implements InterfaceC2430 {

    public static final C3505 f45283 = C3505.m9669(C15063.class);

    public static final ArrayList f45284;

    public static final int f45285 = 0;

    public C14221 f45290;

    public C0746 f45292;

    public C5471 f45293;

    public final SecureRandom f45294;

    public byte[] f45296;

    public C1260 f45297;

    public final C12256 f45298;

    public int f45288 = 0;

    public final Object f45289 = new Object();

    public C9120 f45295 = null;

    public boolean f45291 = false;

    public boolean f45286 = false;

    public C12542 f45287 = new Object();

    private void m31413(C5471 c5471) {
    }

    public final synchronized void m31418(C5471 c5471, C12542 c12542) {
        this.f45293 = c5471;
        m31413(c5471);
        this.f45287 = c12542;
        if (this.f45292 == null) {
            C0746 c0746 = new C0746();
            this.f45292 = c0746;
            c0746.f2513 = c12542;
            C0137 c0137 = new C0137(this.f45293, this.f45294);
            this.f45292.f2518 = c0137;
            this.f45298.m26723(c0137.m796());
        }
    }

    static {
        ArrayList arrayList = new ArrayList();
        Iterator it = C10011.m22966().iterator();
        while (it.hasNext()) {
            arrayList.add(arrayList.size(), ((AbstractC7485) it.next()).mo5989());
        }
        f45284 = arrayList;
    }

    private void m31412() {
        if (this.f45296 == null) {
            this.f45296 = this.f45292.f2512;
        }
        try {
            int m25207 = C11320.m25207(this.f45292.f2516.f15234);
            int m1677 = C0418.m1677(this.f45292.f2516.f15232);
            int m1674 = C0418.m1674(this.f45292.f2516.f15232);
            int m252072 = C11320.m25207(this.f45292.f2516.f15236);
            int m16772 = C0418.m1677(this.f45292.f2516.f15229);
            int m16742 = C0418.m1674(this.f45292.f2516.f15229);
            String m2924 = this.f45292.m2924();
            C0746 c0746 = this.f45292;
            this.f45297 = C1260.m4325(m2924, c0746.f2512, c0746.f2514, this.f45296, m1677, m1674, m25207, m16772, m16742, m252072);
        } catch (IllegalArgumentException unused) {
        }
        this.f45298.m26723(new Object().m5787());
        try {
            String str = this.f45292.f2516.f15232;
            C1260 c1260 = this.f45297;
            InterfaceC14735 m1675 = C0418.m1675(str, true, c1260.f4880, c1260.f4881);
            C11320 c11320 = new C11320(this.f45292.f2516.f15234, this.f45297.f4879);
            C6361 c6361 = this.f45298.f36768;
            c6361.getClass();
            if (!(m1675 instanceof C12162)) {
                c6361.f20561 = true;
            }
            c6361.f20567.m13903(m1675);
            c6361.f20563 = c11320;
            c6361.f20570 = new byte[c11320.m25213()];
            int blockSize = m1675.getBlockSize();
            c6361.f20575 = blockSize;
            if (blockSize < 8) {
                c6361.f20575 = 8;
            }
            C12256 c12256 = this.f45298;
            synchronized (c12256.f36756) {
                c12256.f36758 = false;
                c12256.f36756.notifyAll();
            }
        } catch (IllegalArgumentException e) {
            throw new IOException("Fatal error during MAC startup!", e);
        }
    }

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

    @Override
    public final void mo7082(IOException iOException) {
        synchronized (this.f45289) {
            this.f45291 = true;
            this.f45289.notifyAll();
        }
    }

    @Override
    public final synchronized void mo7081(int i, byte[] bArr) {
        byte[] bytes;
        byte[] bytes2;
        byte[] bytes3;
        byte[] bytes4;
        C0746 c0746 = this.f45292;
        if (c0746 == null && bArr[0] != 20) {
            throw new IOException("Unexpected KEX message (type " + ((int) bArr[0]) + MotionUtils.EASING_TYPE_FORMAT_END);
        }
        if (this.f45286) {
            this.f45286 = false;
            return;
        }
        byte b = bArr[0];
        if (b == 20) {
            if (c0746 != null && c0746.f2517 != 0) {
                throw new IOException("Unexpected SSH_MSG_KEXINIT message during on-going kex exchange!");
            }
            C0137 c0137 = new C0137(bArr, i);
            C0746 c07462 = this.f45292;
            c07462.f2510 = c0137;
            c07462.f2516 = m31411(c07462.f2518.m794(), this.f45292.f2510.m794());
            C0746 c07463 = this.f45292;
            if (c07463.f2516 == null) {
                throw new IOException("Cannot negotiate, proposals do not match.");
            }
            if (c07463.f2510.m795() && !this.f45292.f2516.f15230) {
                this.f45286 = true;
            }
            if (!this.f45292.f2516.f15237.equals("diffie-hellman-group-exchange-sha1") && !this.f45292.f2516.f15237.equals("diffie-hellman-group-exchange-sha256")) {
                if (!this.f45292.f2516.f15237.equals("diffie-hellman-group1-sha1") && !this.f45292.f2516.f15237.equals("curve25519-sha256") && !this.f45292.f2516.f15237.equals("curve25519-sha256@libssh.org") && !this.f45292.f2516.f15237.equals("diffie-hellman-group14-sha1") && !this.f45292.f2516.f15237.equals("ecdh-sha2-nistp521") && !this.f45292.f2516.f15237.equals("ecdh-sha2-nistp384") && !this.f45292.f2516.f15237.equals("ecdh-sha2-nistp256")) {
                    throw new IllegalStateException("Unkown KEX method!");
                }
                C0746 c07464 = this.f45292;
                c07464.f2511 = AbstractC8794.m20661(c07464.f2516.f15237);
                C0746 c07465 = this.f45292;
                c07465.f2511.mo8410(c07465.f2516.f15237);
                C0746 c07466 = this.f45292;
                c07466.m2925(c07466.f2511.mo8413());
                this.f45298.m26723(new C2663(this.f45292.f2511.mo8412()).m7616());
                this.f45292.f2517 = 1;
                return;
            }
            this.f45292.f2513.getClass();
            this.f45298.m26723(new C12770(this.f45292.f2513).m27627());
            C0746 c07467 = this.f45292;
            c07467.f2517 = 1;
            if (c07467.f2516.f15237.endsWith("sha1")) {
                this.f45292.m2925("SHA1");
            } else {
                this.f45292.m2925("SHA-256");
            }
            return;
        }
        if (b == 21) {
            C1260 c1260 = this.f45297;
            if (c1260 == null) {
                throw new IOException("Peer sent SSH_MSG_NEWKEYS, but I have no key material ready!");
            }
            try {
                this.f45298.m26718(C0418.m1675(c0746.f2516.f15229, false, c1260.f4882, c1260.f4878), new C11320(this.f45292.f2516.f15236, this.f45297.f4883));
                C9120 c9120 = new C9120();
                int i2 = this.f45288 + 1;
                this.f45288 = i2;
                String str = this.f45292.f2516.f15237;
                c9120.f27626 = i2;
                synchronized (this.f45289) {
                    this.f45295 = c9120;
                    this.f45289.notifyAll();
                }
                this.f45292 = null;
                return;
            } catch (IllegalArgumentException unused) {
                throw new IOException("Fatal error during MAC startup!");
            }
        }
        if (c0746 == null || c0746.f2517 == 0) {
            throw new IOException("Unexpected Kex submessage!");
        }
        if (!c0746.f2516.f15237.equals("diffie-hellman-group-exchange-sha1") && !this.f45292.f2516.f15237.equals("diffie-hellman-group-exchange-sha256")) {
            if ((this.f45292.f2516.f15237.equals("diffie-hellman-group1-sha1") || this.f45292.f2516.f15237.equals("diffie-hellman-group14-sha1") || this.f45292.f2516.f15237.equals("ecdh-sha2-nistp256") || this.f45292.f2516.f15237.equals("ecdh-sha2-nistp384") || this.f45292.f2516.f15237.equals("ecdh-sha2-nistp521") || this.f45292.f2516.f15237.equals("curve25519-sha256") || this.f45292.f2516.f15237.equals("curve25519-sha256@libssh.org")) && this.f45292.f2517 == 1) {
                C8560 c8560 = new C8560(bArr, i);
                this.f45292.f2515 = c8560.m20204();
                this.f45292.f2511.mo8411(c8560.m20202().toByteArray());
                try {
                    C0746 c07468 = this.f45292;
                    AbstractC8794 abstractC8794 = c07468.f2511;
                    this.f45290.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.f45290.f43215;
                    try {
                        bytes4 = str2.getBytes(LocalizedMessage.DEFAULT_ENCODING);
                    } catch (UnsupportedEncodingException unused3) {
                        bytes4 = str2.getBytes();
                    }
                    c07468.f2512 = abstractC8794.m20662(bArr2, bytes4, this.f45292.f2518.m796(), this.f45292.f2510.m796(), c8560.m20204());
                    if (!m31414(c8560.m20203(), this.f45292.f2515)) {
                        throw new IOException("Hostkey signature sent by remote is wrong!");
                    }
                    C0746 c07469 = this.f45292;
                    c07469.f2514 = c07469.f2511.m20663();
                    m31412();
                    this.f45292.f2517 = -1;
                    return;
                } catch (IllegalArgumentException e) {
                    throw new IOException("KEX error.", e);
                }
            }
            throw new IllegalStateException("Unkown KEX method! (" + this.f45292.f2516.f15237 + MotionUtils.EASING_TYPE_FORMAT_END);
        }
        int i3 = this.f45292.f2517;
        if (i3 == 1) {
            C10244 c10244 = new C10244(bArr, i);
            this.f45292.f2509 = new C7952(c10244.m23361(), c10244.m23360());
            this.f45292.f2509.m19032(this.f45294);
            this.f45298.m26723(new C13612(this.f45292.f2509.m19030()).m28955());
            this.f45292.f2517 = 2;
            return;
        }
        if (i3 == 2) {
            C14454 c14454 = new C14454(bArr, i);
            this.f45292.f2515 = c14454.m30322();
            this.f45292.f2509.m19031(c14454.m30320());
            try {
                C0746 c074610 = this.f45292;
                C7952 c7952 = c074610.f2509;
                String m2924 = c074610.m2924();
                this.f45290.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.f45290.f43215;
                try {
                    bytes2 = str3.getBytes(LocalizedMessage.DEFAULT_ENCODING);
                } catch (UnsupportedEncodingException unused5) {
                    bytes2 = str3.getBytes();
                }
                c074610.f2512 = c7952.m19033(m2924, bArr3, bytes2, this.f45292.f2518.m796(), this.f45292.f2510.m796(), c14454.m30322(), this.f45292.f2513);
                if (!m31414(c14454.m30321(), this.f45292.f2515)) {
                    throw new IOException("Hostkey signature sent by remote is wrong!");
                }
                C0746 c074611 = this.f45292;
                c074611.f2514 = c074611.f2509.m19034();
                m31412();
                this.f45292.f2517 = -1;
                return;
            } catch (IllegalArgumentException e2) {
                throw new IOException("KEX error.", e2);
            }
        }
        throw new IllegalStateException("Illegal State in KEX Exchange!");
    }

    public C15063(C12256 c12256, C14221 c14221, C5471 c5471, String str, int i, SecureRandom secureRandom) {
        this.f45298 = c12256;
        this.f45290 = c14221;
        this.f45293 = c5471;
        this.f45294 = secureRandom;
    }

    public static String m31416(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 m31415(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 C4675 m31411(C13379 c13379, C13379 c133792) {
        ?? obj = new Object();
        try {
            obj.f15237 = m31416(c13379.f39339, c133792.f39339);
            C3505 c3505 = f45283;
            c3505.m9670(30, "kex_algo=" + obj.f15237);
            obj.f15235 = m31416(c13379.f39345, c133792.f39345);
            c3505.m9670(30, "server_host_key_algo=" + obj.f15235);
            obj.f15232 = m31416(c13379.f39333, c133792.f39333);
            obj.f15229 = m31416(c13379.f39335, c133792.f39335);
            c3505.m9670(30, "enc_algo_client_to_server=" + obj.f15232);
            c3505.m9670(30, "enc_algo_server_to_client=" + obj.f15229);
            obj.f15234 = m31416(c13379.f39334, c133792.f39334);
            obj.f15236 = m31416(c13379.f39341, c133792.f39341);
            c3505.m9670(30, "mac_algo_client_to_server=" + obj.f15234);
            c3505.m9670(30, "mac_algo_server_to_client=" + obj.f15236);
            obj.f15231 = m31416(c13379.f39336, c133792.f39336);
            obj.f15233 = m31416(c13379.f39338, c133792.f39338);
            c3505.m9670(30, "comp_algo_client_to_server=" + obj.f15231);
            c3505.m9670(30, "comp_algo_server_to_client=" + obj.f15233);
            try {
                m31416(c13379.f39342, c133792.f39342);
            } catch (C11695 unused) {
            }
            try {
                m31416(c13379.f39340, c133792.f39340);
            } catch (C11695 unused2) {
            }
            if (m31415(c13379.f39339, c133792.f39339) && m31415(c13379.f39345, c133792.f39345)) {
                obj.f15230 = true;
            }
            return obj;
        } catch (C11695 unused3) {
            return null;
        }
    }

    private boolean m31414(byte[] bArr, byte[] bArr2) {
        for (AbstractC7485 abstractC7485 : C10011.m22966()) {
            if (abstractC7485.mo5989().equals(this.f45292.f2516.f15235)) {
                return abstractC7485.m18299(abstractC7485.mo1261(bArr2), this.f45292.f2512, abstractC7485.mo1265(bArr));
            }
        }
        throw new IOException(C11446.m25432(new StringBuilder("Unknown server host key algorithm '"), this.f45292.f2516.f15235, "'"));
    }
}