feat:修改加密方案(换so方式)
feat:调整混淆配置 feat:补充部分场景log
This commit is contained in:
1
libs/lib_encrypt/.gitignore
vendored
Normal file
1
libs/lib_encrypt/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
15
libs/lib_encrypt/build.gradle
Normal file
15
libs/lib_encrypt/build.gradle
Normal 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"
|
||||
}
|
0
libs/lib_encrypt/consumer-rules.pro
Normal file
0
libs/lib_encrypt/consumer-rules.pro
Normal file
BIN
libs/lib_encrypt/libs/arm64-v8a/libencrypt.so
Executable file
BIN
libs/lib_encrypt/libs/arm64-v8a/libencrypt.so
Executable file
Binary file not shown.
BIN
libs/lib_encrypt/libs/armeabi-v7a/libencrypt.so
Executable file
BIN
libs/lib_encrypt/libs/armeabi-v7a/libencrypt.so
Executable file
Binary file not shown.
BIN
libs/lib_encrypt/libs/x86/libencrypt.so
Executable file
BIN
libs/lib_encrypt/libs/x86/libencrypt.so
Executable file
Binary file not shown.
BIN
libs/lib_encrypt/libs/x86_64/libencrypt.so
Executable file
BIN
libs/lib_encrypt/libs/x86_64/libencrypt.so
Executable file
Binary file not shown.
21
libs/lib_encrypt/proguard-rules.pro
vendored
Normal file
21
libs/lib_encrypt/proguard-rules.pro
vendored
Normal 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
|
4
libs/lib_encrypt/src/main/AndroidManifest.xml
Normal file
4
libs/lib_encrypt/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
</manifest>
|
@@ -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?
|
||||
}
|
Reference in New Issue
Block a user