package p138.p329.p330.p331.p332;

import com.hierynomus.asn1.ASN1ParseException;
import java.io.IOException;
import java.io.InputStream;
import p138.p329.p330.p334.AbstractC6087;
import p138.p329.p330.p334.AbstractC6088;
import p138.p329.p330.p334.EnumC6086;
import p138.p329.p330.p334.EnumC6100;

/* JADX INFO: renamed from: ދ.ށ.֏.ނ.֏.֏, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C6082 {
    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public int m9454(InputStream inputStream) {
        try {
            int i = inputStream.read();
            if (i < 127) {
                return i;
            }
            int i2 = i & 127;
            int i3 = 0;
            for (int i4 = 0; i4 < i2; i4++) {
                i3 = (i3 << 8) + inputStream.read();
            }
            if (i3 != 0) {
                return i3;
            }
            throw new ASN1ParseException("The indefinite length form is not (yet) supported!");
        } catch (IOException e) {
            throw new ASN1ParseException("Unable to read the length of the ASN.1 object.", e);
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public byte[] m9455(int i, InputStream inputStream) {
        try {
            byte[] bArr = new byte[i];
            int i2 = 0;
            while (i2 < i) {
                int i3 = inputStream.read(bArr, i2, i - i2);
                if (i3 == -1) {
                    break;
                }
                i2 += i3;
            }
            return bArr;
        } catch (IOException e) {
            throw new ASN1ParseException("Unable to read the value of the ASN.1 object", e);
        }
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public AbstractC6088<? extends AbstractC6087> m9456(InputStream inputStream) {
        try {
            int i = inputStream.read();
            byte b = (byte) i;
            int i2 = b & 192;
            for (EnumC6100 enumC6100 : EnumC6100.values()) {
                if (enumC6100.f17030 == i2) {
                    EnumC6086 enumC6086 = (b & 32) == 0 ? EnumC6086.PRIMITIVE : EnumC6086.CONSTRUCTED;
                    int i3 = i & 31;
                    if (i3 <= 30) {
                        return AbstractC6088.m9460(enumC6100, i3).m9464(enumC6086);
                    }
                    int i4 = inputStream.read();
                    int i5 = 0;
                    do {
                        i5 = (i5 << 7) | (i4 & 127);
                        i4 = inputStream.read();
                    } while ((i4 & 128) > 0);
                    return AbstractC6088.m9460(enumC6100, i5).m9464(enumC6086);
                }
            }
            throw new IllegalStateException("Could not parse ASN.1 Tag Class (should be impossible)");
        } catch (IOException e) {
            throw new ASN1ParseException("Unable to parse ASN.1 tag", e);
        }
    }
}
