what-the-bank/sources/o/C15165git.java

176 lines
6.9 KiB
Java

package o;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.text.TextUtils;
import com.google.common.primitives.UnsignedBytes;
import com.huawei.hms.common.PackageConstants;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import org.bouncycastle.pqc.jcajce.spec.McElieceCCA2KeyGenParameterSpec;
/* renamed from: o.git, reason: case insensitive filesystem */
/* loaded from: classes2.dex */
public class C15165git {
private static final Uri b = Uri.parse("content://com.huawei.hwid");
private static final String[] d = {"B92825C2BD5D6D6D1E7F39EECD17843B7D9016F611136B75441BC6F4D3F00F05", PackageConstants.SERVICES_SIGNATURE_V3};
private C15165git() {
}
public static InputStream a(Context context) {
if (!b(context)) {
return null;
}
try {
StringBuilder sb = new StringBuilder();
StringBuilder sb2 = new StringBuilder();
sb2.append(context.createDeviceProtectedStorageContext().getFilesDir());
sb2.append(File.separator);
sb2.append("aegis");
sb.append(sb2.toString());
sb.append(File.separator);
sb.append("hmsrootcas.bks");
return new FileInputStream(sb.toString());
} catch (FileNotFoundException unused) {
return null;
}
}
private static boolean b(Context context) {
StringBuilder sb = new StringBuilder();
StringBuilder sb2 = new StringBuilder();
sb2.append(context.createDeviceProtectedStorageContext().getFilesDir());
sb2.append(File.separator);
sb2.append("aegis");
sb.append(sb2.toString());
sb.append(File.separator);
sb.append("hmsrootcas.bks");
return new File(sb.toString()).exists();
}
private static boolean d(String str) {
int parseInt;
if (TextUtils.isEmpty(str)) {
return false;
}
String[] split = str.split("\\.");
String[] split2 = "4.0.2.300".split("\\.");
int length = split.length;
int length2 = split2.length;
int max = Math.max(length, length2);
int i = 0;
while (i < max) {
if (i < length) {
try {
parseInt = Integer.parseInt(split[i]);
} catch (Exception e) {
e.getMessage();
return i >= length2;
}
} else {
parseInt = 0;
}
int parseInt2 = i < length2 ? Integer.parseInt(split2[i]) : 0;
if (parseInt < parseInt2) {
return false;
}
if (parseInt > parseInt2) {
return true;
}
i++;
}
return true;
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Removed duplicated region for block: B:123:0x0174 A[EXC_TOP_SPLITTER, SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:129:? A[Catch: all -> 0x0178, SYNTHETIC, TRY_ENTER, TRY_LEAVE, TryCatch #15 {, blocks: (B:6:0x0007, B:8:0x000b, B:12:0x0011, B:17:0x0018, B:19:0x0024, B:21:0x0030, B:24:0x0037, B:26:0x0044, B:32:0x0068, B:61:0x0133, B:51:0x0136, B:52:0x0139, B:54:0x015c, B:133:0x016c, B:121:0x016f, B:124:0x0174, B:125:0x0177, B:115:0x0151, B:109:0x0154, B:111:0x0159, B:28:0x0051, B:147:0x0054), top: B:5:0x0007 }] */
/* JADX WARN: Removed duplicated region for block: B:132:0x016c A[EXC_TOP_SPLITTER, SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:60:0x0133 A[EXC_TOP_SPLITTER, SYNTHETIC] */
/* JADX WARN: Type inference failed for: r2v10 */
/* JADX WARN: Type inference failed for: r2v11, types: [java.io.Closeable] */
/* JADX WARN: Type inference failed for: r2v12, types: [java.io.OutputStream, java.io.ByteArrayOutputStream, java.io.Closeable] */
/* JADX WARN: Type inference failed for: r2v18 */
/* JADX WARN: Type inference failed for: r2v19 */
/* JADX WARN: Type inference failed for: r2v8, types: [boolean] */
/* JADX WARN: Type inference failed for: r3v0, types: [java.lang.String[]] */
/* JADX WARN: Type inference failed for: r3v1, types: [java.lang.String] */
/* JADX WARN: Type inference failed for: r6v9, types: [java.io.OutputStream, java.io.Closeable, java.io.FileOutputStream] */
/* JADX WARN: Type inference failed for: r7v3, types: [java.lang.String] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static java.io.InputStream d(android.content.Context r12) {
/*
Method dump skipped, instructions count: 379
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: o.C15165git.d(android.content.Context):java.io.InputStream");
}
private static String c(byte[] bArr) {
if (bArr != null && bArr.length != 0) {
try {
return b(MessageDigest.getInstance(McElieceCCA2KeyGenParameterSpec.SHA256).digest(bArr));
} catch (NoSuchAlgorithmException e) {
e.getMessage();
}
}
return "";
}
private static String e(byte[] bArr) {
if (bArr == null) {
return "";
}
try {
MessageDigest messageDigest = MessageDigest.getInstance(McElieceCCA2KeyGenParameterSpec.SHA256);
messageDigest.update(bArr);
return b(messageDigest.digest());
} catch (NoSuchAlgorithmException unused) {
return "";
}
}
private static byte[] c(Context context, String str) {
PackageInfo packageInfo;
if (context != null && !TextUtils.isEmpty(str)) {
try {
PackageManager packageManager = context.getPackageManager();
if (packageManager != null && (packageInfo = packageManager.getPackageInfo(str, 64)) != null) {
return packageInfo.signatures[0].toByteArray();
}
} catch (PackageManager.NameNotFoundException e) {
e.getMessage();
} catch (Exception e2) {
e2.getMessage();
}
return new byte[0];
}
return new byte[0];
}
private static String b(byte[] bArr) {
if (bArr == null || bArr.length == 0) {
return "";
}
StringBuilder sb = new StringBuilder();
for (byte b2 : bArr) {
String hexString = Integer.toHexString(b2 & UnsignedBytes.MAX_VALUE);
if (hexString.length() == 1) {
sb.append('0');
}
sb.append(hexString);
}
return sb.toString();
}
}