357 lines
12 KiB
Java
357 lines
12 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.SecureRandom;
|
|
import javax.crypto.Cipher;
|
|
import javax.crypto.spec.IvParameterSpec;
|
|
import javax.crypto.spec.SecretKeySpec;
|
|
import net.sf.scuba.smartcards.ISO7816;
|
|
import o.AbstractC14961gcz;
|
|
import o.Awr;
|
|
import o.C14875gap;
|
|
import o.C14881gav;
|
|
import o.C14957gcv;
|
|
import o.C15022geq;
|
|
import o.C17133uFJ;
|
|
import o.C3614bBe;
|
|
import o.IRS;
|
|
import o.InterfaceC14894gbR;
|
|
import o.TAC;
|
|
import o.gdP;
|
|
import o.gdZ;
|
|
|
|
/* loaded from: classes6.dex */
|
|
public class GetKey {
|
|
private static long a;
|
|
private static byte b;
|
|
private static int c;
|
|
private static char[] e;
|
|
private static char g;
|
|
private static boolean h;
|
|
private static boolean i;
|
|
private static char[] j;
|
|
private String d;
|
|
private static final byte[] f = {16, ISO7816.INS_MANAGE_CHANNEL, -67, -78, 47, -8, -47, 46, -6, -5, -7, 8, Ascii.SYN, -31, 5, -18, 15, -19, -9};
|
|
private static final int m = 29;
|
|
|
|
public final native String keyFromJNI(String str);
|
|
|
|
/* loaded from: classes6.dex */
|
|
public static final class RVV {
|
|
private RVV() {
|
|
}
|
|
|
|
public /* synthetic */ RVV(byte b) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
static {
|
|
a();
|
|
c();
|
|
new RVV((byte) 0);
|
|
byte b2 = (byte) 0;
|
|
byte b3 = (byte) (b2 + 1);
|
|
Object[] objArr = new Object[1];
|
|
l(b2, b3, b3, objArr);
|
|
d((String) objArr[0]);
|
|
}
|
|
|
|
public final String a(String str, String str2) {
|
|
C14957gcv.e(str, "");
|
|
C14957gcv.e(str2, "");
|
|
return c(str, str2, keyFromJNI(str2));
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
public final String c(String str, String str2, String str3) {
|
|
C14957gcv.e(str, "");
|
|
C14957gcv.e(str2, "");
|
|
C14957gcv.e(str3, "");
|
|
byte[] bytes = str.getBytes(gdP.a);
|
|
C14957gcv.c(bytes, "");
|
|
byte[] decode = Base64.decode(str3, 0);
|
|
C14957gcv.c(decode, "");
|
|
SecretKeySpec secretKeySpec = new SecretKeySpec(decode, 0, decode.length, "AES");
|
|
byte[] bArr = new byte[8];
|
|
new SecureRandom().nextBytes(bArr);
|
|
String a2 = C14875gap.a(bArr, "", Sts.d);
|
|
this.d = a2;
|
|
String str4 = null;
|
|
if (a2 == null) {
|
|
C14957gcv.a("");
|
|
a2 = null;
|
|
}
|
|
byte[] bytes2 = a2.getBytes(gdP.a);
|
|
C14957gcv.c(bytes2, "");
|
|
IvParameterSpec ivParameterSpec = new IvParameterSpec(bytes2);
|
|
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
|
|
cipher.init(1, secretKeySpec, ivParameterSpec);
|
|
byte[] doFinal = cipher.doFinal(bytes);
|
|
C14957gcv.c(doFinal, "");
|
|
String a3 = C14875gap.a(doFinal, "", Sts.d);
|
|
String str5 = this.d;
|
|
if (str5 == null) {
|
|
C14957gcv.a("");
|
|
} else {
|
|
str4 = str5;
|
|
}
|
|
String str6 = str4;
|
|
C14957gcv.e(str6, "");
|
|
C14957gcv.e(str6, "");
|
|
String b2 = C14881gav.b(gdZ.e(str6, 2, 2, C15022geq.RVV.e), "", null, null, 0, null, new HBt(this), 30);
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(a3);
|
|
sb.append(b2);
|
|
return sb.toString();
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes6.dex */
|
|
public static final class Sts extends AbstractC14961gcz implements InterfaceC14894gbR<Byte, CharSequence> {
|
|
public static final Sts d = new Sts();
|
|
|
|
@Override // o.InterfaceC14894gbR
|
|
public final /* synthetic */ CharSequence invoke(Byte b) {
|
|
String format = String.format("%02x", Byte.valueOf(b.byteValue()));
|
|
C14957gcv.c((Object) format, "");
|
|
return format;
|
|
}
|
|
|
|
Sts() {
|
|
super(1);
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes6.dex */
|
|
public static final class HBt extends AbstractC14961gcz implements InterfaceC14894gbR<String, CharSequence> {
|
|
private GetKey d;
|
|
|
|
@Override // o.InterfaceC14894gbR
|
|
public final /* synthetic */ CharSequence invoke(String str) {
|
|
String str2 = str;
|
|
C14957gcv.e(str2, "");
|
|
byte[] bArr = new byte[1];
|
|
new SecureRandom().nextBytes(bArr);
|
|
String c = GetKey.c(bArr);
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(c);
|
|
sb.append(str2);
|
|
return sb.toString();
|
|
}
|
|
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
HBt(GetKey getKey) {
|
|
super(1);
|
|
this.d = getKey;
|
|
}
|
|
}
|
|
|
|
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, b, a);
|
|
return new C17133uFJ(inputStream, i3, bArr2, Awr.e(i2));
|
|
}
|
|
|
|
private static void p(char[] cArr, byte[] bArr, int[] iArr, int i2, Object[] objArr) {
|
|
C3614bBe c3614bBe = new C3614bBe();
|
|
char[] cArr2 = e;
|
|
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 ^ c);
|
|
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 (h) {
|
|
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);
|
|
}
|
|
|
|
private static void q(int i2, char[] cArr, byte b2, Object[] objArr) {
|
|
int i3;
|
|
IRS irs = new IRS();
|
|
char[] cArr2 = j;
|
|
if (cArr2 != null) {
|
|
int length = cArr2.length;
|
|
char[] cArr3 = new char[length];
|
|
for (int i4 = 0; i4 < length; i4++) {
|
|
cArr3[i4] = (char) (cArr2[i4] ^ 1678450157809666601L);
|
|
}
|
|
cArr2 = cArr3;
|
|
}
|
|
char c2 = (char) (1678450157809666601L ^ g);
|
|
char[] cArr4 = new char[i2];
|
|
if (i2 % 2 != 0) {
|
|
i3 = i2 - 1;
|
|
cArr4[i3] = (char) (cArr[i3] - b2);
|
|
} else {
|
|
i3 = i2;
|
|
}
|
|
if (i3 > 1) {
|
|
irs.e = 0;
|
|
while (irs.e < i3) {
|
|
irs.b = cArr[irs.e];
|
|
irs.c = cArr[irs.e + 1];
|
|
if (irs.b == irs.c) {
|
|
cArr4[irs.e] = (char) (irs.b - b2);
|
|
cArr4[irs.e + 1] = (char) (irs.c - b2);
|
|
} else {
|
|
irs.a = irs.b / c2;
|
|
irs.f = irs.b % c2;
|
|
irs.d = irs.c / c2;
|
|
irs.j = irs.c % c2;
|
|
if (irs.f == irs.j) {
|
|
irs.a = ((irs.a + c2) - 1) % c2;
|
|
irs.d = ((irs.d + c2) - 1) % c2;
|
|
int i5 = (irs.a * c2) + irs.f;
|
|
int i6 = (irs.d * c2) + irs.j;
|
|
cArr4[irs.e] = cArr2[i5];
|
|
cArr4[irs.e + 1] = cArr2[i6];
|
|
} else if (irs.a == irs.d) {
|
|
irs.f = ((irs.f + c2) - 1) % c2;
|
|
irs.j = ((irs.j + c2) - 1) % c2;
|
|
int i7 = (irs.a * c2) + irs.f;
|
|
int i8 = (irs.d * c2) + irs.j;
|
|
cArr4[irs.e] = cArr2[i7];
|
|
cArr4[irs.e + 1] = cArr2[i8];
|
|
} else {
|
|
int i9 = (irs.a * c2) + irs.j;
|
|
int i10 = (irs.d * c2) + irs.f;
|
|
cArr4[irs.e] = cArr2[i9];
|
|
cArr4[irs.e + 1] = cArr2[i10];
|
|
}
|
|
}
|
|
irs.e += 2;
|
|
}
|
|
}
|
|
for (int i11 = 0; i11 < i2; i11++) {
|
|
cArr4[i11] = (char) (cArr4[i11] ^ 13722);
|
|
}
|
|
objArr[0] = new String(cArr4);
|
|
}
|
|
|
|
public static final /* synthetic */ String c(byte[] bArr) {
|
|
return C14875gap.a(bArr, "", Sts.d);
|
|
}
|
|
|
|
/* JADX WARN: Removed duplicated region for block: B:10:0x0027 */
|
|
/* JADX WARN: Removed duplicated region for block: B:7:0x001f */
|
|
/* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:10:0x0027 -> 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 l(int r6, short r7, short r8, java.lang.Object[] r9) {
|
|
/*
|
|
int r7 = r7 * 5
|
|
int r7 = 9 - r7
|
|
int r6 = r6 * 5
|
|
int r0 = r6 + 6
|
|
int r8 = r8 * 4
|
|
int r8 = 102 - r8
|
|
byte[] r1 = scb.yek.GetKey.f
|
|
byte[] r0 = new byte[r0]
|
|
int r6 = r6 + 5
|
|
r2 = 0
|
|
if (r1 != 0) goto L19
|
|
r3 = r8
|
|
r4 = r2
|
|
r8 = r7
|
|
goto L30
|
|
L19:
|
|
r3 = r2
|
|
L1a:
|
|
byte r4 = (byte) r8
|
|
r0[r3] = r4
|
|
if (r3 != r6) goto L27
|
|
java.lang.String r6 = new java.lang.String
|
|
r6.<init>(r0, r2)
|
|
r9[r2] = r6
|
|
return
|
|
L27:
|
|
int r3 = r3 + 1
|
|
r4 = r1[r7]
|
|
r5 = r8
|
|
r8 = r7
|
|
r7 = r4
|
|
r4 = r3
|
|
r3 = r5
|
|
L30:
|
|
int r7 = -r7
|
|
int r3 = r3 + r7
|
|
int r7 = r3 + (-2)
|
|
int r8 = r8 + 1
|
|
r3 = r4
|
|
r5 = r8
|
|
r8 = r7
|
|
r7 = r5
|
|
goto L1a
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: scb.yek.GetKey.l(int, short, short, java.lang.Object[]):void");
|
|
}
|
|
|
|
static void a() {
|
|
e = new char[]{15897, 15918, 15915, 15966, 15917, 15961, 15911, 15896, 15965, 15916, 15962, 15906, 15960, 15919, 15905, 15932, 15967, 15907, 15964, 15878, 15952, 15883, 15910, 15930};
|
|
c = 1934311114;
|
|
h = true;
|
|
i = true;
|
|
j = new char[]{49148, 49114, 49098, 49033, 49151, 49109, 49150, 49097, 49053, 49119, 49093, 49142, 49110, 49118, 49111, 49088, 49117, 49105, 49116, 49108, 49095, 49143, 49139, 49140, 49124, 49141, 49138, 49089, 49137, 49104, 49113, 49106, 49136, 49146, 49099, 49091};
|
|
g = (char) 35375;
|
|
}
|
|
|
|
static void c() {
|
|
a = -5460580109075031448L;
|
|
b = ISO7816.INS_PUT_DATA;
|
|
}
|
|
|
|
/* JADX WARN: Removed duplicated region for block: B:135:0x0584 A[EXC_TOP_SPLITTER, SYNTHETIC] */
|
|
/* JADX WARN: Removed duplicated region for block: B:41:0x036d 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 d(java.lang.String r16) {
|
|
/*
|
|
Method dump skipped, instructions count: 1809
|
|
To view this dump add '--comments-level debug' option
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: scb.yek.GetKey.d(java.lang.String):void");
|
|
}
|
|
}
|