Explorar o código

v1.0.0开发:native层加密方案优化

#Suyghur %!s(int64=3) %!d(string=hai) anos
pai
achega
6e161fee9d

+ 11 - 8
demo/src/main/java/com/yyxxgame/columbus/DemoActivity.kt

@@ -11,6 +11,8 @@ import android.view.View
 import android.widget.*
 import cn.yyxx.eyuangame.base.EYuanGame
 import cn.yyxx.eyuangame.base.internal.ICallback
+import cn.yyxx.eyuangame.base.utils.Logger
+import cn.yyxx.eyuangame.core.impl.SdkDrive
 import cn.yyxx.support.hawkeye.LogUtils
 import kotlin.system.exitProcess
 
@@ -29,10 +31,6 @@ class DemoActivity : Activity(), View.OnClickListener {
         Item(4, "04 角色登录上报"),
         Item(5, "05 角色升级上报"),
         Item(6, "06 定额充值"),
-        Item(7, "07 模拟写入5条账号信息"),
-        Item(8, "08 模拟写入游客登录信息"),
-        Item(9, "09 模拟写入Facebook登录信息"),
-        Item(10, "10 模拟写入Google登录信息")
     )
 
 
@@ -106,14 +104,19 @@ class DemoActivity : Activity(), View.OnClickListener {
                     EYuanGame.getInstance().logout(this@DemoActivity, object : ICallback {
                         override fun onResult(code: Int, result: String) {
                             if (code == 0) {
-                                EYuanGame.getInstance().login(this@DemoActivity, false, object : ICallback {
-                                    override fun onResult(code: Int, result: String) {
-                                    }
-                                })
+                                EYuanGame.getInstance()
+                                    .login(this@DemoActivity, false, object : ICallback {
+                                        override fun onResult(code: Int, result: String) {
+                                        }
+                                    })
                             }
                         }
                     })
                 }
+                3 -> {
+                    val result = SdkDrive.instance.test()
+                    Logger.d(result)
+                }
             }
         }
     }

+ 14 - 6
library_core/src/main/cpp/aes_utils.cpp

@@ -7,7 +7,8 @@
 #include <toolkit.h>
 #include "include/aes/aes_utils.h"
 
-static const unsigned char HEX[16] = {0x10, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f};
+static const unsigned char HEX[16] = {0x10, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
+                                      0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f};
 
 static const unsigned char CHAR_SET[36] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
                                            'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
