package k1;

import j1.C0556b;
import j1.C0557c;
import j1.C0558d;
import l1.AbstractC0621d;
import l1.C0622e;

/* JADX INFO: renamed from: k1.p, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public class C0598p {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    C0599q f4967a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    int f4968b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    String f4969c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    boolean f4970d = false;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    byte[] f4971e = null;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    byte[] f4972f = null;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    String f4973g = null;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    int f4974h = 1;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    C0622e f4975i;

    public C0598p(C0599q c0599q, boolean z2) {
        this.f4967a = c0599q;
        int i2 = this.f4968b;
        this.f4968b = 537395204 | i2;
        if (z2) {
            this.f4968b = i2 | 1611169812;
        }
        this.f4969c = C0556b.k();
        this.f4975i = C0622e.a();
    }

    public String a() {
        return this.f4973g;
    }

    public byte[] b() {
        return this.f4972f;
    }

    public byte[] c(byte[] bArr, int i2, int i3) throws V {
        byte[] bArrP;
        int i4 = this.f4974h;
        if (i4 == 1) {
            C0556b c0556b = new C0556b(this.f4968b, this.f4967a.d(), this.f4969c);
            bArrP = c0556b.p();
            C0622e c0622e = this.f4975i;
            if (C0622e.f5384g >= 4) {
                c0622e.println(c0556b);
                C0622e c0622e2 = this.f4975i;
                if (C0622e.f5384g >= 6) {
                    AbstractC0621d.a(c0622e2, bArrP, 0, bArrP.length);
                }
            }
            this.f4974h++;
        } else {
            if (i4 != 2) {
                throw new V("Invalid state");
            }
            try {
                C0557c c0557c = new C0557c(bArr);
                C0622e c0622e3 = this.f4975i;
                if (C0622e.f5384g >= 4) {
                    c0622e3.println(c0557c);
                    C0622e c0622e4 = this.f4975i;
                    if (C0622e.f5384g >= 6) {
                        AbstractC0621d.a(c0622e4, bArr, 0, bArr.length);
                    }
                }
                this.f4971e = c0557c.j();
                this.f4968b &= c0557c.a();
                C0558d c0558d = new C0558d(c0557c, this.f4967a.i(), this.f4967a.d(), this.f4967a.n(), this.f4969c, this.f4968b);
                bArrP = c0558d.C();
                C0622e c0622e5 = this.f4975i;
                if (C0622e.f5384g >= 4) {
                    c0622e5.println(c0558d);
                    C0622e c0622e6 = this.f4975i;
                    if (C0622e.f5384g >= 6) {
                        AbstractC0621d.a(c0622e6, bArrP, 0, bArrP.length);
                    }
                }
                if ((this.f4968b & 16) != 0) {
                    this.f4972f = c0558d.p();
                }
                this.f4970d = true;
                this.f4974h++;
            } catch (Exception e2) {
                throw new V(e2.getMessage(), e2);
            }
        }
        return bArrP;
    }

    public boolean d() {
        return this.f4970d;
    }

    public String toString() {
        String string;
        String string2;
        String str = "NtlmContext[auth=" + this.f4967a + ",ntlmsspFlags=0x" + AbstractC0621d.c(this.f4968b, 8) + ",workstation=" + this.f4969c + ",isEstablished=" + this.f4970d + ",state=" + this.f4974h + ",serverChallenge=";
        if (this.f4971e == null) {
            string = str + "null";
        } else {
            StringBuilder sb = new StringBuilder();
            sb.append(str);
            byte[] bArr = this.f4971e;
            sb.append(AbstractC0621d.d(bArr, 0, bArr.length * 2));
            string = sb.toString();
        }
        String str2 = string + ",signingKey=";
        if (this.f4972f == null) {
            string2 = str2 + "null";
        } else {
            StringBuilder sb2 = new StringBuilder();
            sb2.append(str2);
            byte[] bArr2 = this.f4972f;
            sb2.append(AbstractC0621d.d(bArr2, 0, bArr2.length * 2));
            string2 = sb2.toString();
        }
        return string2 + "]";
    }
}
