DexGuard:如何指定字符串加密

DexGuard: how to specify string encryption

我试图基本了解如何使用文件 dexguard-project.txt 中的命令 -encryptstring 指定字符串加密。例如,我看到

-encryptstrings "android.content.pm.PackageInfo", 
"packageName",
"versionName",
"versionCode",
............ ,
"java.lang.String",
............

这是什么意思?

我还不知道该代码的含义(详细信息),但它 而不是 表示应该对指定的字符串进行加密。 (这里的字符串指的是 encryptstring 命令后的列表中的任何一项。)而是粗略地表示 Android class 中指定的实例变量PackageInfo 应该加密,Java class 字符串的所有实例也应该加密。我还在寻找更好的理解。

DexGuard 文档中有很好的选项示例 {dexgaurd root}/samples/StringEncryption/dexguard-project.txt

以下是我常用的。

#encrypt a specific string in a class
-encryptstrings class com.example.HelloWorldActivity {
    private static final java.lang.String MESSAGE;
}

#encrypt all strings in the class.
-encryptstrings class com.example.HelloWorldActivity

#specify the string itself, i.e any instance of "Hello world!" in your app. 
-encryptstrings "Hello world!"