@@ -66,12 +67,17 @@ void AesUtils::RemovePadding(uint8_t *out, size_t length) {
 }
 
 char *AesUtils::GetRawKey() {
-    uint8_t *random_key = GetKey();
+    const int len = 26;
     time_t ts = time(nullptr);
-    char *key = static_cast<char *>(malloc(33));
-    sprintf(key, "%ld%s", ts, random_key);
-    key[33] = '\0';
-    return key;
+    srandom(ts);
+    auto *raw_key = static_cast<char *>(malloc(len + 1));
+    memset(raw_key, 0, len + 1);
+    for (int i = 0; i < 16; ++i) {
+        raw_key[i] = CHAR_SET[random() % 36];
+    }
+    sprintf(raw_key, "%s%ld", raw_key, ts);
+    raw_key[len] = '\0';
+    return raw_key;
 }
 
 uint8_t *AesUtils::GetKey() {
@@ -133,7 +139,9 @@ char *AesUtils::Encrypt(const char *input, const uint8_t *key) {
  * AES解密, CBC, PKCS5Padding
  */
 char *AesUtils::Decrypt(const char *input, const uint8_t *key) {
+
     const uint8_t *iv = GetIv(key);
+//    const uint8_t *iv = reinterpret_cast<const uint8_t *>(ToolKit::StrReverse(reinterpret_cast<const char *>(key)));
 
     size_t len = strlen(input);
     unsigned char *input_des = HexUtils::HexDecode(input);

+ 3 - 3
library_core/src/main/cpp/include/aes/aes.h

@@ -2,8 +2,8 @@
 // Created by #Suyghur, on 2021/06/11.
 //
 
-#ifndef COLUMBUS_AES_H
-#define COLUMBUS_AES_H
+#ifndef EYUANGAMESDK_KTX_AES_H
+#define EYUANGAMESDK_KTX_AES_H
 
 // #define the macros below to 1/0 to enable/disable the mode of operation.
 //
@@ -55,4 +55,4 @@ void AES_CTR_xcrypt_buffer(uint8_t *output, uint8_t *input, uint32_t length, con
 
 #endif // #if defined(CTR) && (CTR == 1)
 
-#endif //COLUMBUS_AES_H
+#endif //EYUANGAMESDK_KTX_AES_H

+ 3 - 3
library_core/src/main/cpp/include/aes/aes_utils.h

@@ -2,8 +2,8 @@
 // Created by #Suyghur, on 2021/06/11.
 //
 
-#ifndef COLUMBUS_AES_UTILS_H
-#define COLUMBUS_AES_UTILS_H
+#ifndef EYUANGAMESDK_KTX_AES_UTILS_H
+#define EYUANGAMESDK_KTX_AES_UTILS_H
 
 #include "aes.h"
 
@@ -50,4 +50,4 @@ private:
 #endif
 
 
-#endif //COLUMBUS_AES_UTILS_H
+#endif //EYUANGAMESDK_KTX_AES_UTILS_H

+ 3 - 3
library_core/src/main/cpp/include/comm_map.h

@@ -2,8 +2,8 @@
 // Created by #Suyghur, on 2021/06/21.
 //
 
-#ifndef COLUMBUS_COMM_MAP_H
-#define COLUMBUS_COMM_MAP_H
+#ifndef EYUANGAMESDK_KTX_COMM_MAP_H
+#define EYUANGAMESDK_KTX_COMM_MAP_H
 
 
 #include <jni.h>
@@ -24,4 +24,4 @@ private:
 };
 
 
-#endif //COLUMBUS_COMM_MAP_H
+#endif //EYUANGAMESDK_KTX_COMM_MAP_H

+ 3 - 3
library_core/src/main/cpp/include/hex_utils.h

@@ -2,8 +2,8 @@
 // Created by #Suyghur, on 2021/06/11.
 //
 
-#ifndef COLUMBUS_HEX_UTILS_H
-#define COLUMBUS_HEX_UTILS_H
+#ifndef EYUANGAMESDK_KTX_HEX_UTILS_H
+#define EYUANGAMESDK_KTX_HEX_UTILS_H
 
 #include <stdlib.h>
 #include <string.h>
@@ -27,4 +27,4 @@ private:
 }
 #endif
 
-#endif //COLUMBUS_HEX_UTILS_H
+#endif //EYUANGAMESDK_KTX_HEX_UTILS_H

+ 3 - 3
library_core/src/main/cpp/include/logger.h

@@ -2,8 +2,8 @@
 // Created by #Suyghur, on 2021/06/11.
 //
 
-#ifndef COLUMBUS_LOGGER_H
-#define COLUMBUS_LOGGER_H
+#ifndef EYUANGAMESDK_KTX_LOGGER_H
+#define EYUANGAMESDK_KTX_LOGGER_H
 
 #include <string>
 #include <android/log.h>
@@ -28,4 +28,4 @@ public:
 
 };
 
-#endif //COLUMBUS_LOGGER_H
+#endif //EYUANGAMESDK_KTX_LOGGER_H

+ 7 - 7
library_core/src/main/cpp/include/md5/md5.h

@@ -2,8 +2,8 @@
 // Created by #Suyghur, on 2021/05/25.
 //
 
-#ifndef QSGAMESDK_MD5_H
-#define QSGAMESDK_MD5_H
+#ifndef EYUANGAMESDK_KTX_MD5_H
+#define EYUANGAMESDK_KTX_MD5_H
 
 
 #include <string>
@@ -16,9 +16,9 @@
 // usage:
 //      1) feed it blocks of uchars with update()
 //      2) finalize()
-//      3) get hexdigest() string
+//      3) get HexDigest() string
 //      or
-//      MD5(std::string).hexdigest()
+//      MD5(std::string).HexDigest()
 //
 // assumes that char is 8 bit and int is 32 bit
 class MD5 {
@@ -35,7 +35,7 @@ public:
 
     MD5 &finalize();
 
-    std::string hexdigest() const;
+    std::string HexDigest() const;
 
     friend std::ostream &operator<<(std::ostream &, MD5 md5);
 
@@ -80,7 +80,7 @@ private:
     static inline void II(uint4 &a, uint4 b, uint4 c, uint4 d, uint4 x, uint4 s, uint4 ac);
 };
 
-std::string md5(const std::string str);
+std::string md5(const std::string& str);
 
 
-#endif //QSGAMESDK_MD5_H
+#endif //EYUANGAMESDK_KTX_MD5_H

+ 3 - 3
library_core/src/main/cpp/include/params_kit.h

@@ -2,8 +2,8 @@
 // Created by #Suyghur, on 2021/06/21.
 //
 
-#ifndef COLUMBUS_PARAMS_KIT_H
-#define COLUMBUS_PARAMS_KIT_H
+#ifndef EYUANGAMESDK_KTX_PARAMS_KIT_H
+#define EYUANGAMESDK_KTX_PARAMS_KIT_H
 
 
 #include <string>
@@ -28,4 +28,4 @@ private:
 };
 
 
