feat:修改加密方案(换so方式)

feat:调整混淆配置
feat:补充部分场景log
This commit is contained in:
Max
2023-12-04 13:34:36 +08:00
parent 62c5aa8bd8
commit e14f76cb47
20 changed files with 134 additions and 135 deletions

1
libs/lib_encrypt/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/build

View File

@@ -0,0 +1,15 @@
apply from : "../lib_standard.gradle"
android {
namespace 'com.example.lib_encrypt'
sourceSets{
main{
jniLibs.srcDirs = ['libs']
}
}
}
dependencies {
api "androidx.core:core-ktx:1.9.0"
}

View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

21
libs/lib_encrypt/proguard-rules.pro vendored Normal file
View File

@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>

View File

@@ -0,0 +1,58 @@
package com.example.lib_encrypt
import java.util.regex.Pattern
object EncryptLib {
init {
System.loadLibrary("encrypt")
}
fun encryptText(enc: String, key: String): String {
return replaceBlank(encrypt(replaceBlank(enc), key) ?: "")
}
fun decryptText(dec: String, key: String): String {
return decrypt(dec, key) ?: ""
}
fun encryptTextDef1(enc: String): String {
return replaceBlank(encryptDef(replaceBlank(enc)) ?: "")
}
fun decryptTextDef1(dec: String): String {
return decryptDef(dec) ?: ""
}
fun encryptTextDef2(enc: String): String {
return replaceBlank(encryptDef2(replaceBlank(enc)) ?: "")
}
fun decryptTextDef2(dec: String): String {
return decryptDef2(dec) ?: ""
}
private fun replaceBlank(str: String): String {
val p = Pattern.compile("\\s*|\t|\r|\n")
val m = p.matcher(str)
return m.replaceAll("")
}
// DES
private external fun encrypt(enc: String, key: String): String?
// DES
private external fun decrypt(dec: String, key: String): String?
// DES-默认KEY1
private external fun encryptDef(enc: String): String?
// DES-默认KEY1(1ea53d26)
private external fun decryptDef(dec: String): String?
// DES-默认KEY2
private external fun encryptDef2(enc: String): String?
// DES-默认KEY2(9fa73e66)
private external fun decryptDef2(dec: String): String?
}