CarrotChat v2.8.80.240429版本的 MD5 值为:fdf98761f01e715a89df24b85b0d206e

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


package com.mobile.auth.gatewayauth.network;

import com.mobile.auth.gatewayauth.ExceptionProcessor;
import com.mobile.auth.gatewayauth.annotations.SafeProtector;
import com.mobile.auth.gatewayauth.utils.i;
import com.mobile.auth.gatewayauth.utils.j;
import e1.a;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.SocketTimeoutException;
import java.net.URL;
import java.util.Map;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLSession;
import org.apache.http.HttpHeaders;

@SafeProtector
public class TopRequestUtils {
    private static final String APP_KEY = "25331768";
    private static final String CHARSET_UTF8 = "utf-8";
    private static final String CONTENT_ENCODING_GZIP = "gzip";
    private static final String SERVER_URL_HOST;
    private static final String SIGN_METHOD_HMAC = "hmac";
    private static final String SIGN_METHOD_MD5 = "md5";
    private static final HostnameVerifier mHostVerifier;

    static {
        a.SLoad("pns-2.13.2.1-LogOnlineStandardCuumRelease_alijtca_plus");
        SERVER_URL_HOST = j.a("https://dypnsapi.aliyuncs.com/?");
        mHostVerifier = new HostnameVerifier() {
            @Override
            public boolean verify(String str, SSLSession sSLSession) {
                try {
                    return HttpsURLConnection.getDefaultHostnameVerifier().verify(TopRequestUtils.SERVER_URL_HOST, sSLSession);
                } catch (Throwable th) {
                    try {
                        ExceptionProcessor.processException(th);
                        return false;
                    } catch (Throwable th2) {
                        ExceptionProcessor.processException(th2);
                        return false;
                    }
                }
            }
        };
    }

    private static native Map<String, String> assembleTopParameter(String str) throws IOException;

    private static native String buildQuery(Map<String, String> map, String str) throws IOException;

    private static native String byte2hex(byte[] bArr);

    private static native String callApi(URL url, Map<String, String> map) throws IOException;

    private static String callHttpsApi(URL url, Map<String, String> map) throws IOException {
        HttpsURLConnection httpsURLConnection;
        Throwable th;
        Object obj;
        Object obj2;
        ?? r02 = CHARSET_UTF8;
        String buildQuery = buildQuery(map, CHARSET_UTF8);
        InputStream inputStream = null;
        ?? r22 = new byte[0];
        if (buildQuery != null) {
            r22 = buildQuery.getBytes(CHARSET_UTF8);
        }
        try {
            try {
                httpsURLConnection = (HttpsURLConnection) url.openConnection();
                try {
                    httpsURLConnection.setDoOutput(true);
                    httpsURLConnection.setDoInput(true);
                    httpsURLConnection.setUseCaches(false);
                    httpsURLConnection.setRequestMethod("POST");
                    httpsURLConnection.setHostnameVerifier(mHostVerifier);
                    httpsURLConnection.setConnectTimeout(3000);
                    httpsURLConnection.setReadTimeout(3000);
                    httpsURLConnection.setRequestProperty("Host", url.getHost());
                    httpsURLConnection.setRequestProperty(HttpHeaders.ACCEPT, "text/xml,text/javascript");
                    httpsURLConnection.setRequestProperty("User-Agent", "top-sdk-java");
                    httpsURLConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
                    httpsURLConnection.connect();
                    url = httpsURLConnection.getOutputStream();
                    try {
                        url.write(r22);
                        inputStream = httpsURLConnection.getInputStream();
                        try {
                            r22 = new InputStreamReader(inputStream, CHARSET_UTF8);
                        } catch (SocketTimeoutException e10) {
                            e = e10;
                            obj2 = null;
                            throw e;
                        } catch (IOException e11) {
                            e = e11;
                            obj = null;
                            throw e;
                        } catch (Throwable th2) {
                            th = th2;
                            r22 = 0;
                            th = th;
                            r02 = r22;
                            if (inputStream != null) {
                                inputStream.close();
                            }
                            if (r22 != 0) {
                                r22.close();
                            }
                            if (r02 != 0) {
                                r02.close();
                            }
                            if (url != 0) {
                                url.close();
                            }
                            if (httpsURLConnection != null) {
                                httpsURLConnection.disconnect();
                            }
                            throw th;
                        }
                    } catch (SocketTimeoutException e12) {
                        e = e12;
                        obj2 = null;
                    } catch (IOException e13) {
                        e = e13;
                        obj = null;
                    } catch (Throwable th3) {
                        th = th3;
                        inputStream = null;
                        r22 = 0;
                    }
                    try {
                        BufferedReader bufferedReader = new BufferedReader(r22);
                        try {
                            StringBuffer stringBuffer = new StringBuffer();
                            while (true) {
                                String readLine = bufferedReader.readLine();
                                if (readLine == null) {
                                    break;
                                }
                                stringBuffer.append(readLine);
                            }
                            String str = new String(stringBuffer);
                            if (inputStream != null) {
                                inputStream.close();
                            }
                            r22.close();
                            bufferedReader.close();
                            url.close();
                            httpsURLConnection.disconnect();
                            if (i.a()) {
                                i.c("callHttpsApi:" + str);
                            }
                            return str;
                        } catch (SocketTimeoutException e14) {
                            throw e14;
                        } catch (IOException e15) {
                            throw e15;
                        }
                    } catch (SocketTimeoutException e16) {
                        throw e16;
                    } catch (IOException e17) {
                        throw e17;
                    } catch (Throwable th4) {
                        r02 = 0;
                        th = th4;
                        if (inputStream != null) {
                        }
                        if (r22 != 0) {
                        }
                        if (r02 != 0) {
                        }
                        if (url != 0) {
                        }
                        if (httpsURLConnection != null) {
                        }
                        throw th;
                    }
                } catch (SocketTimeoutException e18) {
                    throw e18;
                } catch (IOException e19) {
                    throw e19;
                } catch (Throwable th5) {
                    r02 = 0;
                    inputStream = null;
                    r22 = 0;
                    th = th5;
                    url = 0;
                }
            } catch (Throwable th6) {
                th = th6;
            }
        } catch (SocketTimeoutException e20) {
            throw e20;
        } catch (IOException e21) {
            throw e21;
        } catch (Throwable th7) {
            r02 = 0;
            inputStream = null;
            r22 = 0;
            httpsURLConnection = null;
            th = th7;
            url = 0;
        }
    }

    private static native byte[] encryptHMAC(String str, String str2) throws IOException;

    private static native byte[] encryptMD5(String str) throws IOException;

    private static native byte[] encryptMD5(byte[] bArr) throws IOException;

    public static native String getLifeBodyVerifyCertifyID(String str) throws IOException;

    private static native String getResponseAsString(HttpURLConnection httpURLConnection) throws IOException;

    private static native String getResponseCharset(String str);

    public static native String getSDKConfig(String str) throws IOException;

    private static native String getSecret1();

    private static native String getSecret2();

    private static native String getSecret3();

    private static native String getSecret4();

    private static native String getStreamAsString(InputStream inputStream, String str) throws IOException;

    public static native String getVendorList(String str, String str2) throws IOException;

    private static native boolean isNotEmpty(String str);

    private static native String signTopRequest(Map<String, String> map, String str, String str2) throws IOException;

    public static native String uploadUserTrackInfo(String str) throws IOException;
}