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

197 lines
6.2 KiB
Java

package scb.yek;
import android.util.Base64;
import com.google.common.base.Ascii;
import java.io.IOException;
import java.io.InputStream;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import net.sf.scuba.smartcards.ISO7816;
import o.Awr;
import o.C14957gcv;
import o.C17133uFJ;
import o.TAC;
import o.dQY;
import o.gdP;
import o.guE;
import o.guM;
import o.zUI;
import org.bouncycastle.crypto.signers.PSSSigner;
import org.bouncycastle.crypto.tls.CipherSuite;
/* loaded from: classes.dex */
public final class ValidateSignature implements guM {
private static byte a;
private static long b;
private static long c;
private static int d;
private static char[] e;
private static final byte[] f = {38, -26, Ascii.ESC, PSSSigner.TRAILER_IMPLICIT, 47, -8, -47, 46, -6, -5, -7, 8, Ascii.SYN, -31, 5, -18, 15, -19, -9};
private static final int g = CipherSuite.TLS_DH_RSA_WITH_SEED_CBC_SHA;
public final native String secretKeyFromJNI(String str);
/* loaded from: classes.dex */
public static final class RVV {
private RVV() {
}
public /* synthetic */ RVV(byte b) {
this();
}
}
static {
a();
d();
new RVV((byte) 0);
byte b2 = (byte) 1;
byte b3 = (byte) (b2 - 1);
Object[] objArr = new Object[1];
h(b2, b3, (byte) (b3 + 1), objArr);
c((String) objArr[0]);
}
@Override // o.guM
public final String d(String str, byte[] bArr) {
C14957gcv.e(str, "");
C14957gcv.e(bArr, "");
try {
Mac mac = Mac.getInstance("HmacSHA256");
byte[] bytes = str.getBytes(gdP.a);
C14957gcv.c(bytes, "");
mac.init(new SecretKeySpec(bytes, "HmacSHA256"));
byte[] doFinal = mac.doFinal(bArr);
C14957gcv.c(doFinal, "");
String encodeToString = Base64.encodeToString(doFinal, 2);
C14957gcv.c((Object) encodeToString, "");
return encodeToString;
} catch (InvalidKeyException | NoSuchAlgorithmException unused) {
return "";
}
}
private static void j(char c2, int i, int i2, Object[] objArr) {
dQY dqy = new dQY();
long[] jArr = new long[i2];
dqy.a = 0;
while (dqy.a < i2) {
jArr[dqy.a] = (((char) (e[dqy.a + i] ^ 5772335002700124114L)) ^ (dqy.a * (5772335002700124114L ^ c))) ^ c2;
dqy.a++;
}
char[] cArr = new char[i2];
dqy.a = 0;
while (dqy.a < i2) {
cArr[dqy.a] = (char) jArr[dqy.a];
dqy.a++;
}
objArr[0] = new String(cArr);
}
private static void i(int i, int i2, int i3, char[] cArr, boolean z, Object[] objArr) {
zUI zui = new zUI();
char[] cArr2 = new char[i];
zui.d = 0;
while (zui.d < i) {
zui.c = cArr[zui.d];
cArr2[zui.d] = (char) (zui.c + i3);
int i4 = zui.d;
cArr2[i4] = (char) (cArr2[i4] - ((int) (d ^ 2848453412581051943L)));
zui.d++;
}
if (i2 > 0) {
zui.a = i2;
char[] cArr3 = new char[i];
System.arraycopy(cArr2, 0, cArr3, 0, i);
System.arraycopy(cArr3, 0, cArr2, i - zui.a, zui.a);
System.arraycopy(cArr3, zui.a, cArr2, 0, i - zui.a);
}
if (z) {
char[] cArr4 = new char[i];
zui.d = 0;
while (zui.d < i) {
cArr4[zui.d] = cArr2[(i - zui.d) - 1];
zui.d++;
}
cArr2 = cArr4;
}
objArr[0] = new String(cArr2);
}
private static InputStream b(InputStream inputStream, int i, int i2, byte[] bArr) throws IOException {
int length = bArr.length;
byte[] bArr2 = new byte[length];
System.arraycopy(bArr, 0, bArr2, 0, length);
TAC.c(bArr2, a, b);
return new C17133uFJ(inputStream, i2, bArr2, Awr.e(i));
}
@Override // o.guM
public final String d(String str, String str2) {
C14957gcv.e(str, "");
C14957gcv.e(str2, "");
String d2 = guE.d(secretKeyFromJNI(str2));
if (d2 == null) {
d2 = "";
}
byte[] bytes = str.getBytes(gdP.a);
C14957gcv.c(bytes, "");
return d(d2, bytes);
}
private static void h(byte b2, byte b3, int i, Object[] objArr) {
int i2 = 102 - (i * 4);
int i3 = b3 * 5;
int i4 = 9 - (b2 * 5);
byte[] bArr = f;
byte[] bArr2 = new byte[i3 + 6];
int i5 = i3 + 5;
int i6 = -1;
if (bArr == null) {
i6 = -1;
i2 = (i5 + (-i4)) - 2;
i4++;
}
while (true) {
int i7 = i6 + 1;
bArr2[i7] = (byte) i2;
if (i7 == i5) {
objArr[0] = new String(bArr2, 0);
return;
}
int i8 = i2;
int i9 = i4 + 1;
i6 = i7;
i2 = (i8 + (-bArr[i4])) - 2;
i4 = i9;
}
}
static void a() {
d = 2015661683;
e = new char[]{36769, 52391, 2480, 18081, 33702, 49312, 7611, 23228, 38837, 61523, 45912, 30331, 14680, 64598, 48979, 38896, 54527, 4586, 24311, 39912, 55547, 1490, 17137, 36863, 52474, 36789, 52407, 2470, 18068, 33686, 37477, 53615, 5240, 23413, 36790, 52407, 2494, 18103, 33702, 49335};
c = -3832666848472085294L;
}
static void d() {
b = -5460580109075031448L;
a = ISO7816.INS_PUT_DATA;
}
/* JADX WARN: Removed duplicated region for block: B:137:0x06aa A[EXC_TOP_SPLITTER, SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:43:0x041b 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 c(java.lang.String r31) {
/*
Method dump skipped, instructions count: 2097
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: scb.yek.ValidateSignature.c(java.lang.String):void");
}
}