QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685

以下内容为反编译后的 JsonProxyRequest.java 源代码,内容仅作参考


package com.tencent.mtt.external.novel.base.recharge.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.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 {

    private int f54623d = 0;

    public boolean f54620a = true;

    public String f54621b = "";

    public JSONObject f54622c = null;
    private int e = 0;
    private IJsonProxyRequestCallBack f = null;
    private boolean g = false;

    public static String a(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 "";
        }
    }

    private static String a(String str, String str2, String str3) {
        try {
            String a2 = a("data=" + a(str2));
            return new URL(str) + "/?reqsig=" + a(Base64.encodeToString(a(("POST&" + a("/") + ContainerUtils.FIELD_DELIMITER + a2).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 void b(int i) {
        this.f54623d = i;
    }

    @Override
    public byte[] getPostData() {
        JSONObject jSONObject = this.f54622c;
        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 = this.f54623d;
        String str = "https://open.html5.qq.com";
        if (i != 0) {
            if (i == 1) {
                str = "http://dev.open.html5.qq.com";
            } else if (i == 2) {
                str = "http://jsonproxy.cs0309.imtt.qq.com";
            }
        }
        if (!this.f54620a || TextUtils.isEmpty(this.f54621b)) {
            this.mUrl = str;
        } else {
            this.mUrl = a(str, this.f54622c.toString(), this.f54621b);
        }
        return this.mUrl;
    }
}