[myflow升级md5和加密校验]
This commit is contained in:
yangyakun
2026-03-18 18:06:45 +08:00
parent 15f3a7b068
commit bd22a7198e
5 changed files with 133 additions and 1 deletions

View File

@@ -196,6 +196,10 @@ class UpgradeAppNetWorkManager private constructor() {
Log.d(TAG,"MyFLow网络请求返回${response}")
SharedPrefsMgr.getInstance().putString(SharedPrefsConstants.APP_UPGRADE_CONTENT_MyFlow, if (info.result != null) response + "--vin:$tempVin" else "info.result == null --vin:$tempVin --type:$type")
if (info.data != null) {
if(info.data.encKey!=null&&info.data.encMd5!=null){
val fileMd5 = AesEcbBase64Util.decryptFromBase64(info.data.encMd5,info.data.encKey)
SharedPrefsMgr.getInstance().putString(SharedPrefsConstants.APP_UPGRADE_CONTENT_MYFLOW_CHECKMD5,"${info.data.fileAddr}_$fileMd5")
}
runCatching {
block?.invoke(true, response)
}

View File

@@ -6,6 +6,8 @@ import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.function.api.upgrade.IMoGoUpgradeProvider
import com.mogo.eagle.core.function.call.base.CallerBase
import com.elegant.utils.UiThreadHandler
import com.mogo.commons.constants.SharedPrefsConstants
import com.mogo.commons.storage.SharedPrefsMgr
import com.mogo.eagle.core.data.obu.MogoObuConst
import com.mogo.eagle.core.function.api.devatools.IMogoDevaToolsUpgradeListener
import com.mogo.eagle.core.function.api.devatools.download.*
@@ -172,6 +174,19 @@ class UpgradeManager : IDownloadListener {
}
} else {
val apk = File(localPath)
val fileMd5WithUrl = SharedPrefsMgr.getInstance().getString(SharedPrefsConstants.APP_UPGRADE_CONTENT_MYFLOW_CHECKMD5)
if(fileMd5WithUrl.startsWith(downloadUrl)) {
Md5Util.getMd5FromFile(apk)?.let {fileMd5->
if(fileMd5WithUrl.endsWith(fileMd5)){
Logger.w(TAG, "md5校验通过...")
}else{
upgradeProvider?.recordTargetMd5CheckFailed("${StringUtils.getString(com.mogo.eagle.core.widget.R.string.module_core_compound_apk_md5_check_failed)}:[server_target_md5: ${fileMd5WithUrl}, file_md5: ${fileMd5}]")
Logger.w(TAG, "md5校验失败...")
// throw AssertionError("md5校验失败:[target:${patchInfo.targetMd5}]")
throw AssertionError("${StringUtils.getString(com.mogo.eagle.core.widget.R.string.module_core_md5_check_failed)}:[target:${fileMd5WithUrl}]")
}
}
}
upgradeProvider?.recordInstallStart()
withContext(Dispatchers.Main) {
ApkInstaller.installApp(Utils.getApp(), apk) { code, reason ->