0

I want to obfuscate the field name and field value of enum class(Coffee).

public enum Coffee {
    
    DUTCH("dutch coffee"),
    COLD_BREW("cold brew");

    private String value;

    Coffee(String value) {
        this.value = value;
    }
}

So I tried many ways using Proguard, but the result I got is this.

public enum a {
    
    a("dutch coffee"),
    b("cold brew");

    private String value;

    a(String value) {
        this.value = value;
    }
}

But this is what I want.

public enum a {
    
    a("c"), or a(c)
    b("d"); or b(d)

    private String value;

    a(String value) {
        this.value = value;
    }
}

I don't know which option to apply.

[Question]

  1. Is it possible to obfuscate or encrypt the field value of the enum class? According to the data I have searched, proguard does not provide obfuscation or encryption..
    (Hiding strings in Obfuscated code)

  2. If field value can be obfuscated or encrypted using progad, I would like to get a hint.

  • Obfuscation is a refactoring, based on the (mostly true) observation that a program behaves the same, no matter how you call its classes, methods, fields, variables and so on. Changing literal values to encoded or encrypted ones needs special code and is beyond the scope of typical obfuscators. – Ralf Kleberhoff Mar 10 '21 at 15:01

1 Answers1

0

You are looking for a solution that can apply string encryption, this is not something you can do with ProGuard or R8.

ProGuard (and R8) can only apply basic name obfuscation to your code.

TrueStory
  • 552
  • 6
  • 13