CarrotChat v2.8.60.240131版本的 MD5 值为:2baf8b9f31830b86b5c5a85ae6b47e05
以下内容为反编译后的 TopRequestUtils.java 源代码,内容仅作参考
package com.mobile.auth.gatewayauth.network;
import b.a.a.a;
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 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;
?? r0 = CHARSET_UTF8;
String buildQuery = buildQuery(map, CHARSET_UTF8);
InputStream inputStream = null;
?? r2 = new byte[0];
if (buildQuery != null) {
r2 = 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(r2);
inputStream = httpsURLConnection.getInputStream();
try {
r2 = new InputStreamReader(inputStream, CHARSET_UTF8);
} catch (SocketTimeoutException e2) {
e = e2;
obj2 = null;
throw e;
} catch (IOException e3) {
e = e3;
obj = null;
throw e;
} catch (Throwable th2) {
th = th2;
r2 = 0;
th = th;
r0 = r2;
if (inputStream != null) {
inputStream.close();
}
if (r2 != 0) {
r2.close();
}
if (r0 != 0) {
r0.close();
}
if (url != 0) {
url.close();
}
if (httpsURLConnection != null) {
httpsURLConnection.disconnect();
}
throw th;
}
} catch (SocketTimeoutException e4) {
e = e4;
obj2 = null;
} catch (IOException e5) {
e = e5;
obj = null;
} catch (Throwable th3) {
th = th3;
inputStream = null;
r2 = 0;
}
try {
BufferedReader bufferedReader = new BufferedReader(r2);
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();
}
r2.close();
bufferedReader.close();
url.close();
httpsURLConnection.disconnect();
if (i.a()) {
i.c("callHttpsApi:" + str);
}
return str;
} catch (SocketTimeoutException e6) {
throw e6;
} catch (IOException e7) {
throw e7;
}
} catch (SocketTimeoutException e8) {
throw e8;
} catch (IOException e9) {
throw e9;
} catch (Throwable th4) {
r0 = 0;
th = th4;
if (inputStream != null) {
}
if (r2 != 0) {
}
if (r0 != 0) {
}
if (url != 0) {
}
if (httpsURLConnection != null) {
}
throw th;
}
} catch (SocketTimeoutException e10) {
throw e10;
} catch (IOException e11) {
throw e11;
} catch (Throwable th5) {
r0 = 0;
inputStream = null;
r2 = 0;
th = th5;
url = 0;
}
} catch (Throwable th6) {
th = th6;
}
} catch (SocketTimeoutException e12) {
throw e12;
} catch (IOException e13) {
throw e13;
} catch (Throwable th7) {
r0 = 0;
inputStream = null;
r2 = 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;
}