package scb.yek; import android.util.Base64; import com.google.common.base.Ascii; import java.io.IOException; import java.io.InputStream; import javax.crypto.Cipher; import javax.crypto.spec.GCMParameterSpec; import javax.crypto.spec.SecretKeySpec; import net.sf.scuba.smartcards.ISO7816; import o.Awr; import o.C14957gcv; import o.C17133uFJ; import o.C3614bBe; import o.C4593bdB; import o.TAC; import o.gdP; import org.jmrtd.lds.CVCAFile; /* loaded from: classes6.dex */ public final class FaceTecKey { public static final FaceTecKey a; private static int b; private static byte c; private static char[] d; private static long e; private static long g; private static boolean i; private static boolean j; private static final byte[] h = {94, -37, CVCAFile.CAR_TAG, -43, 47, -8, -47, 46, -6, -5, -7, 8, Ascii.SYN, -31, 5, -18, 15, -19, -9}; private static final int f = 104; public final native String faceTecKeyFromJNI(String str); private FaceTecKey() { } static { c(); e(); a = new FaceTecKey(); byte b2 = (byte) 0; byte b3 = b2; try { Object[] objArr = new Object[1]; k(b2, b3, b3, objArr); e((String) objArr[0]); } catch (UnsatisfiedLinkError e2) { e2.getMessage(); } } public final String d(String str, String str2, String str3) { C14957gcv.e(str, ""); C14957gcv.e(str2, ""); C14957gcv.e(str3, ""); try { byte[] decode = Base64.decode(str, 0); C14957gcv.c(decode, ""); byte[] decode2 = Base64.decode(str2, 0); SecretKeySpec secretKeySpec = new SecretKeySpec(Base64.decode(faceTecKeyFromJNI(str3), 0), "AES"); Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding"); cipher.init(2, secretKeySpec, new GCMParameterSpec(128, decode2)); byte[] doFinal = cipher.doFinal(decode); C14957gcv.c(doFinal, ""); return new String(doFinal, gdP.a); } catch (Exception unused) { return null; } } private static void l(char[] cArr, int i2, Object[] objArr) { C4593bdB c4593bdB = new C4593bdB(); c4593bdB.a = i2; int length = cArr.length; long[] jArr = new long[length]; c4593bdB.e = 0; while (c4593bdB.e < cArr.length) { jArr[c4593bdB.e] = (cArr[c4593bdB.e] ^ (c4593bdB.e * c4593bdB.a)) ^ (g ^ (-6958928035870403642L)); c4593bdB.e++; } char[] cArr2 = new char[length]; c4593bdB.e = 0; while (c4593bdB.e < cArr.length) { cArr2[c4593bdB.e] = (char) jArr[c4593bdB.e]; c4593bdB.e++; } objArr[0] = new String(cArr2); } private static InputStream d(InputStream inputStream, int i2, int i3, byte[] bArr) throws IOException { int length = bArr.length; byte[] bArr2 = new byte[length]; System.arraycopy(bArr, 0, bArr2, 0, length); TAC.c(bArr2, c, e); return new C17133uFJ(inputStream, i3, bArr2, Awr.e(i2)); } private static void m(char[] cArr, byte[] bArr, int[] iArr, int i2, Object[] objArr) { C3614bBe c3614bBe = new C3614bBe(); char[] cArr2 = d; if (cArr2 != null) { int length = cArr2.length; char[] cArr3 = new char[length]; for (int i3 = 0; i3 < length; i3++) { cArr3[i3] = (char) (cArr2[i3] ^ 4465412551090060952L); } cArr2 = cArr3; } int i4 = (int) (4465412551090060952L ^ b); if (i) { c3614bBe.c = bArr.length; char[] cArr4 = new char[c3614bBe.c]; c3614bBe.a = 0; while (c3614bBe.a < c3614bBe.c) { cArr4[c3614bBe.a] = (char) (cArr2[bArr[(c3614bBe.c - 1) - c3614bBe.a] + i2] - i4); c3614bBe.a++; } objArr[0] = new String(cArr4); return; } if (j) { c3614bBe.c = cArr.length; char[] cArr5 = new char[c3614bBe.c]; c3614bBe.a = 0; while (c3614bBe.a < c3614bBe.c) { cArr5[c3614bBe.a] = (char) (cArr2[cArr[(c3614bBe.c - 1) - c3614bBe.a] - i2] - i4); c3614bBe.a++; } objArr[0] = new String(cArr5); return; } c3614bBe.c = iArr.length; char[] cArr6 = new char[c3614bBe.c]; c3614bBe.a = 0; while (c3614bBe.a < c3614bBe.c) { cArr6[c3614bBe.a] = (char) (cArr2[iArr[(c3614bBe.c - 1) - c3614bBe.a] - i2] - i4); c3614bBe.a++; } objArr[0] = new String(cArr6); } /* JADX WARN: Multi-variable type inference failed */ /* JADX WARN: Removed duplicated region for block: B:10:0x0027 */ /* JADX WARN: Removed duplicated region for block: B:7:0x001f */ /* JADX WARN: Type inference failed for: r9v2, types: [int] */ /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:10:0x0027 -> B:4:0x002c). Please report as a decompilation issue!!! */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private static void k(short r7, byte r8, short r9, java.lang.Object[] r10) { /* int r7 = r7 * 5 int r7 = r7 + 6 int r9 = r9 * 4 int r9 = r9 + 98 int r8 = r8 * 5 int r8 = r8 + 4 byte[] r0 = scb.yek.FaceTecKey.h byte[] r1 = new byte[r7] r2 = 0 if (r0 != 0) goto L17 r3 = r9 r5 = r2 r9 = r8 goto L2c L17: r3 = r2 L18: byte r4 = (byte) r9 int r5 = r3 + 1 r1[r3] = r4 if (r5 != r7) goto L27 java.lang.String r7 = new java.lang.String r7.(r1, r2) r10[r2] = r7 return L27: r3 = r0[r8] r6 = r9 r9 = r8 r8 = r6 L2c: int r3 = -r3 int r8 = r8 + r3 int r8 = r8 + (-2) int r9 = r9 + 1 r3 = r5 r6 = r9 r9 = r8 r8 = r6 goto L18 */ throw new UnsupportedOperationException("Method not decompiled: scb.yek.FaceTecKey.k(short, byte, short, java.lang.Object[]):void"); } static void c() { d = new char[]{16266, 16351, 16348, 16335, 16350, 16330, 16328, 16265, 16334, 16349, 16331, 16339, 16329, 16336, 16340, 16338, 16305, 16319, 16316, 16343, 16320, 16299}; b = 1934311035; j = true; i = true; g = 3803928270261801648L; } static void e() { e = -5460580109075031448L; c = ISO7816.INS_PUT_DATA; } /* JADX WARN: Removed duplicated region for block: B:130:0x0524 A[EXC_TOP_SPLITTER, SYNTHETIC] */ /* JADX WARN: Removed duplicated region for block: B:41:0x0331 A[EXC_TOP_SPLITTER, SYNTHETIC] */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private static void e(java.lang.String r16) { /* Method dump skipped, instructions count: 1734 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: scb.yek.FaceTecKey.e(java.lang.String):void"); } }