-#endif //COLUMBUS_PARAMS_KIT_H
+#endif //EYUANGAMESDK_KTX_PARAMS_KIT_H

+ 3 - 3
library_core/src/main/cpp/include/request_kit.h

@@ -2,8 +2,8 @@
 // Created by #Suyghur, on 2021/06/21.
 //
 
-#ifndef COLUMBUS_REQUEST_KIT_H
-#define COLUMBUS_REQUEST_KIT_H
+#ifndef EYUANGAMESDK_KTX_REQUEST_KIT_H
+#define EYUANGAMESDK_KTX_REQUEST_KIT_H
 
 #define PUBLIC_KEY "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCbROlODv7iVaFhRAomQ9kSoV+whoebwVUDWUd968V8jbLQg0bAh6ad22O1bo33f4zNmIuDzdQMGOVgRyuvKsS9GyE+gh4XPDpSUmi/bZTl0wr8Y/yTi8eW+sXxn6Ao4oo4bg+qPewUxjTS2u4Pe1Zl3IC48HFALTAo0PSSXS5b7wIDAQAB"
 
@@ -30,4 +30,4 @@ private:
 };
 
 
-#endif //COLUMBUS_REQUEST_KIT_H
+#endif //EYUANGAMESDK_KTX_REQUEST_KIT_H

+ 6 - 4
library_core/src/main/cpp/include/toolkit.h

@@ -2,8 +2,8 @@
 // Created by #Suyghur, on 2021/06/12.
 //
 
-#ifndef COLUMBUS_TOOLKIT_H
-#define COLUMBUS_TOOLKIT_H
+#ifndef EYUANGAMESDK_KTX_TOOLKIT_H
+#define EYUANGAMESDK_KTX_TOOLKIT_H
 
 
 #include <jni.h>
@@ -46,9 +46,11 @@ public:
 
     static std::string ToJsonString(const Json::Value &root);
 
-    static Json::Value ToJsonObject(const std::string& json);
+    static Json::Value ToJsonObject(const std::string &json);
+
+    static char *StrReverse(const char *src);
 
 };
 
 
-#endif //COLUMBUS_TOOLKIT_H
+#endif //EYUANGAMESDK_KTX_TOOLKIT_H

+ 3 - 3
library_core/src/main/cpp/include/url_utils.h

@@ -2,8 +2,8 @@
 // Created by #Suyghur, on 2021/06/22.
 //
 
-#ifndef COLUMBUS_URL_UTILS_H
-#define COLUMBUS_URL_UTILS_H
+#ifndef EYUANGAMESDK_KTX_URL_UTILS_H
+#define EYUANGAMESDK_KTX_URL_UTILS_H
 
 
 #include <string>
@@ -16,4 +16,4 @@ public:
 };
 
 
-#endif //COLUMBUS_URL_UTILS_H
+#endif //EYUANGAMESDK_KTX_URL_UTILS_H

+ 4 - 4
library_core/src/main/cpp/md5.cpp

