package p138.p329.p374;

import com.hierynomus.protocol.commons.buffer.Buffer;
import com.hierynomus.spnego.SpnegoException;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import p138.p139.p143.p144.C2803;
import p138.p329.p330.C6079;
import p138.p329.p330.p331.p333.C6084;
import p138.p329.p330.p334.AbstractC6087;
import p138.p329.p330.p334.AbstractC6088;
import p138.p329.p330.p334.EnumC6100;
import p138.p329.p330.p334.p335.C6101;
import p138.p329.p330.p334.p335.C6109;

/* JADX INFO: renamed from: ދ.ށ.ފ.ނ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public abstract class AbstractC6422 {

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public int f17925;

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public String f17926;

    public AbstractC6422(int i, String str) {
        this.f17925 = i;
        this.f17926 = str;
    }

    /* JADX INFO: renamed from: ֏ */
    public void mo9647(Buffer<?> buffer, AbstractC6087 abstractC6087) throws IOException {
        C6109 c6109 = new C6109(AbstractC6088.m9459(this.f17925).m9463(), abstractC6087, true);
        ArrayList arrayList = new ArrayList();
        arrayList.add(C6421.f17924);
        arrayList.add(c6109);
        C6109 c61092 = new C6109(AbstractC6088.m9460(EnumC6100.APPLICATION, 0), new C6101(arrayList), false);
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        C6079 c6079 = new C6079(new C6084(), byteArrayOutputStream);
        try {
            c6079.m9450(c61092);
            c6079.close();
            buffer.m1463(byteArrayOutputStream.toByteArray());
        } catch (Throwable th) {
            try {
                throw th;
            } catch (Throwable th2) {
                try {
                    c6079.close();
                } catch (Throwable th3) {
                    th.addSuppressed(th3);
                }
                throw th2;
            }
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void m9648(AbstractC6087 abstractC6087) throws SpnegoException {
        if (abstractC6087 instanceof C6109) {
            C6109 c6109 = (C6109) abstractC6087;
            if (c6109.f17009.f17021 == this.f17925) {
                AbstractC6087 abstractC6087M9466 = c6109.m9466();
                if (!(abstractC6087M9466 instanceof C6101)) {
                    StringBuilder sbM4889 = C2803.m4889("Expected a ");
                    sbM4889.append(this.f17926);
                    sbM4889.append(" (SEQUENCE), not: ");
                    sbM4889.append(abstractC6087M9466);
                    throw new SpnegoException(sbM4889.toString());
                }
                for (AbstractC6087 abstractC60872 : (C6101) abstractC6087M9466) {
                    if (!(abstractC60872 instanceof C6109)) {
                        StringBuilder sbM48892 = C2803.m4889("Expected an ASN.1 TaggedObject as ");
                        sbM48892.append(this.f17926);
                        sbM48892.append(" contents, not: ");
                        sbM48892.append(abstractC60872);
                        throw new SpnegoException(sbM48892.toString());
                    }
                    mo9642((C6109) abstractC60872);
                }
                return;
            }
        }
        StringBuilder sbM48893 = C2803.m4889("Expected to find the ");
        sbM48893.append(this.f17926);
        sbM48893.append(" (CHOICE [");
        sbM48893.append(this.f17925);
        sbM48893.append("]) header, not: ");
        sbM48893.append(abstractC6087);
        throw new SpnegoException(sbM48893.toString());
    }

    /* JADX INFO: renamed from: ֏ */
    public abstract void mo9642(C6109 c6109);
}
