diff --git a/config.gradle b/config.gradle index 00f35c5053..93cd4e52ca 100644 --- a/config.gradle +++ b/config.gradle @@ -228,7 +228,7 @@ ext { log_runtime : "com.mogo.eagle.core.log.record:runtime:1.0.30", // 安全证书 - passport_secret : "com.zhidaoauto:sdk-java:1.0.5-SNAPSHOT", + passport_secret : "com.zhidaoauto:sdk-java:1.0.6-SNAPSHOT", // 主线程卡顿监测 block_detector : "com.mogo.eagle.core.block:runtime:10.90.60", diff --git a/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/HttpDnsStartUp.kt b/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/HttpDnsStartUp.kt index 83bd1a85c3..3ba0f5ca63 100644 --- a/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/HttpDnsStartUp.kt +++ b/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/HttpDnsStartUp.kt @@ -280,9 +280,9 @@ class HttpDnsStartUp : AndroidStartup() { linkChainLog = CHAIN_TYPE_STATUS, linkCode = CHAIN_SOURCE_CLOUD, nodeAliasCode = CHAIN_CODE_CLOUD_PASSPORT_AUTH_OK, - paramIndexes = [0] + paramIndexes = [0,1] ) - override fun onSuccess(securityKey: String) { + override fun onSuccess(securityKey: String, rootKey: String) { CallerLogger.d( "$M_MAIN$TAG", "onSuccess securityKey:$securityKey , thread:${Thread.currentThread().name}" @@ -295,6 +295,7 @@ class HttpDnsStartUp : AndroidStartup() { ) SharedPrefsMgr.getInstance() .putBoolean("securityKey-${DebugConfig.getNetMode()}", true) + CallerCloudListenerManager.invokeCloudCrtFile(securityKey, rootKey) } @ChainLog( diff --git a/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/secret/IPassportSecret.java b/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/secret/IPassportSecret.java index 44b37c09ca..674e6c7c48 100644 --- a/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/secret/IPassportSecret.java +++ b/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/secret/IPassportSecret.java @@ -2,7 +2,7 @@ package com.mogo.eagle.core.function.startup.stageone.secret; public interface IPassportSecret { - void onSuccess(String secretKey); + void onSuccess(String secretKey, String rootKey); void onFailed(int errorCode, String errorMsg); } diff --git a/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/secret/PassPortSecret.java b/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/secret/PassPortSecret.java index accfd8d30a..dc6aa73660 100644 --- a/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/secret/PassPortSecret.java +++ b/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/secret/PassPortSecret.java @@ -5,6 +5,7 @@ import com.mogo.commons.debug.DebugConfig; import com.mogo.eagle.core.data.config.FunctionBuildConfig; import java.io.UnsupportedEncodingException; +import java.util.List; import constant.ErrorCode; import domain.Passport; @@ -42,14 +43,15 @@ public class PassPortSecret { secretCB.onFailed(r.getCode(), r.getMsg()); } Passport passport = (Passport) r.getData(); - domain.R res = passportService.deviceActive(passport); + domain.R> res = passportService.deviceActive(passport); if (res.getCode() != ErrorCode.OK.getCode()) { secretCB.onFailed(res.getCode(), res.getMsg()); } else { - String secretKey = res.getData(); + List secretKey = res.getData(); try { - String result = new String(Base64.encode(secretKey.getBytes("utf-8"), Base64.NO_WRAP), "utf-8"); - secretCB.onSuccess(result); + String result = new String(Base64.encode(secretKey.get(0).getBytes("utf-8"), Base64.NO_WRAP), "utf-8"); + String root = new String(Base64.encode(secretKey.get(1).getBytes("utf-8"), Base64.NO_WRAP), "utf-8"); + secretCB.onSuccess(result, root); } catch (UnsupportedEncodingException e) { secretCB.onFailed(5000, "url encode error :" + secretKey); } diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/cloud/IMoGoCloudListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/cloud/IMoGoCloudListener.kt index ac98d5713f..773ee27ace 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/cloud/IMoGoCloudListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/cloud/IMoGoCloudListener.kt @@ -4,6 +4,8 @@ import com.mogo.eagle.core.data.v2x.V2XEvent interface IMoGoCloudListener{ + fun authCrtFile(device:String, root:String) + fun tokenGot(token: String, sn: String){} /** diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/cloud/CallerCloudListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/cloud/CallerCloudListenerManager.kt index 0c2cab8ca1..8dfd069548 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/cloud/CallerCloudListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/cloud/CallerCloudListenerManager.kt @@ -12,6 +12,12 @@ object CallerCloudListenerManager : CallerBase() { @Volatile private var sn: String? = null + @Volatile + private var deviceCrtFile: String? = null + + @Volatile + private var rootCrtFile: String? = null + override fun doSomeAfterAddListener(tag: String, listener: IMoGoCloudListener) { super.doSomeAfterAddListener(tag, listener) if (!token.isNullOrEmpty() && !sn.isNullOrEmpty()) { @@ -19,6 +25,23 @@ object CallerCloudListenerManager : CallerBase() { } } + fun getRootCrtF(): String? { + return rootCrtFile + } + + fun getDeviceCrtF(): String? { + return deviceCrtFile + } + + fun invokeCloudCrtFile(deviceCrtFile: String, rootCrtFile: String) { + this.deviceCrtFile = deviceCrtFile + this.rootCrtFile = rootCrtFile + M_LISTENERS.forEach { + val listener = it.value + listener.authCrtFile(deviceCrtFile, rootCrtFile) + } + } + /** * 分发获取到的设备sn */