package o; import com.google.common.base.Ascii; import com.google.common.primitives.UnsignedBytes; import java.io.IOException; import java.math.BigInteger; import java.util.Enumeration; import org.bouncycastle.asn1.ASN1Encoding; import org.spongycastle.asn1.ASN1Integer; import org.spongycastle.asn1.ASN1ParsingException; /* renamed from: o.gpk, reason: case insensitive filesystem */ /* loaded from: classes6.dex */ public final class C15408gpk { private static void b(String str, boolean z, AbstractC15315gnE abstractC15315gnE, StringBuffer stringBuffer) { while (true) { String b = grR.b(); if (abstractC15315gnE instanceof AbstractC15317gnH) { Enumeration b2 = ((AbstractC15317gnH) abstractC15315gnE).b(); StringBuilder sb = new StringBuilder(); sb.append(str); sb.append(" "); String obj = sb.toString(); stringBuffer.append(str); if (abstractC15315gnE instanceof gnX) { stringBuffer.append("BER Sequence"); } else if (abstractC15315gnE instanceof C15385goy) { stringBuffer.append("DER Sequence"); } else { stringBuffer.append("Sequence"); } stringBuffer.append(b); while (b2.hasMoreElements()) { Object nextElement = b2.nextElement(); if (nextElement == null || nextElement.equals(C15380got.a)) { stringBuffer.append(obj); stringBuffer.append("NULL"); stringBuffer.append(b); } else if (nextElement instanceof AbstractC15315gnE) { b(obj, z, (AbstractC15315gnE) nextElement, stringBuffer); } else { b(obj, z, ((InterfaceC15342gnr) nextElement).i(), stringBuffer); } } return; } if (abstractC15315gnE instanceof AbstractC15321gnP) { StringBuilder sb2 = new StringBuilder(); sb2.append(str); sb2.append(" "); String obj2 = sb2.toString(); stringBuffer.append(str); if (abstractC15315gnE instanceof C15361goa) { stringBuffer.append("BER Tagged ["); } else { stringBuffer.append("Tagged ["); } AbstractC15321gnP abstractC15321gnP = (AbstractC15321gnP) abstractC15315gnE; stringBuffer.append(Integer.toString(abstractC15321gnP.e)); stringBuffer.append(']'); if (!abstractC15321gnP.a) { stringBuffer.append(" IMPLICIT "); } stringBuffer.append(b); boolean z2 = abstractC15321gnP.b; InterfaceC15342gnr interfaceC15342gnr = abstractC15321gnP.d; abstractC15315gnE = interfaceC15342gnr != null ? interfaceC15342gnr.i() : null; str = obj2; } else if (!(abstractC15315gnE instanceof AbstractC15318gnI)) { if (abstractC15315gnE instanceof gnD) { gnD gnd = (gnD) abstractC15315gnE; if (abstractC15315gnE instanceof gnV) { StringBuilder sb3 = new StringBuilder(); sb3.append(str); sb3.append("BER Constructed Octet String["); sb3.append(gnd.b().length); sb3.append("] "); stringBuffer.append(sb3.toString()); } else { StringBuilder sb4 = new StringBuilder(); sb4.append(str); sb4.append("DER Octet String["); sb4.append(gnd.b().length); sb4.append("] "); stringBuffer.append(sb4.toString()); } if (z) { stringBuffer.append(b(str, gnd.b())); return; } else { stringBuffer.append(b); return; } } if (abstractC15315gnE instanceof C15314gnC) { StringBuilder sb5 = new StringBuilder(); sb5.append(str); sb5.append("ObjectIdentifier("); sb5.append(((C15314gnC) abstractC15315gnE).d); sb5.append(")"); sb5.append(b); stringBuffer.append(sb5.toString()); return; } if (abstractC15315gnE instanceof C15345gnu) { StringBuilder sb6 = new StringBuilder(); sb6.append(str); sb6.append("Boolean("); sb6.append(((C15345gnu) abstractC15315gnE).e[0] != 0); sb6.append(")"); sb6.append(b); stringBuffer.append(sb6.toString()); return; } if (abstractC15315gnE instanceof ASN1Integer) { StringBuilder sb7 = new StringBuilder(); sb7.append(str); sb7.append("Integer("); sb7.append(new BigInteger(((ASN1Integer) abstractC15315gnE).b)); sb7.append(")"); sb7.append(b); stringBuffer.append(sb7.toString()); return; } if (abstractC15315gnE instanceof C15367gog) { C15367gog c15367gog = (C15367gog) abstractC15315gnE; StringBuilder sb8 = new StringBuilder(); sb8.append(str); sb8.append("DER Bit String["); sb8.append(c15367gog.b().length); sb8.append(", "); sb8.append(c15367gog.a()); sb8.append("] "); stringBuffer.append(sb8.toString()); if (z) { stringBuffer.append(b(str, c15367gog.b())); return; } else { stringBuffer.append(b); return; } } if (abstractC15315gnE instanceof C15376gop) { StringBuilder sb9 = new StringBuilder(); sb9.append(str); sb9.append("IA5String("); sb9.append(((C15376gop) abstractC15315gnE).j()); sb9.append(") "); sb9.append(b); stringBuffer.append(sb9.toString()); return; } if (abstractC15315gnE instanceof goD) { StringBuilder sb10 = new StringBuilder(); sb10.append(str); sb10.append("UTF8String("); sb10.append(((goD) abstractC15315gnE).j()); sb10.append(") "); sb10.append(b); stringBuffer.append(sb10.toString()); return; } if (abstractC15315gnE instanceof goA) { StringBuilder sb11 = new StringBuilder(); sb11.append(str); sb11.append("PrintableString("); sb11.append(((goA) abstractC15315gnE).j()); sb11.append(") "); sb11.append(b); stringBuffer.append(sb11.toString()); return; } if (abstractC15315gnE instanceof C15357goM) { StringBuilder sb12 = new StringBuilder(); sb12.append(str); sb12.append("VisibleString("); sb12.append(((C15357goM) abstractC15315gnE).j()); sb12.append(") "); sb12.append(b); stringBuffer.append(sb12.toString()); return; } if (abstractC15315gnE instanceof C15372gol) { StringBuilder sb13 = new StringBuilder(); sb13.append(str); sb13.append("BMPString("); sb13.append(((C15372gol) abstractC15315gnE).j()); sb13.append(") "); sb13.append(b); stringBuffer.append(sb13.toString()); return; } if (abstractC15315gnE instanceof C15353goE) { StringBuilder sb14 = new StringBuilder(); sb14.append(str); sb14.append("T61String("); sb14.append(((C15353goE) abstractC15315gnE).j()); sb14.append(") "); sb14.append(b); stringBuffer.append(sb14.toString()); return; } if (abstractC15315gnE instanceof C15374gon) { StringBuilder sb15 = new StringBuilder(); sb15.append(str); sb15.append("GraphicString("); sb15.append(((C15374gon) abstractC15315gnE).j()); sb15.append(") "); sb15.append(b); stringBuffer.append(sb15.toString()); return; } if (abstractC15315gnE instanceof goC) { StringBuilder sb16 = new StringBuilder(); sb16.append(str); sb16.append("VideotexString("); sb16.append(((goC) abstractC15315gnE).j()); sb16.append(") "); sb16.append(b); stringBuffer.append(sb16.toString()); return; } if (abstractC15315gnE instanceof C15320gnN) { StringBuilder sb17 = new StringBuilder(); sb17.append(str); sb17.append("UTCTime("); sb17.append(((C15320gnN) abstractC15315gnE).b()); sb17.append(") "); sb17.append(b); stringBuffer.append(sb17.toString()); return; } if (abstractC15315gnE instanceof C15349gny) { StringBuilder sb18 = new StringBuilder(); sb18.append(str); sb18.append("GeneralizedTime("); sb18.append(((C15349gny) abstractC15315gnE).a()); sb18.append(") "); sb18.append(b); stringBuffer.append(sb18.toString()); return; } if (abstractC15315gnE instanceof gnO) { stringBuffer.append(a(ASN1Encoding.BER, str, z, abstractC15315gnE, b)); return; } if (abstractC15315gnE instanceof C15368goh) { stringBuffer.append(a(ASN1Encoding.DER, str, z, abstractC15315gnE, b)); return; } if (abstractC15315gnE instanceof C15350gnz) { StringBuilder sb19 = new StringBuilder(); sb19.append(str); sb19.append("DER Enumerated("); sb19.append(new BigInteger(((C15350gnz) abstractC15315gnE).a)); sb19.append(")"); sb19.append(b); stringBuffer.append(sb19.toString()); return; } if (abstractC15315gnE instanceof C15371gok) { C15371gok c15371gok = (C15371gok) abstractC15315gnE; StringBuilder sb20 = new StringBuilder(); sb20.append(str); sb20.append("External "); sb20.append(b); stringBuffer.append(sb20.toString()); StringBuilder sb21 = new StringBuilder(); sb21.append(str); sb21.append(" "); str = sb21.toString(); if (c15371gok.e != null) { StringBuilder sb22 = new StringBuilder(); sb22.append(str); sb22.append("Direct Reference: "); sb22.append(c15371gok.e.d); sb22.append(b); stringBuffer.append(sb22.toString()); } if (c15371gok.a != null) { StringBuilder sb23 = new StringBuilder(); sb23.append(str); sb23.append("Indirect Reference: "); sb23.append(c15371gok.a.toString()); sb23.append(b); stringBuffer.append(sb23.toString()); } if (c15371gok.c != null) { b(str, z, c15371gok.c, stringBuffer); } StringBuilder sb24 = new StringBuilder(); sb24.append(str); sb24.append("Encoding: "); sb24.append(c15371gok.d); sb24.append(b); stringBuffer.append(sb24.toString()); abstractC15315gnE = c15371gok.b; } else { StringBuilder sb25 = new StringBuilder(); sb25.append(str); sb25.append(abstractC15315gnE.toString()); sb25.append(b); stringBuffer.append(sb25.toString()); return; } } else { Enumeration elements = ((AbstractC15318gnI) abstractC15315gnE).d.elements(); StringBuilder sb26 = new StringBuilder(); sb26.append(str); sb26.append(" "); String obj3 = sb26.toString(); stringBuffer.append(str); if (abstractC15315gnE instanceof C15364god) { stringBuffer.append("BER Set"); } else { stringBuffer.append("DER Set"); } stringBuffer.append(b); while (elements.hasMoreElements()) { Object nextElement2 = elements.nextElement(); if (nextElement2 == null) { stringBuffer.append(obj3); stringBuffer.append("NULL"); stringBuffer.append(b); } else if (nextElement2 instanceof AbstractC15315gnE) { b(obj3, z, (AbstractC15315gnE) nextElement2, stringBuffer); } else { b(obj3, z, ((InterfaceC15342gnr) nextElement2).i(), stringBuffer); } } return; } } } private static String b(String str, byte[] bArr) { String b = grR.b(); StringBuffer stringBuffer = new StringBuffer(); StringBuilder sb = new StringBuilder(); sb.append(str); sb.append(" "); String obj = sb.toString(); stringBuffer.append(b); for (int i = 0; i < bArr.length; i += 32) { if (bArr.length - i > 32) { stringBuffer.append(obj); stringBuffer.append(new String(grS.e(bArr, i, 32))); stringBuffer.append(" "); stringBuffer.append(e(bArr, i, 32)); stringBuffer.append(b); } else { stringBuffer.append(obj); stringBuffer.append(new String(grS.e(bArr, i, bArr.length - i))); for (int length = bArr.length - i; length != 32; length++) { stringBuffer.append(" "); } stringBuffer.append(" "); stringBuffer.append(e(bArr, i, bArr.length - i)); stringBuffer.append(b); } } return stringBuffer.toString(); } private static String e(byte[] bArr, int i, int i2) { StringBuffer stringBuffer = new StringBuffer(); for (int i3 = i; i3 != i + i2; i3++) { byte b = bArr[i3]; if (b >= 32 && b <= 126) { stringBuffer.append((char) b); } } return stringBuffer.toString(); } public static String d(Object obj) { StringBuffer stringBuffer = new StringBuffer(); if (obj instanceof AbstractC15315gnE) { b("", false, (AbstractC15315gnE) obj, stringBuffer); } else if (obj instanceof InterfaceC15342gnr) { b("", false, ((InterfaceC15342gnr) obj).i(), stringBuffer); } else { StringBuilder sb = new StringBuilder("unknown object type "); sb.append(obj.toString()); return sb.toString(); } return stringBuffer.toString(); } private static String a(String str, String str2, boolean z, AbstractC15315gnE abstractC15315gnE, String str3) { int i; if (abstractC15315gnE == null || (abstractC15315gnE instanceof AbstractC15336gnl)) { AbstractC15336gnl abstractC15336gnl = (AbstractC15336gnl) abstractC15315gnE; StringBuffer stringBuffer = new StringBuffer(); if (!abstractC15336gnl.d()) { StringBuilder sb = new StringBuilder(); sb.append(str2); sb.append(str); sb.append(" ApplicationSpecific["); sb.append(abstractC15336gnl.b()); sb.append("] ("); sb.append(new String(grS.c(abstractC15336gnl.e()))); sb.append(")"); sb.append(str3); return sb.toString(); } try { byte[] l = abstractC15336gnl.l(); if ((l[0] & Ascii.US) == 31) { byte b = l[1]; int i2 = b & UnsignedBytes.MAX_VALUE; if ((b & Ascii.DEL) == 0) { throw new ASN1ParsingException("corrupted stream - invalid high tag number found"); } i = 2; while (i2 >= 0 && (i2 & 128) != 0) { i2 = l[i] & UnsignedBytes.MAX_VALUE; i++; } } else { i = 1; } int length = l.length - i; byte[] bArr = new byte[length + 1]; System.arraycopy(l, i, bArr, 1, length); bArr[0] = 16; if ((l[0] & 32) != 0) { bArr[0] = (byte) (16 | 32); } AbstractC15317gnH a = AbstractC15317gnH.a(new C15348gnx(bArr).b()); StringBuilder sb2 = new StringBuilder(); sb2.append(str2); sb2.append(str); sb2.append(" ApplicationSpecific["); sb2.append(abstractC15336gnl.b()); sb2.append("]"); sb2.append(str3); stringBuffer.append(sb2.toString()); Enumeration b2 = a.b(); while (b2.hasMoreElements()) { StringBuilder sb3 = new StringBuilder(); sb3.append(str2); sb3.append(" "); b(sb3.toString(), z, (AbstractC15315gnE) b2.nextElement(), stringBuffer); } } catch (IOException e) { stringBuffer.append(e); } return stringBuffer.toString(); } StringBuilder sb4 = new StringBuilder("unknown object in getInstance: "); sb4.append(abstractC15315gnE.getClass().getName()); throw new IllegalArgumentException(sb4.toString()); } }