pull/1994/head
kunfei 2 years ago
parent 94c6be7202
commit 3c840f5a55
  1. 18
      app/src/main/java/io/legado/app/help/JsExtensions.kt

@ -3,7 +3,6 @@ package io.legado.app.help
import android.net.Uri import android.net.Uri
import android.util.Base64 import android.util.Base64
import androidx.annotation.Keep import androidx.annotation.Keep
import cn.hutool.crypto.SecureUtil
import cn.hutool.crypto.digest.DigestUtil import cn.hutool.crypto.digest.DigestUtil
import cn.hutool.crypto.digest.HMac import cn.hutool.crypto.digest.HMac
import io.legado.app.constant.AppConst import io.legado.app.constant.AppConst
@ -11,7 +10,10 @@ import io.legado.app.constant.AppConst.dateFormat
import io.legado.app.constant.AppLog import io.legado.app.constant.AppLog
import io.legado.app.data.entities.BaseSource import io.legado.app.data.entities.BaseSource
import io.legado.app.exception.NoStackTraceException import io.legado.app.exception.NoStackTraceException
import io.legado.app.help.http.* import io.legado.app.help.http.BackstageWebView
import io.legado.app.help.http.CookieStore
import io.legado.app.help.http.SSLHelper
import io.legado.app.help.http.StrResponse
import io.legado.app.model.Debug import io.legado.app.model.Debug
import io.legado.app.model.analyzeRule.AnalyzeUrl import io.legado.app.model.analyzeRule.AnalyzeUrl
import io.legado.app.model.analyzeRule.QueryTTF import io.legado.app.model.analyzeRule.QueryTTF
@ -613,7 +615,7 @@ interface JsExtensions {
): ByteArray? { ): ByteArray? {
return try { return try {
EncoderUtils.decryptAES( EncoderUtils.decryptAES(
data = SecureUtil.decode(str), data = str.encodeToByteArray(),
key = key.encodeToByteArray(), key = key.encodeToByteArray(),
transformation, transformation,
iv.encodeToByteArray() iv.encodeToByteArray()
@ -657,7 +659,7 @@ interface JsExtensions {
iv: String iv: String
): String? { ): String? {
return EncoderUtils.decryptAES( return EncoderUtils.decryptAES(
SecureUtil.decode(data), data.encodeToByteArray(),
Base64.decode(key, Base64.NO_WRAP), Base64.decode(key, Base64.NO_WRAP),
"AES/${mode}/${padding}", "AES/${mode}/${padding}",
Base64.decode(iv, Base64.NO_WRAP) Base64.decode(iv, Base64.NO_WRAP)
@ -808,7 +810,7 @@ interface JsExtensions {
data: String, key: String, transformation: String, iv: String data: String, key: String, transformation: String, iv: String
): String? { ): String? {
return EncoderUtils.decryptDES( return EncoderUtils.decryptDES(
SecureUtil.decode(data), data.encodeToByteArray(),
key.encodeToByteArray(), key.encodeToByteArray(),
transformation, transformation,
iv.encodeToByteArray() iv.encodeToByteArray()
@ -819,7 +821,7 @@ interface JsExtensions {
data: String, key: String, transformation: String, iv: String data: String, key: String, transformation: String, iv: String
): String? { ): String? {
return EncoderUtils.decryptBase64DES( return EncoderUtils.decryptBase64DES(
SecureUtil.decode(data), data.encodeToByteArray(),
key.encodeToByteArray(), key.encodeToByteArray(),
transformation, transformation,
iv.encodeToByteArray() iv.encodeToByteArray()
@ -867,7 +869,7 @@ interface JsExtensions {
iv: String iv: String
): String? { ): String? {
return EncoderUtils.decryptDESede( return EncoderUtils.decryptDESede(
SecureUtil.decode(data), data.encodeToByteArray(),
key.encodeToByteArray(), key.encodeToByteArray(),
"DESede/${mode}/${padding}", "DESede/${mode}/${padding}",
iv.encodeToByteArray() iv.encodeToByteArray()
@ -892,7 +894,7 @@ interface JsExtensions {
iv: String iv: String
): String? { ): String? {
return EncoderUtils.decryptDESede( return EncoderUtils.decryptDESede(
SecureUtil.decode(data), data.encodeToByteArray(),
Base64.decode(key, Base64.NO_WRAP), Base64.decode(key, Base64.NO_WRAP),
"DESede/${mode}/${padding}", "DESede/${mode}/${padding}",
Base64.decode(iv, Base64.NO_WRAP) Base64.decode(iv, Base64.NO_WRAP)

Loading…
Cancel
Save