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

283 lines
9.1 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package o;
import java.io.ByteArrayInputStream;
import java.io.EOFException;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import org.spongycastle.asn1.ASN1Exception;
import org.spongycastle.asn1.ASN1Integer;
/* renamed from: o.gnx, reason: case insensitive filesystem */
/* loaded from: classes6.dex */
public final class C15348gnx extends FilterInputStream {
final int a;
private final byte[][] c;
private final boolean e;
public C15348gnx(InputStream inputStream) {
this(inputStream, goV.c(inputStream));
}
public C15348gnx(byte[] bArr) {
this(new ByteArrayInputStream(bArr), bArr.length);
}
public C15348gnx(byte[] bArr, byte b) {
this(new ByteArrayInputStream(bArr), bArr.length, true);
}
private C15348gnx(InputStream inputStream, int i) {
this(inputStream, i, false);
}
public C15348gnx(InputStream inputStream, byte b) {
this(inputStream, goV.c(inputStream), true);
}
private C15348gnx(InputStream inputStream, int i, boolean z) {
super(inputStream);
this.a = i;
this.e = z;
this.c = new byte[11];
}
private static C15343gns b(C15359goT c15359goT) throws IOException {
C15348gnx c15348gnx = new C15348gnx(c15359goT);
C15343gns c15343gns = new C15343gns();
while (true) {
AbstractC15315gnE b = c15348gnx.b();
if (b == null) {
return c15343gns;
}
c15343gns.a.addElement(b);
}
}
public final AbstractC15315gnE b() throws IOException {
int read = read();
if (read <= 0) {
if (read != 0) {
return null;
}
throw new IOException("unexpected end-of-contents marker");
}
int a = a(this, read);
int i = read & 32;
boolean z = i != 0;
int d = d(this, this.a);
if (d < 0) {
if (!z) {
throw new IOException("indefinite-length primitive encoding encountered");
}
gnK gnk = new gnK(new goS(this, this.a), this.a);
if ((read & 64) != 0) {
return new gnW(a, gnk).a();
}
if ((read & 128) != 0) {
return new gnZ(true, a, gnk).a();
}
if (a == 4) {
return new C15324gnU(gnk).a();
}
if (a == 8) {
return new C15375goo(gnk).a();
}
if (a == 16) {
return new C15366gof(gnk).a();
}
if (a == 17) {
return new C15365goe(gnk).a();
}
throw new IOException("unknown BER object encountered");
}
boolean z2 = i != 0;
try {
C15359goT c15359goT = new C15359goT(this, d);
if ((read & 64) != 0) {
return new C15368goh(z2, a, c15359goT.a());
}
if ((read & 128) != 0) {
return new gnK(c15359goT).b(z2, a);
}
if (!z2) {
return a(a, c15359goT, this.c);
}
if (a == 4) {
C15343gns b = b(c15359goT);
int size = b.a.size();
gnD[] gndArr = new gnD[size];
for (int i2 = 0; i2 != size; i2++) {
gndArr[i2] = (gnD) ((InterfaceC15342gnr) b.a.elementAt(i2));
}
return new gnV(gndArr);
}
if (a == 8) {
return new C15371gok(b(c15359goT));
}
if (a == 16) {
if (this.e) {
return new C15360goX(c15359goT.a());
}
return C15373gom.c(b(c15359goT));
}
if (a == 17) {
return C15373gom.e(b(c15359goT));
}
StringBuilder sb = new StringBuilder("unknown tag ");
sb.append(a);
sb.append(" encountered");
throw new IOException(sb.toString());
} catch (IllegalArgumentException e) {
throw new ASN1Exception("corrupted stream detected", e);
}
}
/* JADX INFO: Access modifiers changed from: package-private */
public static int a(InputStream inputStream, int i) throws IOException {
int i2 = i & 31;
if (i2 != 31) {
return i2;
}
int read = inputStream.read();
if ((read & 127) == 0) {
throw new IOException("corrupted stream - invalid high tag number found");
}
int i3 = 0;
while (read >= 0 && (read & 128) != 0) {
i3 = ((read & 127) | i3) << 7;
read = inputStream.read();
}
if (read >= 0) {
return i3 | (read & 127);
}
throw new EOFException("EOF found inside tag value.");
}
/* JADX INFO: Access modifiers changed from: package-private */
public static int d(InputStream inputStream, int i) throws IOException {
int read = inputStream.read();
if (read < 0) {
throw new EOFException("EOF found when length expected");
}
if (read == 128) {
return -1;
}
if (read <= 127) {
return read;
}
int i2 = read & 127;
if (i2 > 4) {
throw new IOException("DER length more than 4 bytes: ".concat(String.valueOf(i2)));
}
int i3 = 0;
for (int i4 = 0; i4 < i2; i4++) {
int read2 = inputStream.read();
if (read2 < 0) {
throw new EOFException("EOF found reading length");
}
i3 = (i3 << 8) + read2;
}
if (i3 < 0) {
throw new IOException("corrupted stream - negative length found");
}
if (i3 < i) {
return i3;
}
throw new IOException("corrupted stream - out of bounds length found");
}
/* JADX INFO: Access modifiers changed from: package-private */
public static AbstractC15315gnE a(int i, C15359goT c15359goT, byte[][] bArr) throws IOException {
if (i == 10) {
return C15350gnz.d(e(c15359goT, bArr));
}
if (i == 12) {
return new goD(c15359goT.a());
}
if (i == 30) {
return new C15372gol(e(c15359goT));
}
switch (i) {
case 1:
return C15345gnu.d(e(c15359goT, bArr));
case 2:
return new ASN1Integer(c15359goT.a(), false);
case 3:
return AbstractC15344gnt.b(c15359goT.b, c15359goT);
case 4:
return new C15382gov(c15359goT.a());
case 5:
return C15380got.a;
case 6:
return C15314gnC.a(e(c15359goT, bArr));
default:
switch (i) {
case 18:
return new C15379gos(c15359goT.a());
case 19:
return new goA(c15359goT.a());
case 20:
return new C15353goE(c15359goT.a());
case 21:
return new goC(c15359goT.a());
case 22:
return new C15376gop(c15359goT.a());
case 23:
return new C15320gnN(c15359goT.a());
case 24:
return new C15349gny(c15359goT.a());
case 25:
return new C15374gon(c15359goT.a());
case 26:
return new C15357goM(c15359goT.a());
case 27:
return new C15378gor(c15359goT.a());
case 28:
return new goH(c15359goT.a());
default:
StringBuilder sb = new StringBuilder("unknown tag ");
sb.append(i);
sb.append(" encountered");
throw new IOException(sb.toString());
}
}
}
private static char[] e(C15359goT c15359goT) throws IOException {
int read;
int i = c15359goT.b / 2;
char[] cArr = new char[i];
for (int i2 = 0; i2 < i; i2++) {
int read2 = c15359goT.read();
if (read2 < 0 || (read = c15359goT.read()) < 0) {
break;
}
cArr[i2] = (char) ((read2 << 8) | (read & 255));
}
return cArr;
}
private static byte[] e(C15359goT c15359goT, byte[][] bArr) throws IOException {
int i = c15359goT.b;
if (c15359goT.b < bArr.length) {
byte[] bArr2 = bArr[i];
if (bArr2 == null) {
bArr2 = new byte[i];
bArr[i] = bArr2;
}
int length = bArr2.length;
int i2 = 0;
while (i2 < length) {
int read = c15359goT.read(bArr2, i2, length - i2);
if (read < 0) {
break;
}
i2 += read;
}
return bArr2;
}
return c15359goT.a();
}
}