package com.facetec.sdk; import android.media.AudioTrack; import android.os.Process; import android.os.SystemClock; import android.text.TextUtils; import android.view.View; import android.view.ViewConfiguration; import android.widget.ExpandableListView; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import java.lang.reflect.Method; import java.util.Arrays; import javax.crypto.Cipher; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; import net.sf.scuba.smartcards.ISO7816; import org.bouncycastle.crypto.tls.CipherSuite; import org.bouncycastle.i18n.LocalizedMessage; /* loaded from: classes.dex */ final class aa extends am { private static final byte[] $$a = null; private static final int $$b = 0; private static int $10; private static int $11; private static int c; private static int d; private static char[] e; private final SecretKeySpec b; /* JADX WARN: Removed duplicated region for block: B:10:0x0029 */ /* JADX WARN: Removed duplicated region for block: B:7:0x0021 */ /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:10:0x0029 -> B:4:0x002f). 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 g(int r7, short r8, int r9, java.lang.Object[] r10) { /* int r8 = r8 << 2 int r8 = 3 - r8 int r7 = 104 - r7 int r9 = r9 << 2 int r9 = 1 - r9 byte[] r0 = com.facetec.sdk.aa.$$a byte[] r1 = new byte[r9] r2 = 0 if (r0 != 0) goto L14 r3 = r8 r4 = r2 goto L2f L14: r3 = r2 L15: r6 = r8 r8 = r7 r7 = r6 int r4 = r3 + 1 byte r5 = (byte) r8 r1[r3] = r5 int r7 = r7 + 1 if (r4 != r9) goto L29 java.lang.String r7 = new java.lang.String r7.(r1, r2) r10[r2] = r7 return L29: r3 = r0[r7] r6 = r8 r8 = r7 r7 = r3 r3 = r6 L2f: int r7 = -r7 int r7 = r7 + r3 r3 = r4 goto L15 */ throw new UnsupportedOperationException("Method not decompiled: com.facetec.sdk.aa.g(int, short, int, java.lang.Object[]):void"); } /* JADX INFO: Access modifiers changed from: package-private */ public aa(byte[] bArr) throws Exception { Object[] objArr = new Object[1]; f(false, new int[]{0, 3, CipherSuite.TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256, 3}, "\u0001\u0000\u0000", objArr); this.b = new SecretKeySpec(bArr, ((String) objArr[0]).intern()); } public final byte[] c(byte[] bArr) { try { byte[] c2 = c(); IvParameterSpec ivParameterSpec = new IvParameterSpec(c2); Object[] objArr = new Object[1]; f(false, new int[]{3, 20, CipherSuite.TLS_RSA_WITH_AES_128_GCM_SHA256, 6}, "\u0001\u0001\u0000\u0001\u0001\u0001\u0000\u0000\u0000\u0000\u0000\u0001\u0001\u0000\u0001\u0001\u0000\u0000\u0000\u0001", objArr); Cipher cipher = Cipher.getInstance(((String) objArr[0]).intern()); cipher.init(1, this.b, ivParameterSpec); byte[] b = b(cipher, bArr); byte[] bArr2 = new byte[b.length + c2.length]; System.arraycopy(c2, 0, bArr2, 0, c2.length); System.arraycopy(b, 0, bArr2, c2.length, b.length); int i = c + 101; d = i % 128; if (i % 2 != 0) { return bArr2; } throw null; } catch (Exception unused) { return null; } } public final byte[] e(byte[] bArr) throws Exception { byte[] copyOfRange = Arrays.copyOfRange(bArr, 0, 16); byte[] copyOfRange2 = Arrays.copyOfRange(bArr, 16, bArr.length); IvParameterSpec ivParameterSpec = new IvParameterSpec(copyOfRange); Object[] objArr = new Object[1]; f(false, new int[]{3, 20, CipherSuite.TLS_RSA_WITH_AES_128_GCM_SHA256, 6}, "\u0001\u0001\u0000\u0001\u0001\u0001\u0000\u0000\u0000\u0000\u0000\u0001\u0001\u0000\u0001\u0001\u0000\u0000\u0000\u0001", objArr); Cipher cipher = Cipher.getInstance(((String) objArr[0]).intern()); cipher.init(2, this.b, ivParameterSpec); byte[] d2 = d(cipher, copyOfRange2); d = (c + 53) % 128; return d2; } private static void f(boolean z, int[] iArr, String str, Object[] objArr) { int i; char[] cArr; byte b; char[] cArr2; char c2; int i2; int i3; String str2 = str; byte[] bArr = str2; if (str2 != null) { bArr = str2.getBytes(LocalizedMessage.DEFAULT_ENCODING); } byte[] bArr2 = bArr; gp gpVar = new gp(); int i4 = 0; int i5 = iArr[0]; int i6 = 1; int i7 = iArr[1]; int i8 = 2; int i9 = iArr[2]; int i10 = iArr[3]; char[] cArr3 = e; if (cArr3 != null) { int length = cArr3.length; char[] cArr4 = new char[length]; int i11 = 0; while (i11 < length) { int i12 = $11 + 55; $10 = i12 % 128; if (i12 % i8 != 0) { try { Object[] objArr2 = new Object[i6]; objArr2[i4] = Integer.valueOf(cArr3[i11]); Object obj = bo.s.get(-344240863); if (obj == null) { Class cls = (Class) bo.e(TextUtils.indexOf((CharSequence) "", '0', i4, i4) + 989, (char) View.MeasureSpec.getSize(i4), 33 - (SystemClock.currentThreadTimeMillis() > (-1L) ? 1 : (SystemClock.currentThreadTimeMillis() == (-1L) ? 0 : -1))); byte length2 = (byte) $$a.length; byte b2 = (byte) (length2 - 4); i2 = i9; i3 = length; Object[] objArr3 = new Object[1]; g(length2, b2, b2, objArr3); obj = cls.getMethod((String) objArr3[0], Integer.TYPE); bo.s.put(-344240863, obj); } else { i2 = i9; i3 = length; } cArr4[i11] = ((Character) ((Method) obj).invoke(null, objArr2)).charValue(); } catch (Throwable th) { Throwable cause = th.getCause(); if (cause == null) { throw th; } throw cause; } } else { i2 = i9; i3 = length; try { Object[] objArr4 = {Integer.valueOf(cArr3[i11])}; Object obj2 = bo.s.get(-344240863); if (obj2 == null) { Class cls2 = (Class) bo.e(989 - (SystemClock.currentThreadTimeMillis() > (-1L) ? 1 : (SystemClock.currentThreadTimeMillis() == (-1L) ? 0 : -1)), (char) (Process.myTid() >> 22), (SystemClock.uptimeMillis() > 0L ? 1 : (SystemClock.uptimeMillis() == 0L ? 0 : -1)) + 31); byte length3 = (byte) $$a.length; byte b3 = (byte) (length3 - 4); Object[] objArr5 = new Object[1]; g(length3, b3, b3, objArr5); obj2 = cls2.getMethod((String) objArr5[0], Integer.TYPE); bo.s.put(-344240863, obj2); } cArr4[i11] = ((Character) ((Method) obj2).invoke(null, objArr4)).charValue(); i11++; } catch (Throwable th2) { Throwable cause2 = th2.getCause(); if (cause2 == null) { throw th2; } throw cause2; } } length = i3; i9 = i2; i4 = 0; i6 = 1; i8 = 2; } i = i9; cArr3 = cArr4; } else { i = i9; } char[] cArr5 = new char[i7]; System.arraycopy(cArr3, i5, cArr5, 0, i7); if (bArr2 != null) { int i13 = $10 + 51; $11 = i13 % 128; if (i13 % 2 == 0) { cArr2 = new char[i7]; b = 1; gpVar.a = 1; c2 = 1; } else { b = 1; cArr2 = new char[i7]; gpVar.a = 0; c2 = 0; } while (gpVar.a < i7) { if (bArr2[gpVar.a] == b) { $10 = ($11 + 81) % 128; int i14 = gpVar.a; try { Object[] objArr6 = {Integer.valueOf(cArr5[gpVar.a]), Integer.valueOf(c2)}; Object obj3 = bo.s.get(69282466); if (obj3 == null) { Class cls3 = (Class) bo.e(1569 - TextUtils.lastIndexOf("", '0', 0, 0), (char) (11060 - ExpandableListView.getPackedPositionGroup(0L)), 23 - TextUtils.getOffsetAfter("", 0)); Object[] objArr7 = new Object[1]; g(7, (short) 0, 0, objArr7); obj3 = cls3.getMethod((String) objArr7[0], Integer.TYPE, Integer.TYPE); bo.s.put(69282466, obj3); } cArr2[i14] = ((Character) ((Method) obj3).invoke(null, objArr6)).charValue(); } catch (Throwable th3) { Throwable cause3 = th3.getCause(); if (cause3 == null) { throw th3; } throw cause3; } } else { int i15 = gpVar.a; try { Object[] objArr8 = {Integer.valueOf(cArr5[gpVar.a]), Integer.valueOf(c2)}; Object obj4 = bo.s.get(-1063034112); if (obj4 == null) { obj4 = ((Class) bo.e(1876 - TextUtils.indexOf((CharSequence) "", '0', 0), (char) (23952 - View.MeasureSpec.getMode(0)), 24 - (AudioTrack.getMaxVolume() > BitmapDescriptorFactory.HUE_RED ? 1 : (AudioTrack.getMaxVolume() == BitmapDescriptorFactory.HUE_RED ? 0 : -1)))).getMethod("g", Integer.TYPE, Integer.TYPE); bo.s.put(-1063034112, obj4); } cArr2[i15] = ((Character) ((Method) obj4).invoke(null, objArr8)).charValue(); } catch (Throwable th4) { Throwable cause4 = th4.getCause(); if (cause4 == null) { throw th4; } throw cause4; } } c2 = cArr2[gpVar.a]; try { Object[] objArr9 = {gpVar, gpVar}; Object obj5 = bo.s.get(1322201006); if (obj5 == null) { Class cls4 = (Class) bo.e(TextUtils.indexOf((CharSequence) "", '0') + 735, (char) (ViewConfiguration.getTapTimeout() >> 16), 33 - (ViewConfiguration.getScrollFriction() > BitmapDescriptorFactory.HUE_RED ? 1 : (ViewConfiguration.getScrollFriction() == BitmapDescriptorFactory.HUE_RED ? 0 : -1))); Object[] objArr10 = new Object[1]; g(0, (short) 0, 0, objArr10); obj5 = cls4.getMethod((String) objArr10[0], Object.class, Object.class); bo.s.put(1322201006, obj5); } ((Method) obj5).invoke(null, objArr9); b = 1; } catch (Throwable th5) { Throwable cause5 = th5.getCause(); if (cause5 == null) { throw th5; } throw cause5; } } cArr5 = cArr2; } if (i10 > 0) { char[] cArr6 = new char[i7]; System.arraycopy(cArr5, 0, cArr6, 0, i7); int i16 = i7 - i10; System.arraycopy(cArr6, 0, cArr5, i16, i10); System.arraycopy(cArr6, i10, cArr5, 0, i16); } int i17 = 1; if (!(!z)) { int i18 = $11 + 21; $10 = i18 % 128; if (i18 % 2 != 0) { cArr = new char[i7]; gpVar.a = 1; } else { cArr = new char[i7]; gpVar.a = 0; } while (gpVar.a < i7) { cArr[gpVar.a] = cArr5[(i7 - gpVar.a) - i17]; gpVar.a += i17; i17 = 1; } cArr5 = cArr; } if (i > 0) { int i19 = 0; while (true) { gpVar.a = i19; if (gpVar.a >= i7) { break; } cArr5[gpVar.a] = (char) (cArr5[gpVar.a] - iArr[2]); i19 = gpVar.a + 1; } } String str3 = new String(cArr5); int i20 = $11 + 59; $10 = i20 % 128; if (i20 % 2 != 0) { throw new ArithmeticException(); } objArr[0] = str3; } static void init$0() { $$a = new byte[]{10, 71, -124, ISO7816.INS_DELETE_FILE}; $$b = 243; } static void a() { e = new char[]{38838, 38450, 38457, 38729, 38857, 38455, 38453, 38448, 38449, 38855, 38888, 38879, 38890, 38882, 38889, 38889, 38882, 38892, 38878, 38868, 38864, 38871, 38889}; } static { init$0(); $10 = 0; $11 = 1; c = 0; d = 1; a(); int i = d + 93; c = i % 128; if (i % 2 != 0) { throw null; } } }