QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685
以下内容为反编译后的 JsonProxyRequest.java 源代码,内容仅作参考
package com.tencent.mtt.browser.openplatform.pay.jsonproxy;
import android.text.TextUtils;
import android.util.Base64;
import com.huawei.hms.framework.common.ContainerUtils;
import com.tencent.common.utils.Md5Utils;
import com.tencent.common.wup.IWUPRequestCallBack;
import com.tencent.common.wup.WUPRequestBase;
import com.tencent.mtt.browser.openplatform.utils.OpenPlatformUtils;
import com.xiaomi.mipush.sdk.Constants;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import org.json.JSONObject;
import org.slf4j.Marker;
public class JsonProxyRequest extends WUPRequestBase {
public boolean f43544a = true;
public String f43545b = "";
public JSONObject f43546c = null;
private int f43547d = 0;
private IJsonProxyRequestCallBack e = null;
private boolean f = false;
private static String a(String str, String str2, String str3) {
try {
String b2 = b("data=" + b(str2));
return new URL(str) + "/?reqsig=" + b(Base64.encodeToString(a(("POST&" + b("/") + ContainerUtils.FIELD_DELIMITER + b2).getBytes("UTF-8"), (Md5Utils.a(str3) + ContainerUtils.FIELD_DELIMITER).getBytes("UTF_8")), 2));
} catch (UnsupportedEncodingException | MalformedURLException | InvalidKeyException | NoSuchAlgorithmException unused) {
return null;
}
}
public static byte[] a(byte[] bArr, byte[] bArr2) throws InvalidKeyException, NoSuchAlgorithmException {
SecretKeySpec secretKeySpec = new SecretKeySpec(bArr2, "HmacSHA1");
Mac mac = Mac.getInstance("HmacSHA1");
mac.init(secretKeySpec);
return mac.doFinal(bArr);
}
public static String b(String str) {
try {
return URLEncoder.encode(str, "UTF-8").replace(Marker.ANY_MARKER, "%2A").replace("%7E", Constants.WAVE_SEPARATOR).replace(Marker.ANY_NON_NULL_MARKER, "%20");
} catch (UnsupportedEncodingException unused) {
return "";
}
}
public IJsonProxyRequestCallBack a() {
return this.e;
}
public void a(IJsonProxyRequestCallBack iJsonProxyRequestCallBack) {
this.e = iJsonProxyRequestCallBack;
}
public void a(String str) {
this.f43545b = str;
}
public void a(JSONObject jSONObject) {
this.f43546c = jSONObject;
}
public void a(boolean z) {
this.f = z;
}
public int b() {
return this.f43547d;
}
public void b(int i) {
this.f43547d = i;
}
public boolean c() {
return this.f;
}
@Override
public byte[] getPostData() {
JSONObject jSONObject = this.f43546c;
if (jSONObject == null) {
return null;
}
try {
return jSONObject.toString().getBytes("UTF-8");
} catch (UnsupportedEncodingException unused) {
return null;
}
}
@Override
public IWUPRequestCallBack getRequestCallBack() {
return super.getRequestCallBack();
}
@Override
public String getUrl() {
int i = OpenPlatformUtils.f43630a;
String str = "https://open.html5.qq.com";
if (i != 0 && i == 2) {
str = "http://jsonproxy.sparta.html5.qq.com";
}
if (!this.f43544a || TextUtils.isEmpty(this.f43545b)) {
this.mUrl = str;
} else {
this.mUrl = a(str, this.f43546c.toString(), this.f43545b);
}
return this.mUrl;
}
}