Monica
Monica

Reputation: 389

DexGuard: how to specify string encryption

I am trying to get a basic understanding of how to specify string encryption using the command -encryptstring in the file dexguard-project.txt. For example, I see

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

What does it mean?

Upvotes: 3

Views: 4045

Answers (2)

scottyab
scottyab

Reputation: 24039

There's good example of the options in the DexGuard docs {dexgaurd root}/samples/StringEncryption/dexguard-project.txt

Here's the ones I tend to use.

#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!"

Upvotes: 5

Monica Marcus
Monica Marcus

Reputation: 187

I do not know yet what the code means (in details) but it does not mean that precisely the specified strings should be encrypted. (Here by string I mean any one item in the list following the encryptstring command.) Rather, it means roughly that the specified instance variables in the Android class PackageInfo should be encrypted, also all the instances of the Java class String should be encrypted. I am still looking for a better understanding.

Upvotes: 0

Related Questions