what-the-bank/sources/o/gnK.java

131 lines
4.0 KiB
Java

package o;
import java.io.IOException;
import java.io.InputStream;
import org.spongycastle.asn1.ASN1Exception;
/* loaded from: classes6.dex */
public final class gnK {
private final int a;
private final byte[][] b;
private final InputStream d;
public gnK(InputStream inputStream) {
this(inputStream, goV.c(inputStream));
}
public gnK(InputStream inputStream, int i) {
this.d = inputStream;
this.a = i;
this.b = new byte[11];
}
/* JADX INFO: Access modifiers changed from: package-private */
public final AbstractC15315gnE b(boolean z, int i) throws IOException {
if (!z) {
return new C15355goI(false, i, new C15382gov(((C15359goT) this.d).a()));
}
C15343gns a = a();
if (this.d instanceof goS) {
if (a.a.size() == 1) {
return new C15361goa(true, i, (InterfaceC15342gnr) a.a.elementAt(0));
}
return new C15361goa(false, i, gnY.b(a));
}
if (a.a.size() == 1) {
return new C15355goI(true, i, (InterfaceC15342gnr) a.a.elementAt(0));
}
return new C15355goI(false, i, C15373gom.c(a));
}
public final InterfaceC15342gnr e() throws IOException {
int read = this.d.read();
if (read == -1) {
return null;
}
InputStream inputStream = this.d;
if (inputStream instanceof goS) {
((goS) inputStream).b(false);
}
int a = C15348gnx.a(this.d, read);
boolean z = (read & 32) != 0;
int d = C15348gnx.d(this.d, this.a);
if (d < 0) {
if (!z) {
throw new IOException("indefinite-length primitive encoding encountered");
}
gnK gnk = new gnK(new goS(this.d, this.a), this.a);
if ((read & 64) != 0) {
return new gnW(a, gnk);
}
if ((read & 128) != 0) {
return new gnZ(true, a, gnk);
}
if (a == 4) {
return new C15324gnU(gnk);
}
if (a == 8) {
return new C15375goo(gnk);
}
if (a == 16) {
return new C15366gof(gnk);
}
if (a == 17) {
return new C15365goe(gnk);
}
StringBuilder sb = new StringBuilder("unknown BER object encountered: 0x");
sb.append(Integer.toHexString(a));
throw new ASN1Exception(sb.toString());
}
C15359goT c15359goT = new C15359goT(this.d, d);
if ((read & 64) != 0) {
return new C15368goh(z, a, c15359goT.a());
}
if ((read & 128) != 0) {
return new gnZ(z, a, new gnK(c15359goT));
}
if (!z) {
if (a == 4) {
return new C15381gou(c15359goT);
}
try {
return C15348gnx.a(a, c15359goT, this.b);
} catch (IllegalArgumentException e) {
throw new ASN1Exception("corrupted stream detected", e);
}
}
if (a == 4) {
return new C15324gnU(new gnK(c15359goT));
}
if (a == 8) {
return new C15375goo(new gnK(c15359goT));
}
if (a == 16) {
return new C15386goz(new gnK(c15359goT));
}
if (a == 17) {
return new C15352goB(new gnK(c15359goT));
}
StringBuilder sb2 = new StringBuilder("unknown tag ");
sb2.append(a);
sb2.append(" encountered");
throw new IOException(sb2.toString());
}
/* JADX INFO: Access modifiers changed from: package-private */
public final C15343gns a() throws IOException {
C15343gns c15343gns = new C15343gns();
while (true) {
InterfaceC15342gnr e = e();
if (e == null) {
return c15343gns;
}
if (e instanceof goR) {
c15343gns.a.addElement(((goR) e).a());
} else {
c15343gns.a.addElement(e.i());
}
}
}
}