what-the-bank/sources/com/huawei/hms/support/api/safetydetect/a.java

557 lines
22 KiB
Java

package com.huawei.hms.support.api.safetydetect;
import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageItemInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.media.AudioTrack;
import android.os.Process;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.widget.ExpandableListView;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.huawei.hms.api.Api;
import com.huawei.hms.common.ApiException;
import com.huawei.hms.common.HuaweiApi;
import com.huawei.hms.common.internal.AbstractClientBuilder;
import com.huawei.hms.support.api.client.Status;
import com.huawei.hms.support.api.entity.common.CommonConstant;
import com.huawei.hms.support.api.entity.safetydetect.MaliciousAppsListResp;
import com.huawei.hms.support.api.entity.safetydetect.RiskTokenResponse;
import com.huawei.hms.support.api.entity.safetydetect.SysIntegrityRequest;
import com.huawei.hms.support.api.entity.safetydetect.SysIntegrityResp;
import com.huawei.hms.support.api.entity.safetydetect.UrlCheckResponse;
import com.huawei.hms.support.api.entity.safetydetect.UserDetectResponse;
import com.huawei.hms.support.api.entity.safetydetect.VerifyAppsCheckEnabledResp;
import com.huawei.hms.support.api.entity.safetydetect.WifiDetectResponse;
import com.huawei.hms.support.api.safetydetect.p003default.b;
import com.huawei.hms.support.api.safetydetect.p003default.b0;
import com.huawei.hms.support.api.safetydetect.p003default.c;
import com.huawei.hms.support.api.safetydetect.p003default.c0;
import com.huawei.hms.support.api.safetydetect.p003default.d0;
import com.huawei.hms.support.api.safetydetect.p003default.e0;
import com.huawei.hms.support.api.safetydetect.p003default.f;
import com.huawei.hms.support.api.safetydetect.p003default.f0;
import com.huawei.hms.support.api.safetydetect.p003default.g;
import com.huawei.hms.support.api.safetydetect.p003default.g0;
import com.huawei.hms.support.api.safetydetect.p003default.h;
import com.huawei.hms.support.api.safetydetect.p003default.i;
import com.huawei.hms.support.api.safetydetect.p003default.j;
import com.huawei.hms.support.api.safetydetect.p003default.k;
import com.huawei.hms.support.api.safetydetect.p003default.l;
import com.huawei.hms.support.api.safetydetect.p003default.n;
import com.huawei.hms.support.api.safetydetect.p003default.q;
import com.huawei.hms.support.api.safetydetect.p003default.r;
import com.huawei.hms.support.api.safetydetect.p003default.u;
import com.huawei.hms.support.api.safetydetect.p003default.v;
import com.huawei.hms.support.api.safetydetect.p003default.w;
import com.huawei.hms.support.api.safetydetect.p003default.x;
import com.huawei.hms.support.log.common.Base64;
import com.huawei.hms.utils.Checker;
import com.huawei.hms.utils.SHA256;
import com.pingan.ai.p;
import java.io.FileInputStream;
import java.io.IOException;
import java.lang.reflect.Method;
import java.security.DigestInputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import o.HiE;
import o.Nhs;
import o.nNj;
import o.xzZ;
import org.bouncycastle.pqc.jcajce.spec.McElieceCCA2KeyGenParameterSpec;
import org.json.JSONException;
/* loaded from: classes2.dex */
public class a extends HuaweiApi<u> implements SafetyDetectClient {
private static final String b = "a";
private static final r c;
private static final Api<u> d;
private static long e;
private static char g;
private static int h;
private static int j;
private Context a;
private static final byte[] $$a = {101, -49, 33, 116};
private static final int $$b = 192;
private static int $10 = 0;
private static int $11 = 1;
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:0x0028). 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 p(byte r5, int r6, byte r7, java.lang.Object[] r8) {
/*
byte[] r0 = com.huawei.hms.support.api.safetydetect.a.$$a
int r7 = r7 * 4
int r1 = 1 - r7
int r5 = 115 - r5
int r6 = r6 * 2
int r6 = r6 + 4
byte[] r1 = new byte[r1]
r2 = 0
int r7 = 0 - r7
if (r0 != 0) goto L16
r4 = r7
r3 = r2
goto L28
L16:
r3 = r2
L17:
byte r4 = (byte) r5
r1[r3] = r4
if (r3 != r7) goto L24
java.lang.String r5 = new java.lang.String
r5.<init>(r1, r2)
r8[r2] = r5
return
L24:
int r3 = r3 + 1
r4 = r0[r6]
L28:
int r5 = r5 + r4
int r6 = r6 + 1
goto L17
*/
throw new UnsupportedOperationException("Method not decompiled: com.huawei.hms.support.api.safetydetect.a.p(byte, int, byte, java.lang.Object[]):void");
}
private static void o(char c2, int i2, char[] cArr, char[] cArr2, char[] cArr3, Object[] objArr) {
int i3;
int i4 = 2;
int i5 = 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 i6 = $11 + 57;
$10 = i6 % 128;
int i7 = i6 % 2;
while (nhs.a < length3) {
int i8 = $11 + 45;
$10 = i8 % 128;
int i9 = i8 % i4;
try {
Object[] objArr2 = {nhs};
Object obj = xzZ.y.get(263693715);
if (obj == null) {
obj = ((Class) xzZ.c(45 - (ViewConfiguration.getJumpTapTimeout() >> 16), (AudioTrack.getMaxVolume() > BitmapDescriptorFactory.HUE_RED ? 1 : (AudioTrack.getMaxVolume() == BitmapDescriptorFactory.HUE_RED ? 0 : -1)) + 4, (char) (TextUtils.indexOf((CharSequence) "", '0', 0) + 1))).getMethod("t", Object.class);
xzZ.y.put(263693715, obj);
}
int intValue = ((Integer) ((Method) obj).invoke(null, objArr2)).intValue();
Object[] objArr3 = {nhs};
Object obj2 = xzZ.y.get(-484664112);
if (obj2 == null) {
Class cls = (Class) xzZ.c(352 - KeyEvent.normalizeMetaState(0), (ViewConfiguration.getEdgeSlop() >> 16) + 5, (char) (52128 - View.MeasureSpec.getSize(0)));
byte b2 = (byte) 0;
byte b3 = b2;
Object[] objArr4 = new Object[1];
p(b2, b3, b3, objArr4);
obj2 = cls.getMethod((String) objArr4[0], Object.class);
xzZ.y.put(-484664112, obj2);
}
int intValue2 = ((Integer) ((Method) obj2).invoke(null, objArr3)).intValue();
Object[] objArr5 = {nhs, Integer.valueOf(cArr4[nhs.a % 4] * 32718), Integer.valueOf(cArr5[intValue])};
Object obj3 = xzZ.y.get(430099516);
if (obj3 == null) {
obj3 = ((Class) xzZ.c(749 - (SystemClock.elapsedRealtimeNanos() > 0L ? 1 : (SystemClock.elapsedRealtimeNanos() == 0L ? 0 : -1)), 5 - ExpandableListView.getPackedPositionType(0L), (char) (TextUtils.lastIndexOf("", '0') + 1))).getMethod(p.a, Object.class, Integer.TYPE, Integer.TYPE);
xzZ.y.put(430099516, obj3);
}
((Method) obj3).invoke(null, objArr5);
Object[] objArr6 = {Integer.valueOf(cArr4[intValue2] * 32718), Integer.valueOf(cArr5[intValue])};
Object obj4 = xzZ.y.get(1019894806);
if (obj4 != null) {
i3 = 2;
} else {
Class cls2 = (Class) xzZ.c(402 - (ViewConfiguration.getKeyRepeatDelay() >> 16), 4 - ExpandableListView.getPackedPositionChild(0L), (char) (21608 - View.resolveSize(0, 0)));
byte b4 = (byte) 1;
byte b5 = (byte) (b4 - 1);
Object[] objArr7 = new Object[1];
p(b4, b5, b5, objArr7);
i3 = 2;
obj4 = cls2.getMethod((String) objArr7[0], Integer.TYPE, Integer.TYPE);
xzZ.y.put(1019894806, obj4);
}
cArr5[intValue2] = ((Character) ((Method) obj4).invoke(null, objArr6)).charValue();
cArr4[intValue2] = nhs.c;
cArr6[nhs.a] = (char) ((((cArr4[intValue2] ^ cArr2[nhs.a]) ^ (e ^ 9051040786702654117L)) ^ ((int) (j ^ 9051040786702654117L))) ^ ((char) (g ^ 9051040786702654117L)));
nhs.a++;
i4 = i3;
} catch (Throwable th) {
Throwable cause = th.getCause();
if (cause == null) {
throw th;
}
throw cause;
}
}
objArr[0] = new String(cArr6);
}
@Override // com.huawei.hms.support.api.safetydetect.SafetyDetectClient
public HiE<RiskTokenResponse> getRiskToken() {
int i2 = 2 % 2;
int i3 = h + 53;
i = i3 % 128;
int i4 = i3 % 2;
String a = q.a(this.a);
if (!TextUtils.isEmpty(a)) {
try {
nNj nnj = new nNj();
nnj.b(new RiskTokenResponse(a));
return nnj.b;
} catch (JSONException e2) {
e2.getMessage();
}
}
HiE doWrite = doWrite(new i(getContext(), "safetydetect.getRiskToken", "", true));
int i5 = i + 11;
h = i5 % 128;
if (i5 % 2 == 0) {
int i6 = 10 / 0;
}
return doWrite;
}
/* JADX WARN: Code restructure failed: missing block: B:25:0x0098, code lost:
if ("PS256".equals(r3) != false) goto L27;
*/
/* JADX WARN: Code restructure failed: missing block: B:27:0x00c1, code lost:
throw new com.huawei.hms.common.ApiException(new com.huawei.hms.support.api.client.Status(com.huawei.hms.support.api.safetydetect.SafetyDetectStatusCodes.PARAM_ERROR_INVALID, com.huawei.hms.support.api.safetydetect.SafetyDetectStatusCodes.getStatusCodeString(com.huawei.hms.support.api.safetydetect.SafetyDetectStatusCodes.PARAM_ERROR_INVALID)));
*/
/* JADX WARN: Code restructure failed: missing block: B:28:0x00a3, code lost:
r7 = com.huawei.hms.support.api.safetydetect.a.i + 77;
com.huawei.hms.support.api.safetydetect.a.h = r7 % 128;
*/
/* JADX WARN: Code restructure failed: missing block: B:29:0x00ac, code lost:
if ((r7 % 2) != 0) goto L32;
*/
/* JADX WARN: Code restructure failed: missing block: B:30:0x00ae, code lost:
r6 = 4 % 3;
*/
/* JADX WARN: Code restructure failed: missing block: B:35:0x00a1, code lost:
if ("PS256".equals(r3) != false) goto L27;
*/
/* JADX WARN: Removed duplicated region for block: B:54:0x0132 */
@Override // com.huawei.hms.support.api.safetydetect.SafetyDetectClient
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public o.HiE<com.huawei.hms.support.api.entity.safetydetect.SysIntegrityResp> sysIntegrity(com.huawei.hms.support.api.entity.safetydetect.SysIntegrityRequest r15) {
/*
Method dump skipped, instructions count: 336
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.huawei.hms.support.api.safetydetect.a.sysIntegrity(com.huawei.hms.support.api.entity.safetydetect.SysIntegrityRequest):o.HiE");
}
static void e() {
e = -1410340380405024459L;
j = 452713125;
g = (char) 55973;
}
@Override // com.huawei.hms.support.api.safetydetect.SafetyDetectClient
public HiE<UserDetectResponse> userDetection(String str) {
int i2 = 2 % 2;
Checker.checkNonNull(str);
HiE doWrite = doWrite(new d0(getContext(), "safetydetect.userDetection", new e0(str).a(), true));
int i3 = i + 75;
h = i3 % 128;
int i4 = i3 % 2;
return doWrite;
}
@Override // com.huawei.hms.support.api.safetydetect.SafetyDetectClient
public HiE<UrlCheckResponse> urlCheck(String str, String str2, int... iArr) {
int i2 = 2 % 2;
Checker.checkNonNull(str);
Checker.checkNonNull(str2);
HiE doWrite = doWrite(new b0(getContext(), "safetydetect.urlCheck", new c0(str, str2, iArr).a(), true));
int i3 = h + 21;
i = i3 % 128;
if (i3 % 2 != 0) {
int i4 = 97 / 0;
}
return doWrite;
}
@Override // com.huawei.hms.support.api.safetydetect.SafetyDetectClient
public HiE<SysIntegrityResp> sysIntegrity(byte[] bArr, String str) {
int i2 = 2 % 2;
SysIntegrityRequest sysIntegrityRequest = new SysIntegrityRequest();
Object[] objArr = new Object[1];
o((char) (57043 - (Process.getElapsedCpuTime() > 0L ? 1 : (Process.getElapsedCpuTime() == 0L ? 0 : -1))), 907954769 - (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)), new char[]{20960, 7754, 53814, 27358}, new char[]{12937, 14790, 49729, 46251, 58191}, new char[]{25488, 28522, 46913, 37366}, objArr);
sysIntegrityRequest.setAlg(((String) objArr[0]).intern());
sysIntegrityRequest.setAppId(str);
sysIntegrityRequest.setNonce(bArr);
HiE<SysIntegrityResp> sysIntegrity = sysIntegrity(sysIntegrityRequest);
int i3 = i + 73;
h = i3 % 128;
if (i3 % 2 == 0) {
int i4 = 73 / 0;
}
return sysIntegrity;
}
@Override // com.huawei.hms.support.api.safetydetect.SafetyDetectClient
public HiE<Void> shutdownUserDetect() {
int i2 = 2 % 2;
HiE doWrite = doWrite(new v(getContext(), "safetydetect.shutdownUserDetect", "", true));
int i3 = i + 45;
h = i3 % 128;
if (i3 % 2 != 0) {
return doWrite;
}
Object obj = null;
obj.hashCode();
throw null;
}
@Override // com.huawei.hms.support.api.safetydetect.SafetyDetectClient
public HiE<Void> shutdownUrlCheck() {
int i2 = 2 % 2;
HiE doWrite = doWrite(new w(getContext(), "safetydetect.shutdownUrlChecker", "", true));
int i3 = h + 73;
i = i3 % 128;
if (i3 % 2 == 0) {
return doWrite;
}
throw null;
}
@Override // com.huawei.hms.support.api.safetydetect.SafetyDetectClient
public HiE<Void> releaseAntiFraud() {
int i2 = 2 % 2;
HiE doWrite = doWrite(new com.huawei.hms.support.api.safetydetect.p003default.p(getContext(), "safetydetect.releaseAntiFraud", "", true));
int i3 = i + 15;
h = i3 % 128;
if (i3 % 2 != 0) {
return doWrite;
}
throw null;
}
@Override // com.huawei.hms.support.api.safetydetect.SafetyDetectClient
public HiE<VerifyAppsCheckEnabledResp> isVerifyAppsCheck() {
int i2 = 2 % 2;
HiE doWrite = doWrite(new g0(getContext(), "safetydetect.isVerifyAppsCheck", new f0().a(), true));
int i3 = i + 31;
h = i3 % 128;
if (i3 % 2 != 0) {
return doWrite;
}
Object obj = null;
obj.hashCode();
throw null;
}
@Override // com.huawei.hms.support.api.safetydetect.SafetyDetectClient
public HiE<Void> initUserDetect() {
int i2 = 2 % 2;
HiE doWrite = doWrite(new l(getContext(), "safetydetect.initUserDetect", "", true));
int i3 = i + 121;
h = i3 % 128;
int i4 = i3 % 2;
return doWrite;
}
@Override // com.huawei.hms.support.api.safetydetect.SafetyDetectClient
public HiE<Void> initUrlCheck() {
int i2 = 2 % 2;
HiE doWrite = doWrite(new b(getContext(), "safetydetect.initUrlChecker", "", true));
int i3 = h + 49;
i = i3 % 128;
int i4 = i3 % 2;
return doWrite;
}
@Override // com.huawei.hms.support.api.safetydetect.SafetyDetectClient
public HiE<Void> initAntiFraud(String str) {
int i2 = 2 % 2;
Checker.checkNonNull(str);
HiE doWrite = doWrite(new k(getContext(), "safetydetect.initAntiFraud", new c(str).a(), true));
int i3 = h + 11;
i = i3 % 128;
int i4 = i3 % 2;
return doWrite;
}
@Override // com.huawei.hms.support.api.safetydetect.SafetyDetectClient
public HiE<WifiDetectResponse> getWifiDetectStatus() {
int i2 = 2 % 2;
HiE doWrite = doWrite(new j(getContext(), "safetydetect.getWifiDetectStatus", "", true));
int i3 = h + 125;
i = i3 % 128;
if (i3 % 2 == 0) {
return doWrite;
}
Object obj = null;
obj.hashCode();
throw null;
}
@Override // com.huawei.hms.support.api.safetydetect.SafetyDetectClient
public HiE<MaliciousAppsListResp> getMaliciousAppsList() {
int i2 = 2 % 2;
HiE doWrite = doWrite(new h(getContext(), "safetydetect.getHarmfulAppsList", new n().a(), true));
int i3 = i + 119;
h = i3 % 128;
if (i3 % 2 == 0) {
int i4 = 36 / 0;
}
return doWrite;
}
@Override // com.huawei.hms.support.api.safetydetect.SafetyDetectClient
public HiE<VerifyAppsCheckEnabledResp> enableAppsCheck() {
int i2 = 2 % 2;
HiE doWrite = doWrite(new g(getContext(), "safetydetect.enableAppsCheck", new f().a(), true));
int i3 = i + 57;
h = i3 % 128;
if (i3 % 2 != 0) {
return doWrite;
}
Object obj = null;
obj.hashCode();
throw null;
}
private void a(byte[] bArr) {
int i2 = 2 % 2;
int i3 = h;
int i4 = i3 + 119;
i = i4 % 128;
int i5 = i4 % 2;
if (bArr != null) {
int i6 = i3 + 35;
i = i6 % 128;
int i7 = i6 % 2;
int length = bArr.length;
if (i7 == 0 ? length >= 16 : length >= 39) {
if (bArr.length <= 66) {
return;
}
}
}
throw new ApiException(new Status(SafetyDetectStatusCodes.PARAM_ERROR_INVALID, SafetyDetectStatusCodes.getStatusCodeString(SafetyDetectStatusCodes.PARAM_ERROR_INVALID)));
}
private static String a(String str) {
int i2 = 2 % 2;
try {
DigestInputStream digestInputStream = new DigestInputStream(new FileInputStream(str), MessageDigest.getInstance(McElieceCCA2KeyGenParameterSpec.SHA256));
try {
byte[] bArr = new byte[131072];
int i3 = h + 59;
i = i3 % 128;
int i4 = i3 % 2;
while (digestInputStream.read(bArr) > 0) {
int i5 = h + 37;
i = i5 % 128;
if (i5 % 2 != 0) {
int i6 = 3 % 3;
}
}
String encode = Base64.encode(digestInputStream.getMessageDigest().digest());
digestInputStream.close();
int i7 = h + 85;
i = i7 % 128;
int i8 = i7 % 2;
return encode;
} finally {
}
} catch (IOException | NoSuchAlgorithmException unused) {
return "";
}
}
private x a(byte[] bArr, String str, String str2, Context context) {
int i2 = 2 % 2;
x xVar = new x();
String str3 = context.getApplicationInfo().sourceDir;
xVar.d(Base64.encode(bArr));
xVar.c(str);
xVar.e((String) PackageItemInfo.class.getField(CommonConstant.ReqAccessTokenParam.PACKAGE_NAME).get(context.getApplicationInfo()));
xVar.a(str2);
xVar.b(a(str3));
try {
PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 64);
String[] strArr = new String[packageInfo.signatures.length];
int i3 = i + 93;
h = i3 % 128;
int i4 = i3 % 2;
int i5 = 0;
while (true) {
Signature[] signatureArr = packageInfo.signatures;
if (i5 >= signatureArr.length) {
break;
}
int i6 = h + 117;
i = i6 % 128;
int i7 = i6 % 2;
strArr[i5] = Base64.encode(SHA256.digest(signatureArr[i5].toByteArray()));
i5++;
}
xVar.a(strArr);
int i8 = i + 125;
h = i8 % 128;
if (i8 % 2 == 0) {
int i9 = 3 % 5;
}
} catch (PackageManager.NameNotFoundException unused) {
xVar.a((String[]) null);
}
return xVar;
}
/* JADX INFO: Access modifiers changed from: package-private */
public a(Context context, u uVar) {
super(context, d, uVar, c, 60700302);
this.a = context;
}
/* JADX INFO: Access modifiers changed from: package-private */
public a(Activity activity, u uVar) {
super(activity, d, uVar, (AbstractClientBuilder) c, 60700302);
this.a = activity;
}
static {
h = 1;
e();
c = new r();
d = new Api<>("HuaweiSafetyDetect.API");
int i2 = i + 51;
h = i2 % 128;
int i3 = i2 % 2;
}
}