涩里番 v4.2版本的 MD5 值为:b7af51031b798a68c7a3a9ba5a0dff66
以下内容为反编译后的 c.java 源代码,内容仅作参考
package q2;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
import android.text.TextUtils;
import d2.d;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.security.KeyFactory;
import java.security.PublicKey;
import java.security.spec.X509EncodedKeySpec;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.crypto.Cipher;
import k2.e;
import org.json.JSONException;
import org.json.JSONObject;
import p2.a;
import tv.danmaku.ijk.media.player.IjkMediaMeta;
import v2.g;
import we.z;
public abstract class c {
public static JSONObject e(String str, String str2) {
JSONObject jSONObject = new JSONObject();
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put(IjkMediaMeta.IJKM_KEY_TYPE, str);
jSONObject2.put("method", str2);
jSONObject.put("action", jSONObject2);
return jSONObject;
}
public static boolean h(a.b bVar) {
List<String> list;
Map<String, List<String>> map = bVar.f13021a;
return Boolean.valueOf((map == null || (list = map.get("msp-gzip")) == null) ? null : TextUtils.join(",", list)).booleanValue();
}
public final String a(HashMap<String, String> hashMap, HashMap<String, String> hashMap2) {
JSONObject jSONObject = new JSONObject();
JSONObject jSONObject2 = new JSONObject();
for (Map.Entry<String, String> entry : hashMap.entrySet()) {
jSONObject2.put(entry.getKey(), entry.getValue());
}
JSONObject jSONObject3 = new JSONObject();
for (Map.Entry<String, String> entry2 : hashMap2.entrySet()) {
jSONObject3.put(entry2.getKey(), entry2.getValue());
}
jSONObject2.put("params", jSONObject3);
jSONObject.put("data", jSONObject2);
return jSONObject.toString();
}
public String b(t2.a aVar, String str, JSONObject jSONObject) {
d a10 = d.a();
u2.a a11 = u2.a.a((Context) a10.f6607j);
JSONObject jSONObject2 = new JSONObject();
JSONObject jSONObject3 = new JSONObject();
boolean z10 = false;
try {
JSONObject[] jSONObjectArr = {jSONObject2, jSONObject};
for (int i2 = 0; i2 < 2; i2++) {
JSONObject jSONObject4 = jSONObjectArr[i2];
if (jSONObject4 != null) {
Iterator<String> keys = jSONObject4.keys();
while (keys.hasNext()) {
String next = keys.next();
jSONObject3.put(next, jSONObject4.get(next));
}
}
}
} catch (JSONException e10) {
n.b.e(e10);
}
try {
jSONObject3.put("external_info", str);
jSONObject3.put("tid", a11.f15452a);
jSONObject3.put("user_agent", n2.d.d().b(aVar, a11));
jSONObject3.put("has_alipay", g.k(aVar, (Context) a10.f6607j, e.f10192d));
try {
if (((Context) a10.f6607j).getPackageManager().getPackageInfo("com.alipay.android.app", 128) != null) {
z10 = true;
}
} catch (PackageManager.NameNotFoundException unused) {
}
jSONObject3.put("has_msp_app", z10);
jSONObject3.put("app_key", "2014052600006128");
jSONObject3.put("utdid", a10.f());
jSONObject3.put("new_client_key", a11.f15453b);
jSONObject3.put("pa", n2.d.a((Context) a10.f6607j));
} catch (Throwable th) {
l2.a.d(aVar, "biz", "BodyErr", th);
n.b.e(th);
}
return jSONObject3.toString();
}
public Map<String, String> c(boolean z10, String str) {
HashMap hashMap = new HashMap();
hashMap.put("msp-gzip", String.valueOf(z10));
hashMap.put("Operation-Type", "alipay.msp.cashier.dispatch.bytes");
hashMap.put("content-type", "application/octet-stream");
hashMap.put("Version", "2.0");
hashMap.put("AppId", "TAOBAO");
String str2 = "";
if (!TextUtils.isEmpty(str)) {
String[] split = str.split("&");
if (split.length != 0) {
String str3 = null;
String str4 = null;
String str5 = null;
String str6 = null;
for (String str7 : split) {
if (TextUtils.isEmpty(str3)) {
str3 = !str7.contains("biz_type") ? null : a3.c.r(str7);
}
if (TextUtils.isEmpty(str4)) {
str4 = !str7.contains("biz_no") ? null : a3.c.r(str7);
}
if (TextUtils.isEmpty(str5)) {
str5 = (!str7.contains("trade_no") || str7.startsWith("out_trade_no")) ? null : a3.c.r(str7);
}
if (TextUtils.isEmpty(str6)) {
str6 = !str7.contains("app_userid") ? null : a3.c.r(str7);
}
}
StringBuilder sb2 = new StringBuilder();
if (!TextUtils.isEmpty(str3)) {
sb2.append("biz_type=" + str3 + ";");
}
if (!TextUtils.isEmpty(str4)) {
sb2.append("biz_no=" + str4 + ";");
}
if (!TextUtils.isEmpty(str5)) {
sb2.append("trade_no=" + str5 + ";");
}
if (!TextUtils.isEmpty(str6)) {
sb2.append("app_userid=" + str6 + ";");
}
String sb3 = sb2.toString();
if (sb3.endsWith(";")) {
sb3 = sb3.substring(0, sb3.length() - 1);
}
str2 = sb3;
}
}
hashMap.put("Msp-Param", str2);
hashMap.put("des-mode", "CBC");
return hashMap;
}
public abstract JSONObject d();
public a f(t2.a aVar, Context context, String str) {
if (context != null) {
TextUtils.isEmpty("https://mobilegw.alipay.com/mgw.htm");
}
return g(aVar, context, str, "https://mobilegw.alipay.com/mgw.htm", true);
}
public final a g(t2.a aVar, Context context, String str, String str2, boolean z10) {
byte[] bArr;
boolean z11;
boolean z12;
byte[] a10;
a.b b10;
ByteArrayInputStream byteArrayInputStream;
ByteArrayInputStream byteArrayInputStream2;
String str3;
String str4;
a aVar2;
JSONObject jSONObject;
Throwable th;
ByteArrayOutputStream byteArrayOutputStream;
ByteArrayOutputStream byteArrayOutputStream2;
byte[] bArr2;
ByteArrayOutputStream byteArrayOutputStream3;
n.b.r("mspl", "Packet: " + str2);
b bVar = new b(true, 0);
String j10 = j();
String b11 = b(aVar, str, d());
Map<String, String> c10 = c(false, str);
String str5 = c10.get("iSr");
byte[] bytes = j10.getBytes();
byte[] bytes2 = b11.getBytes();
try {
bArr = z.i(bytes2);
z11 = true;
} catch (Exception unused) {
bArr = bytes2;
z11 = false;
}
if (bVar.f13842a) {
String str6 = (String) bVar.f13843b;
try {
try {
PublicKey generatePublic = KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(o2.a.b(z2.b.f18305j)));
Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
cipher.init(1, generatePublic);
byte[] bytes3 = str6.getBytes("UTF-8");
int blockSize = cipher.getBlockSize();
byteArrayOutputStream2 = new ByteArrayOutputStream();
for (int i2 = 0; i2 < bytes3.length; i2 += blockSize) {
try {
byteArrayOutputStream2.write(cipher.doFinal(bytes3, i2, bytes3.length - i2 < blockSize ? bytes3.length - i2 : blockSize));
} catch (Exception e10) {
e = e10;
n.b.e(e);
if (byteArrayOutputStream2 != null) {
byteArrayOutputStream3 = byteArrayOutputStream2;
bArr2 = null;
byteArrayOutputStream3.close();
a10 = b.a(bytes, bArr2, z2.a.m((String) bVar.f13843b, bArr, str5));
z12 = true;
b10 = p2.a.b(context, new a.C0225a(str2, c(z11, str), a10));
if (b10 != null) {
}
} else {
bArr2 = null;
a10 = b.a(bytes, bArr2, z2.a.m((String) bVar.f13843b, bArr, str5));
z12 = true;
b10 = p2.a.b(context, new a.C0225a(str2, c(z11, str), a10));
if (b10 != null) {
}
}
}
}
bArr2 = byteArrayOutputStream2.toByteArray();
byteArrayOutputStream3 = byteArrayOutputStream2;
} catch (Throwable th2) {
byteArrayOutputStream = 1;
th = th2;
if (byteArrayOutputStream != null) {
try {
byteArrayOutputStream.close();
} catch (IOException e11) {
n.b.e(e11);
}
}
throw th;
}
} catch (Exception e12) {
e = e12;
byteArrayOutputStream2 = null;
} catch (Throwable th3) {
th = th3;
byteArrayOutputStream = null;
if (byteArrayOutputStream != null) {
}
throw th;
}
try {
byteArrayOutputStream3.close();
} catch (IOException e13) {
n.b.e(e13);
}
a10 = b.a(bytes, bArr2, z2.a.m((String) bVar.f13843b, bArr, str5));
z12 = true;
} else {
z12 = true;
a10 = b.a(bytes, bArr);
}
b10 = p2.a.b(context, new a.C0225a(str2, c(z11, str), a10));
if (b10 != null) {
boolean h10 = h(b10);
byte[] bArr3 = b10.f13022b;
String str7 = c10.get("iSr");
try {
try {
byteArrayInputStream2 = new ByteArrayInputStream(bArr3);
try {
byte[] bArr4 = new byte[5];
byteArrayInputStream2.read(bArr4);
byte[] bArr5 = new byte[Integer.parseInt(new String(bArr4))];
byteArrayInputStream2.read(bArr5);
str3 = new String(bArr5);
try {
byte[] bArr6 = new byte[5];
byteArrayInputStream2.read(bArr6);
int parseInt = Integer.parseInt(new String(bArr6));
if (parseInt > 0) {
byte[] bArr7 = new byte[parseInt];
byteArrayInputStream2.read(bArr7);
if (bVar.f13842a) {
bArr7 = z2.a.w((String) bVar.f13843b, bArr7, str7);
}
if (h10) {
bArr7 = z.p(bArr7);
}
str4 = new String(bArr7);
} else {
str4 = null;
}
try {
byteArrayInputStream2.close();
} catch (Exception unused2) {
}
} catch (Exception e14) {
e = e14;
n.b.e(e);
if (byteArrayInputStream2 != null) {
try {
byteArrayInputStream2.close();
} catch (Exception unused3) {
}
}
str4 = null;
if (str3 == null) {
}
if (aVar2 == null) {
}
}
} catch (Exception e15) {
e = e15;
str3 = null;
n.b.e(e);
if (byteArrayInputStream2 != null) {
}
str4 = null;
if (str3 == null) {
}
if (aVar2 == null) {
}
}
} catch (Throwable th4) {
th = th4;
byteArrayInputStream = c10;
if (byteArrayInputStream != 0) {
try {
byteArrayInputStream.close();
} catch (Exception unused4) {
}
}
throw th;
}
} catch (Exception e16) {
e = e16;
byteArrayInputStream2 = null;
} catch (Throwable th5) {
th = th5;
byteArrayInputStream = 0;
if (byteArrayInputStream != 0) {
}
throw th;
}
aVar2 = (str3 == null || str4 != null) ? new a(str3, str4, 0) : null;
if (aVar2 == null) {
return aVar2;
}
String str8 = aVar2.f13840b;
if (!TextUtils.isEmpty(str8)) {
try {
jSONObject = new JSONObject(str8).getJSONObject("data");
} catch (JSONException e17) {
n.b.e(e17);
}
if (jSONObject.has("params")) {
String optString = jSONObject.getJSONObject("params").optString("public_key", null);
if (!TextUtils.isEmpty(optString)) {
n2.d.c(optString);
return (z12 && z10) ? g(aVar, context, str, str2, false) : aVar2;
}
}
}
z12 = false;
if (z12) {
return aVar2;
}
}
throw new RuntimeException("Response is null.");
}
public String i() {
return "4.9.0";
}
public String j() {
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("device", Build.MODEL);
hashMap.put("namespace", "com.alipay.mobilecashier");
hashMap.put("api_name", "com.alipay.mcpay");
hashMap.put("api_version", i());
return a(hashMap, new HashMap<>());
}
}