配置解密转义问题

This commit is contained in:
Martin 2024-09-10 13:41:16 +08:00
parent 2e1eb3c7b4
commit dee916ea7d
5 changed files with 13 additions and 9 deletions

View File

@ -48,6 +48,9 @@ public class JsonBean {
decodedData = Base64.getDecoder().decode(data);
}
String decryptedText = AesUtils.decryptToString(decodedData);
L.e("解码前:"+data);
L.e("解码前-转成base64"+decodedData);
L.e("解码前-解密後:"+decryptedText);
JSONObject object = JSON.parseObject(decryptedText);
try {
JSONArray jsonArray = object.getJSONArray("info");
@ -58,7 +61,6 @@ public class JsonBean {
resultData.setInfo(array);
resultData.setCode(object.getInteger("code"));
resultData.setMsg(object.getString("msg"));
L.e("这是一个数组");
}catch (Exception e) {
try {
String [] array = new String[1];
@ -66,7 +68,6 @@ public class JsonBean {
resultData.setInfo(array);
resultData.setCode(object.getInteger("code"));
resultData.setMsg(object.getString("msg"));
L.e("这是一个对象");
} catch (JSONException ex) {
L.e("字符串格式错误");
}

View File

@ -1003,7 +1003,7 @@ public class LiveHttpUtil {
}
public static void getRoomList(String sudGameId, String threshold, String roomHolderType, String liveUid, String currencyType, int page, HttpCallback callback) {
HttpClient.getInstance().get("huoquxingjitiaozhanzhuangtai", "huoquxingjitiaozhanzhuangtai")
HttpClient.getInstance().get("huoquyouxiliebiao", "huoquyouxiliebiao")
.params("sud_game_id", sudGameId)
.params("threshold", threshold)
.params("room_holder_type", roomHolderType)

View File

@ -1,5 +1,7 @@
package com.yunbao.common.utils;
import com.alibaba.fastjson.JSON;
import java.io.UnsupportedEncodingException;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
@ -50,7 +52,7 @@ public class AesUtils {
}
public static String decodeUnicode(String unicode) {
StringBuilder sb = new StringBuilder();
/* StringBuilder sb = new StringBuilder();
for (int i = 0; i < unicode.length();) {
if (unicode.charAt(i) == '\\') {
if (i + 5 < unicode.length()) {
@ -66,7 +68,7 @@ public class AesUtils {
}
}
sb.append(unicode.charAt(i++));
}
return sb.toString();
}*/
return JSON.parseObject(unicode).toString();
}
}

View File

@ -10,7 +10,7 @@ ext {
manifestPlaceholders = [
//
// serverHost : "https://napi.yaoulive.com",
serverHost : "https://napi.yaoulive.com",
serverHost : "https://api.poyoshow.com",
buildTime : new Date().format("MM-dd HH:mm", TimeZone.getTimeZone("GMT+8")),
testServerHost : "https://api.poyoshow.com",

View File

@ -14,6 +14,7 @@ import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.NotificationCompat;
import com.alibaba.fastjson.JSON;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.core.BottomPopupView;
import com.yunbao.common.dialog.GiftWallDialog;
@ -99,14 +100,14 @@ public class MainHomeViewHolder extends AbsMainHomeParentViewHolder {
});
}
private void testAes() {
String aesStr ="yvNHDY/jYopEYMnjYKzm5p0WfeP/IqahmtN/zY8kH5MYiLn1K6P57c+JkIBTySvRDcULlZCNJEPynx0Z6PcPwfLpWHTniDNKRYo3Hiw1iwI=";
String aesStr ="yvNHDY/jYopEYMnjYKzm5p0WfeP/IqahmtN/zY8kH5OyAUcmqc4igt/6eSslvgSKA0fX8/imr+yHfLb2DZNKI7bikEAuagiKvJdRZ9GIvw9mix5Ap0E/BGVe3DrirxKf3XrmJL8mONw4OTn7JmDStB/SMt3tgWP9bvjVwa66BcRcIaRSxbMDm/6dN7QsLtBMjx+XzpRocH2ISTLhEhuxbjz9ovIDwETx4IgPj4LuHcPERDSeNE9TC9UWHqIo+hWoUiGc8MhSh3uO7ptOzno6Dg9Zk4uxnKZdLYeR+M9JLaja6NMloza5IjI15CIcGVT9o4HLeUVodShZjFGsw7JfMcoUBhnQEOHPSh2S8q6Py0Z0ofiTsJWUj2+XwYwyvjxx";
//byte[] msg = AesUtils.decrypt(aesStr.getBytes(), "LhHBfcsN2VmBpHCn".getBytes());
byte[] decodedData = null;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
decodedData = Base64.getDecoder().decode(aesStr);
}
String decryptedText = AesUtils.decryptToString(decodedData);
L.e("decryptedText:"+decryptedText);
L.e("decryptedText:"+JSON.parseObject(decryptedText));
}
public void setCurPosition(int position) {
mViewPager.setCurrentItem(position);