@@ -293,7 +293,7 @@ MD5 &MD5::finalize() {
 //////////////////////////////
 
 // return hex representation of digest as string
-std::string MD5::hexdigest() const {
+std::string MD5::HexDigest() const {
     if (!finalized)
         return "";
 
@@ -308,13 +308,13 @@ std::string MD5::hexdigest() const {
 //////////////////////////////
 
 std::ostream &operator<<(std::ostream &out, MD5 md5) {
-    return out << md5.hexdigest();
+    return out << md5.HexDigest();
 }
 
 //////////////////////////////
 
-std::string md5(const std::string str) {
+std::string md5(const std::string& str) {
     MD5 md5 = MD5(str);
 
-    return md5.hexdigest();
+    return md5.HexDigest();
 }

+ 1 - 1
library_core/src/main/cpp/request_kit.cpp

@@ -26,7 +26,7 @@
 //    root["ts"] = ts;
 //    return ToolKit::ToJsonString(root);
 //}
-//
+
 //std::string RequestKit::DecryptResponse(JNIEnv *env, jobject context, jstring data) {
 //    //报文原文
 //    return HandleResponse(env, data);

+ 23 - 9
library_core/src/main/cpp/sdk_drive.cpp

@@ -41,18 +41,25 @@ static jstring GetParam(JNIEnv *env, jobject thiz, jstring key) {
 static jstring InvokeJob(JNIEnv *env, jobject thiz, jobject context, jstring key, jstring data) {
     const char *key_ = env->GetStringUTFChars(key, JNI_FALSE);
     const char *data_ = env->GetStringUTFChars(data, JNI_FALSE);
-//    Json::Value root = ToolKit::ToJsonObject(data_);
-//    if (root.)
-//    LOGD("aaaaa , %s", data_);
-//    LOGD("json str %s", root.asCString());
-//    std::string raw = ToolKit::ToJsonString(root);
-//    LOGD("aes key : %s", raw);
-    char *enc = AesUtils::Encrypt(data_, reinterpret_cast<const uint8_t *>(key_));
-    jstring result = ToolKit::GetJString(env, enc);
+
+    //添加公共参数
+    Json::Value root = ToolKit::ToJsonObject(data_);
+    root["common"] = CommMap::GetInstance()->comm_params;
+
+    //生成aes key
+//    char *raw_key = AesUtils::GetRawKey();
+//    std::string md5_key = md5(raw_key);
+//    auto *key64= static_cast<char *>(malloc(65));
+//    memset(key64,0,64);
+//    sprintf(key64,"%s%s",md5_key,reverse(md5_key.begin(),md5_key.end()))
+//    std::string  aes_key=md5()
+    LOGD("test : %s", ToolKit::StrReverse(key_));
+    char *p = AesUtils::Encrypt(ToolKit::ToJsonString(root).c_str(), reinterpret_cast<const uint8_t *>(key_));
+    jstring result = ToolKit::GetJString(env, p);
     env->ReleaseStringUTFChars(key, key_);
     env->ReleaseStringUTFChars(data, data_);
 //    delete (raw);
-    free(enc);
+    free(p);
     return result;
 
 //    std::string enc = RequestKit::EncryptRequest2(env, context, data);
@@ -102,6 +109,12 @@ static jstring ParseJob(JNIEnv *env, jobject thiz, jobject context, jstring key,
 //    return env->NewStringUTF("");
 }
 
+static jstring Test(JNIEnv *env, jobject thiz) {
+    char *key = AesUtils::GetRawKey();
+    jstring result = ToolKit::GetJString(env, key);
+    free(key);
+    return result;
+}
 
 static JNINativeMethod gMethod[] = {
         {"initSdkDrive", "(Landroid/content/Context;)V",                                                      (void *) InitSdkDrive},
@@ -109,6 +122,7 @@ static JNINativeMethod gMethod[] = {
         {"getParam",     "(Ljava/lang/String;)Ljava/lang/String;",                                            (void *) GetParam},
         {"invokeJob",    "(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", (void *) InvokeJob},
         {"parseJob",     "(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", (void *) ParseJob},
+        {"test",         "()Ljava/lang/String;",                                                              (void *) Test},
 };
 
 extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {

+ 14 - 0
library_core/src/main/cpp/toolkit.cpp

@@ -243,6 +243,20 @@ Json::Value ToolKit::ToJsonObject(const std::string &json) {
     return root;
 }
 
+char *ToolKit::StrReverse(const char *src) {
+    char *tmp = new char[strlen(src)];
+    strcpy(tmp, src);
+    char *ret = tmp;//用来最后返回数组指针
+    char *p = tmp + strlen(src) - 1;
+    while (p > tmp) {
+        char t = *tmp;
+        *tmp++ = *p;
+        *p-- = t;
+    }
+    free(p);
+    return ret;
+}
+
 
 
 

+ 5 - 5
library_core/src/main/java/cn/yyxx/eyuangame/core/impl/SdkBridgeImpl.kt

@@ -67,15 +67,15 @@ class SdkBridgeImpl(context: Context) {
 
     fun attachBaseContext(application: Application, context: Context) {
         Logger.initZap(application)
-        SdkDrive.initSdkDrive(application)
+        SdkDrive.instance.initSdkDrive(application)
         Logger.i("Columbus attachBaseContext ...")
         GAIDUtils.initGoogleAdid(application) { code, _ ->
             if (code == 0) {
                 Logger.i("谷歌框架可以访问,请求gaid")
-                SdkDrive.setParam("device_id", GAIDUtils.getGoogleAdid())
+                SdkDrive.instance.setParam("device_id", GAIDUtils.getGoogleAdid())
             } else {
                 Logger.e("谷歌框架不可访问,使用android id替代")
-                SdkDrive.setParam("device_id", DeviceInfoUtils.getAndroidDeviceId(application))
+                SdkDrive.instance.setParam("device_id", DeviceInfoUtils.getAndroidDeviceId(application))
             }
             hasReadGaid = true
         }
@@ -111,7 +111,7 @@ class SdkBridgeImpl(context: Context) {
         }
 
         //获取当前屏幕尺寸
-        SdkDrive.setParam("screen", DensityUtils.getResolutionByFullScreen(activity))
+        SdkDrive.instance.setParam("screen", DensityUtils.getResolutionByFullScreen(activity))
 
         if (!hasReadGaid) {
             Logger.e("还未完成gaid加载,将延迟初始化")
@@ -143,7 +143,7 @@ class SdkBridgeImpl(context: Context) {
     }
 
     private fun startSdkInit(activity: Activity, callback: ICallback, initCallback: IInitialize) {
-        SdkRequest.getInstance().initSdk(activity, object : IRequestCallback {
+        SdkRequest.instance.initSdk(activity, object : IRequestCallback {
             override fun onResponse(resultInfo: ResultInfo) {
                 if (resultInfo.code == 1 && !TextUtils.isEmpty(resultInfo.data)) {
                     initBean = InitBean.toBean(resultInfo.data)

+ 8 - 19
library_core/src/main/java/cn/yyxx/eyuangame/core/impl/SdkDrive.kt

@@ -6,7 +6,7 @@ import android.content.Context
  * @author #Suyghur.
  * Created on 2021/06/09
  */
-object SdkDrive {
+class SdkDrive {
 
     init {
         System.loadLibrary("columbus")
@@ -32,22 +32,11 @@ object SdkDrive {
 
     external fun parseJob(context: Context, key: String, data: String): String
 
-//    companion object {
-//        @JvmStatic
-//        @Keep
-//        fun getInstance(): SdkDrive {
-//            return SdkDriveHolder.INSTANCE
-//        }
-//
-//        private object SdkDriveHolder {
-//            val INSTANCE: SdkDrive = SdkDrive()
-//        }
-//
-//        /**
-//         * 防止单例对象在反序列化时重新生成对象
-//         */
-//        private fun readResolve(): Any {
-//            return SdkDriveHolder.INSTANCE
-//        }
-//    }
+    external fun test(): String
+
+    companion object {
+        val instance: SdkDrive by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
+            SdkDrive()
+        }
+    }
 }

+ 2 - 2
library_core/src/main/java/cn/yyxx/eyuangame/core/impl/login/UserSignInImpl.kt

@@ -152,7 +152,7 @@ class UserSignInImpl constructor(val activity: LoginActivity, private val callba
             val registerParams = JSONObject()
             registerParams.put("uname", userName)
             registerParams.put("pwd", pwd)
-            SdkRequest.getInstance().registerUser(context, registerParams, object : IRequestCallback {
+            SdkRequest.instance.registerUser(context, registerParams, object : IRequestCallback {
                 override fun onResponse(resultInfo: ResultInfo) {
                     if (resultInfo.code == 1 && !TextUtils.isEmpty(resultInfo.data)) {
                         try {
@@ -189,7 +189,7 @@ class UserSignInImpl constructor(val activity: LoginActivity, private val callba
     }
 
     private fun userLoginVerify(context: Context, loginParams: JSONObject) {
-        SdkRequest.getInstance().userVerify(context, loginParams, object : IRequestCallback {
+        SdkRequest.instance.userLoginVerify(context, loginParams, object : IRequestCallback {
             override fun onResponse(resultInfo: ResultInfo) {
                 if (resultInfo.code == 1 && !TextUtils.isEmpty(resultInfo.data)) {
                     try {

+ 30 - 10
library_core/src/main/java/cn/yyxx/eyuangame/core/network/SdkRequest.kt

@@ -3,6 +3,8 @@ package cn.yyxx.eyuangame.core.network
 import android.content.Context
 import android.text.TextUtils
 import cn.yyxx.eyuangame.Version
+import cn.yyxx.eyuangame.base.entity.SdkChargeInfo
+import cn.yyxx.eyuangame.base.entity.SdkRoleInfo
 import cn.yyxx.eyuangame.base.utils.ParamsUtils
 import cn.yyxx.eyuangame.core.entity.LoginType
 import cn.yyxx.eyuangame.core.internal.IRequestCallback
@@ -19,15 +21,14 @@ import org.json.JSONObject
  */
 class SdkRequest {
 
-
     fun initSdk(context: Context, callback: IRequestCallback) {
         val jsonObject = JSONObject()
-        jsonObject.put("common", getCommon(context))
+//        jsonObject.put("common", getCommon(context))
         jsonObject.put("route_path", Host.BASIC_ROUTE_INIT_SDK)
         VolleyRequest.post(context, Host.HOST, jsonObject, callback)
     }
 
-    fun userVerify(context: Context, jsonObject: JSONObject, callback: IRequestCallback) {
+    fun userLoginVerify(context: Context, jsonObject: JSONObject, callback: IRequestCallback) {
         try {
             jsonObject.put("common", getCommon(context))
             if (jsonObject.getInt("login_type") == LoginType.TYPE_ACCOUNT_LOGIN) {
@@ -51,6 +52,30 @@ class SdkRequest {
         VolleyRequest.post(context, Host.HOST, jsonObject, callback)
     }
 
+    fun forgetUserPwd(context: Context, jsonObject: JSONObject, callback: IRequestCallback) {
+
+    }
+
+    fun modifyUserPwd(context: Context, jsonObject: JSONObject, callback: IRequestCallback) {
+
+    }
+
+    fun bindPhone(context: Context, jsonObject: JSONObject, callback: IRequestCallback) {
+
+    }
+
+    fun bindAccount(context: Context, jsonObject: JSONObject, callback: IRequestCallback) {
+
+    }
+
+    fun createOrder(context: Context, chargeInfo: SdkChargeInfo, callback: IRequestCallback) {
+
+    }
+
+    fun submitRoleData(context: Context, roleInfo: SdkRoleInfo, callback: IRequestCallback) {
+
+    }
+
     private fun getCommon(context: Context): JSONObject {
         val common = JSONObject()
         try {
@@ -83,13 +108,8 @@ class SdkRequest {
 
 
     companion object {
-        fun getInstance(): SdkRequest {
-            return RequestHolder.INSTANCE
-        }
-
-        private object RequestHolder {
-            val INSTANCE = SdkRequest()
+        val instance: SdkRequest by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
+            SdkRequest()
         }
     }
-
 }

+ 5 - 3
library_core/src/main/java/cn/yyxx/eyuangame/core/network/VolleyRequest.kt

@@ -33,7 +33,8 @@ object VolleyRequest {
             val rawKey = Md5Utils.encodeByMD5(randomKey)
             val aesKey = Md5Utils.encodeByMD5(rawKey + StrUtils.reverseString(rawKey))
 //            val p = AesUtils.encrypt(aesKey.substring(8, 24), jsonObject.toString())
-            val hexP = SdkDrive.invokeJob(context, aesKey.substring(8, 24), jsonObject.toString())
+            val hexP =
+                SdkDrive.instance.invokeJob(context, aesKey.substring(8, 24), jsonObject.toString())
             val tmp = HexUtils.hexString2Bytes(hexP)
             val p = Base64Utils.encode(tmp)
 
@@ -101,7 +102,8 @@ object VolleyRequest {
             }
             //设置超时时间
             request.retryPolicy = DefaultRetryPolicy(MAX_TIMEOUT, 1, 1.0f)
-            VolleySingleton.getInstance(context.applicationContext).addToRequestQueue(context.applicationContext, request)
+            VolleySingleton.getInstance(context.applicationContext)
+                .addToRequestQueue(context.applicationContext, request)
         } catch (e: Exception) {
             e.printStackTrace()
         }
@@ -120,7 +122,7 @@ object VolleyRequest {
             val base64P = data.getString("p")
             val tmp = Base64Utils.decode(base64P)
             val p = HexUtils.bytes2HexString(tmp)
-            return SdkDrive.parseJob(context, aesKey.substring(8, 24), p)
+            return SdkDrive.instance.parseJob(context, aesKey.substring(8, 24), p)
         } catch (e: JSONException) {
             e.printStackTrace()
         }