what-the-bank/sources/scb/yek/DebitKey.java

620 lines
23 KiB
Java

package scb.yek;
import android.graphics.Color;
import android.graphics.ImageFormat;
import android.graphics.drawable.Drawable;
import android.media.AudioTrack;
import android.text.TextUtils;
import android.util.Base64;
import android.util.TypedValue;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewConfiguration;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.common.base.Ascii;
import com.kofax.mobile.sdk._internal.impl.extraction.kta.KtaJsonExactionHelper;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.security.KeyFactory;
import java.security.PrivateKey;
import java.security.interfaces.RSAPrivateKey;
import java.security.spec.PKCS8EncodedKeySpec;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import javax.crypto.Cipher;
import net.sf.scuba.smartcards.ISO7816;
import o.Awr;
import o.C13396fZU;
import o.C14856gaP;
import o.C14881gav;
import o.C14957gcv;
import o.C15022geq;
import o.C17133uFJ;
import o.GuL;
import o.Nhs;
import o.TAC;
import o.gdN;
import o.gdZ;
import o.xzZ;
import o.zUI;
import org.bouncycastle.crypto.tls.CipherSuite;
/* loaded from: classes6.dex */
public final class DebitKey {
public static final DebitKey a;
private static final Map<String, String> b;
private static long c;
private static long d;
private static byte e;
private static int f;
private static char g;
private static long h;
private static int j;
private static int m;
private static final byte[] $$a = {124, -126, ISO7816.INS_MSE, 69};
private static final int $$b = CipherSuite.TLS_RSA_PSK_WITH_AES_128_CBC_SHA256;
private static int $10 = 0;
private static int $11 = 1;
/* renamed from: o, reason: collision with root package name */
private static final byte[] f9339o = {10, Ascii.SYN, ISO7816.INS_READ_RECORD2, -2, 47, -8, -47, 46, -6, -5, -7, 8, Ascii.SYN, -31, 5, -18, 15, -19, -9};
private static final int l = CipherSuite.TLS_DHE_PSK_WITH_AES_256_CBC_SHA384;
private static int i = 0;
/* JADX WARN: Removed duplicated region for block: B:10:0x0024 */
/* JADX WARN: Removed duplicated region for block: B:7:0x001c */
/* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:10:0x0024 -> 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 r(int r6, int r7, int r8, java.lang.Object[] r9) {
/*
byte[] r0 = scb.yek.DebitKey.$$a
int r6 = r6 * 7
int r6 = 76 - r6
int r8 = r8 * 4
int r1 = r8 + 1
int r7 = r7 * 3
int r7 = 4 - r7
byte[] r1 = new byte[r1]
r2 = 0
if (r0 != 0) goto L16
r3 = r7
r4 = r2
goto L2c
L16:
r3 = r2
L17:
byte r4 = (byte) r6
r1[r3] = r4
if (r3 != r8) goto L24
java.lang.String r6 = new java.lang.String
r6.<init>(r1, r2)
r9[r2] = r6
return
L24:
int r3 = r3 + 1
r4 = r0[r7]
r5 = r3
r3 = r7
r7 = r4
r4 = r5
L2c:
int r7 = -r7
int r6 = r6 + r7
int r7 = r3 + 1
r3 = r4
goto L17
*/
throw new UnsupportedOperationException("Method not decompiled: scb.yek.DebitKey.r(int, int, int, java.lang.Object[]):void");
}
public final native String debitKeyFromJNI(String str);
public final native String debitSecKeyFromJNI(String str);
private DebitKey() {
}
static {
m = 1;
c();
b();
d();
a = new DebitKey();
byte b2 = (byte) 0;
byte b3 = b2;
Object[] objArr = new Object[1];
k(b2, b3, (byte) (b3 + 1), objArr);
b((String) objArr[0]);
Object[] objArr2 = new Object[1];
n(1 - KeyEvent.keyCodeFromString(""), 1 - Color.green(0), TextUtils.indexOf("", "") + 101, new char[]{0}, true, objArr2);
C13396fZU c13396fZU = new C13396fZU(((String) objArr2[0]).intern(), "s");
Object[] objArr3 = new Object[1];
n(1 - Drawable.resolveOpacity(0, 0), -ImageFormat.getBitsPerPixel(0), 102 - (AudioTrack.getMinVolume() > BitmapDescriptorFactory.HUE_RED ? 1 : (AudioTrack.getMinVolume() == BitmapDescriptorFactory.HUE_RED ? 0 : -1)), new char[]{0}, false, objArr3);
C13396fZU c13396fZU2 = new C13396fZU(((String) objArr3[0]).intern(), "c");
Object[] objArr4 = new Object[1];
n(KeyEvent.getDeadChar(0, 0) + 1, 1 - (TypedValue.complexToFraction(0, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED) > BitmapDescriptorFactory.HUE_RED ? 1 : (TypedValue.complexToFraction(0, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED) == BitmapDescriptorFactory.HUE_RED ? 0 : -1)), Color.alpha(0) + 103, new char[]{0}, true, objArr4);
C13396fZU[] c13396fZUArr = {c13396fZU, c13396fZU2, new C13396fZU(((String) objArr4[0]).intern(), "b"), new C13396fZU("3", "t"), new C13396fZU("4", "e"), new C13396fZU("5", KtaJsonExactionHelper.OBJECT), new C13396fZU("6", "h"), new C13396fZU("7", "x"), new C13396fZU("8", "l")};
C14957gcv.e(c13396fZUArr, "");
LinkedHashMap linkedHashMap = new LinkedHashMap(C14856gaP.a(9));
C14856gaP.e(linkedHashMap, c13396fZUArr);
b = linkedHashMap;
int i2 = i + 123;
m = i2 % 128;
if (i2 % 2 == 0) {
int i3 = 13 / 0;
}
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ Object c(Object[] objArr) {
DebitKey debitKey = (DebitKey) objArr[0];
boolean booleanValue = ((Boolean) objArr[1]).booleanValue();
String str = (String) objArr[2];
int i2 = 2 % 2;
int i3 = m + 89;
i = i3 % 128;
int i4 = i3 % 2;
try {
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
C14957gcv.c(keyFactory, "");
if (booleanValue) {
String d2 = AESUtil.d.d(debitKey.debitSecKeyFromJNI(str));
C14957gcv.e(d2, "");
byte[] decode = Base64.decode(d2, 0);
C14957gcv.c(decode, "");
PrivateKey generatePrivate = keyFactory.generatePrivate(new PKCS8EncodedKeySpec(decode));
if (generatePrivate == null) {
throw new NullPointerException("null cannot be cast to non-null type java.security.interfaces.RSAPrivateKey");
}
int i5 = i + 63;
m = i5 % 128;
int i6 = i5 % 2;
return (RSAPrivateKey) generatePrivate;
}
String d3 = AESUtil.d.d(debitKey.debitKeyFromJNI(str));
C14957gcv.e(d3, "");
byte[] decode2 = Base64.decode(d3, 0);
C14957gcv.c(decode2, "");
PrivateKey generatePrivate2 = keyFactory.generatePrivate(new PKCS8EncodedKeySpec(decode2));
if (generatePrivate2 != null) {
return (RSAPrivateKey) generatePrivate2;
}
throw new NullPointerException("null cannot be cast to non-null type java.security.interfaces.RSAPrivateKey");
} catch (Exception unused) {
return null;
}
}
public final Cipher b(boolean z, String str) {
int i2 = 2 % 2;
C14957gcv.e(str, "");
Object[] objArr = {this, Boolean.valueOf(z), str};
System.identityHashCode(this);
RSAPrivateKey rSAPrivateKey = (RSAPrivateKey) c(objArr);
if (rSAPrivateKey == null) {
int i3 = i + 61;
m = i3 % 128;
int i4 = i3 % 2;
return null;
}
int i5 = i + 91;
m = i5 % 128;
int i6 = i5 % 2;
Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
cipher.init(2, rSAPrivateKey);
return cipher;
}
private static void q(char[] cArr, int i2, Object[] objArr) {
int i3 = 2 % 2;
GuL guL = new GuL();
char[] a2 = GuL.a(d ^ (-7538262848231253921L), cArr, i2);
guL.a = 4;
while (guL.a < a2.length) {
int i4 = m + 83;
i = i4 % 128;
int i5 = i4 % 2;
guL.c = guL.a - 4;
a2[guL.a] = (char) ((a2[guL.a] ^ a2[guL.a % 4]) ^ (guL.c * (d ^ (-7538262848231253921L))));
guL.a++;
int i6 = m + 35;
i = i6 % 128;
int i7 = i6 % 2;
}
objArr[0] = new String(a2, 4, a2.length - 4);
}
public static String a(String str) {
String str2;
int i2 = 2 % 2;
C14957gcv.e(str, "");
try {
String str3 = str;
C14957gcv.e(str3, "");
C14957gcv.e(str3, "");
List e2 = gdZ.e(str3, 3, 3, C15022geq.RVV.e);
C14957gcv.e(e2, "");
ArrayList arrayList = new ArrayList(e2.size());
Iterator it = e2.iterator();
while (it.hasNext()) {
int i3 = i + 3;
m = i3 % 128;
int i4 = i3 % 2;
arrayList.add(gdZ.e((String) it.next(), 2));
int i5 = i + 75;
m = i5 % 128;
int i6 = i5 % 2;
}
String b2 = C14881gav.b(arrayList, "", null, null, 0, null, null, 62);
Object[] objArr = new Object[1];
n(TextUtils.getOffsetAfter("", 0) + 1, (ViewConfiguration.getKeyRepeatDelay() >> 16) + 1, ImageFormat.getBitsPerPixel(0) + 103, new char[]{0}, false, objArr);
str2 = gdZ.a(b2, ((String) objArr[0]).intern(), "9");
for (Map.Entry<String, String> entry : b.entrySet()) {
str2 = gdZ.a(str2, entry.getValue(), entry.getKey());
}
} catch (Exception unused) {
str2 = null;
}
int i7 = m + 69;
i = i7 % 128;
if (i7 % 2 == 0) {
return str2;
}
throw null;
}
public static String c(String str, String str2) {
String str3;
char[] charArray;
String str4;
int i2 = 2 % 2;
C14957gcv.e(str, "");
C14957gcv.e(str2, "");
StringBuilder sb = new StringBuilder();
try {
String substring = str.substring(12, 15);
C14957gcv.c((Object) substring, "");
charArray = substring.toCharArray();
C14957gcv.c(charArray, "");
str4 = str;
C14957gcv.e(str4, "");
} catch (Exception unused) {
str3 = null;
}
if (str4.length() == 0) {
throw new NoSuchElementException("Char sequence is empty.");
}
int i3 = i + 43;
m = i3 % 128;
int i4 = i3 % 2;
C14957gcv.e(str4, "");
int length = str2.length() - (Character.getNumericValue(str4.charAt(str4.length() - 1)) + 10);
String substring2 = str2.substring(length);
C14957gcv.c((Object) substring2, "");
int i5 = 0;
String substring3 = str2.substring(0, length);
C14957gcv.c((Object) substring3, "");
StringBuilder sb2 = new StringBuilder();
sb2.append(substring2);
sb2.append(substring3);
char[] charArray2 = c(sb2.toString()).toCharArray();
C14957gcv.c(charArray2, "");
int length2 = charArray2.length;
int i6 = 0;
while (i5 < length2) {
int i7 = m + 109;
i = i7 % 128;
if (i7 % 2 != 0) {
sb.append(((Character.getNumericValue(charArray2[i5]) >> 50) / Character.getNumericValue(charArray[i6])) * 58);
i5 += 11;
i6 += 61;
} else {
sb.append(((Character.getNumericValue(charArray2[i5]) + 10) - Character.getNumericValue(charArray[i6])) % 10);
i5++;
i6++;
}
}
str3 = sb.toString();
int i8 = i + 107;
m = i8 % 128;
if (i8 % 2 != 0) {
return str3;
}
throw null;
}
private static InputStream d(InputStream inputStream, int i2, int i3, byte[] bArr) throws IOException {
int i4 = 2 % 2;
int length = bArr.length;
byte[] bArr2 = new byte[length];
System.arraycopy(bArr, 0, bArr2, 0, length);
TAC.c(bArr2, e, c);
C17133uFJ c17133uFJ = new C17133uFJ(inputStream, i3, bArr2, Awr.e(i2));
int i5 = i + 125;
m = i5 % 128;
if (i5 % 2 != 0) {
return c17133uFJ;
}
Object obj = null;
obj.hashCode();
throw null;
}
private static String c(String str) {
int i2 = 2 % 2;
int i3 = m + 119;
i = i3 % 128;
int i4 = i3 % 2;
if (str.length() % 8 != 0) {
StringBuilder sb = new StringBuilder("Cannot convert binary string to byte[], because of the input length. '");
sb.append(str);
sb.append("' % 8 != 0");
System.out.println((Object) sb.toString());
return "";
}
byte[] bArr = new byte[str.length() / 8];
StringBuilder sb2 = new StringBuilder(str);
int i5 = 0;
int i6 = 0;
while (i5 < sb2.length()) {
int i7 = i5 + 8;
int length = sb2.length();
if (i7 > length) {
int i8 = m + 105;
i = i8 % 128;
int i9 = i8 % 2;
} else {
length = i7;
}
String substring = sb2.substring(i5, length);
C14957gcv.c((Object) substring, "");
bArr[i6] = (byte) Integer.parseInt(substring, gdN.b(2));
i6++;
int i10 = m + 1;
i = i10 % 128;
int i11 = i10 % 2;
i5 = i7;
}
Charset charset = StandardCharsets.UTF_8;
C14957gcv.c(charset, "");
return new String(bArr, charset);
}
private static void p(char c2, int i2, char[] cArr, char[] cArr2, char[] cArr3, Object[] objArr) {
int i3 = 2 % 2;
Nhs nhs = new Nhs();
int length = cArr.length;
char[] cArr4 = new char[length];
int length2 = cArr3.length;
char[] cArr5 = new char[length2];
System.arraycopy(cArr, 0, cArr4, 0, length);
System.arraycopy(cArr3, 0, cArr5, 0, length2);
cArr4[0] = (char) (cArr4[0] ^ c2);
cArr5[2] = (char) (cArr5[2] + ((char) i2));
int length3 = cArr2.length;
char[] cArr6 = new char[length3];
nhs.a = 0;
int i4 = i + 69;
m = i4 % 128;
int i5 = i4 % 2;
while (nhs.a < length3) {
int i6 = i + 39;
m = i6 % 128;
int i7 = i6 % 2;
int i8 = (nhs.a + 2) % 4;
int i9 = (nhs.a + 3) % 4;
nhs.c = (char) (((cArr4[nhs.a % 4] * 32718) + cArr5[i8]) % 65535);
cArr5[i9] = (char) (((cArr4[i9] * 32718) + cArr5[i8]) / 65535);
cArr4[i9] = nhs.c;
cArr6[nhs.a] = (char) ((((cArr4[i9] ^ cArr2[nhs.a]) ^ (h ^ 9051040786702654117L)) ^ ((int) (f ^ 9051040786702654117L))) ^ ((char) (g ^ 9051040786702654117L)));
nhs.a++;
}
objArr[0] = new String(cArr6);
}
private static void n(int i2, int i3, int i4, char[] cArr, boolean z, Object[] objArr) {
int i5 = 2 % 2;
zUI zui = new zUI();
char[] cArr2 = new char[i2];
zui.d = 0;
while (zui.d < i2) {
zui.c = cArr[zui.d];
cArr2[zui.d] = (char) (i4 + zui.c);
int i6 = zui.d;
try {
Object[] objArr2 = {Integer.valueOf(cArr2[i6]), Integer.valueOf(j)};
Object obj = xzZ.y.get(880493502);
if (obj == null) {
Class cls = (Class) xzZ.c((ViewConfiguration.getEdgeSlop() >> 16) + CipherSuite.TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA, 7 - TextUtils.getOffsetBefore("", 0), (char) (1 - (ViewConfiguration.getScrollFriction() > BitmapDescriptorFactory.HUE_RED ? 1 : (ViewConfiguration.getScrollFriction() == BitmapDescriptorFactory.HUE_RED ? 0 : -1))));
byte b2 = (byte) 1;
byte b3 = (byte) (b2 - 1);
Object[] objArr3 = new Object[1];
r(b2, b3, b3, objArr3);
obj = cls.getMethod((String) objArr3[0], Integer.TYPE, Integer.TYPE);
xzZ.y.put(880493502, obj);
}
cArr2[i6] = ((Character) ((Method) obj).invoke(null, objArr2)).charValue();
try {
Object[] objArr4 = {zui, zui};
Object obj2 = xzZ.y.get(1294990079);
if (obj2 == null) {
Class cls2 = (Class) xzZ.c(Drawable.resolveOpacity(0, 0) + 342, (ViewConfiguration.getKeyRepeatDelay() >> 16) + 5, (char) (ViewConfiguration.getDoubleTapTimeout() >> 16));
byte b4 = (byte) 0;
byte b5 = b4;
Object[] objArr5 = new Object[1];
r(b4, b5, b5, objArr5);
obj2 = cls2.getMethod((String) objArr5[0], Object.class, Object.class);
xzZ.y.put(1294990079, obj2);
}
((Method) obj2).invoke(null, objArr4);
} catch (Throwable th) {
Throwable cause = th.getCause();
if (cause == null) {
throw th;
}
throw cause;
}
} catch (Throwable th2) {
Throwable cause2 = th2.getCause();
if (cause2 == null) {
throw th2;
}
throw cause2;
}
}
if (i3 > 0) {
int i7 = $11 + 51;
$10 = i7 % 128;
int i8 = i7 % 2;
zui.a = i3;
char[] cArr3 = new char[i2];
System.arraycopy(cArr2, 0, cArr3, 0, i2);
System.arraycopy(cArr3, 0, cArr2, i2 - zui.a, zui.a);
System.arraycopy(cArr3, zui.a, cArr2, 0, i2 - zui.a);
}
if (z) {
char[] cArr4 = new char[i2];
zui.d = 0;
while (zui.d < i2) {
cArr4[zui.d] = cArr2[(i2 - zui.d) - 1];
try {
Object[] objArr6 = {zui, zui};
Object obj3 = xzZ.y.get(1294990079);
if (obj3 == null) {
Class cls3 = (Class) xzZ.c(TextUtils.indexOf((CharSequence) "", '0', 0, 0) + 343, 5 - View.resolveSize(0, 0), (char) Color.alpha(0));
byte b6 = (byte) 0;
byte b7 = b6;
Object[] objArr7 = new Object[1];
r(b6, b7, b7, objArr7);
obj3 = cls3.getMethod((String) objArr7[0], Object.class, Object.class);
xzZ.y.put(1294990079, obj3);
}
((Method) obj3).invoke(null, objArr6);
int i9 = $11 + 97;
$10 = i9 % 128;
int i10 = i9 % 2;
} catch (Throwable th3) {
Throwable cause3 = th3.getCause();
if (cause3 == null) {
throw th3;
}
throw cause3;
}
}
int i11 = $10 + 15;
$11 = i11 % 128;
int i12 = i11 % 2;
cArr2 = cArr4;
}
objArr[0] = new String(cArr2);
}
/* JADX WARN: Removed duplicated region for block: B:10:0x002c */
/* JADX WARN: Removed duplicated region for block: B:7:0x0024 */
/* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:10:0x002c -> B:4:0x0030). 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(byte r6, byte r7, int r8, java.lang.Object[] r9) {
/*
int r7 = r7 * 5
int r0 = r7 + 6
byte[] r1 = scb.yek.DebitKey.f9339o
int r8 = r8 * 5
int r8 = 8 - r8
int r6 = r6 * 4
int r6 = r6 + 98
byte[] r0 = new byte[r0]
int r7 = r7 + 5
r2 = 0
if (r1 != 0) goto L19
r4 = r7
r6 = r8
r3 = r2
goto L30
L19:
r3 = r2
r5 = r8
r8 = r6
r6 = r5
L1d:
byte r4 = (byte) r8
r0[r3] = r4
int r6 = r6 + 1
if (r3 != r7) goto L2c
java.lang.String r6 = new java.lang.String
r6.<init>(r0, r2)
r9[r2] = r6
return
L2c:
r4 = r1[r6]
int r3 = r3 + 1
L30:
int r4 = -r4
int r8 = r8 + r4
int r8 = r8 + (-2)
goto L1d
*/
throw new UnsupportedOperationException("Method not decompiled: scb.yek.DebitKey.k(byte, byte, int, java.lang.Object[]):void");
}
static void c() {
j = 2015661586;
}
static void b() {
int i2 = 2 % 2;
int i3 = m;
int i4 = i3 + 59;
i = i4 % 128;
int i5 = i4 % 2;
d = -8793288787876061144L;
h = -6568388675308196922L;
f = 452713125;
g = (char) 55973;
int i6 = i3 + 79;
i = i6 % 128;
int i7 = i6 % 2;
}
static void d() {
int i2 = 2 % 2;
int i3 = i + 125;
m = i3 % 128;
int i4 = i3 % 2;
c = -5460580109075031448L;
e = i4 == 0 ? Ascii.ETB : ISO7816.INS_PUT_DATA;
}
/* JADX WARN: Removed duplicated region for block: B:121:0x0639 A[EXC_TOP_SPLITTER, SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:41:0x03e7 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 b(java.lang.String r25) {
/*
Method dump skipped, instructions count: 2274
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: scb.yek.DebitKey.b(java.lang.String):void");
}
private final RSAPrivateKey a(boolean z, String str) {
Object[] objArr = {this, Boolean.valueOf(z), str};
System.identityHashCode(this);
return (RSAPrivateKey) c(objArr);
}
}