user1285928
user1285928

Reputation: 1476

Obfuscate only list of Java methods

I tried to obfuscate JavaFX application but it turns out that after I compiled and tested the application there are too many exceptions of missing Java methods.

<plugin>
                <groupId>com.github.wvengen</groupId>
                <artifactId>proguard-maven-plugin</artifactId>
                <version>2.0.7</version>
                <dependencies>
                    <dependency>
                        <groupId>net.sf.proguard</groupId>
                        <artifactId>proguard-base</artifactId>
                        <version>5.0</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>proguard</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <proguardVersion>5.0</proguardVersion>
                    <obfuscate>true</obfuscate>
                    <injarNotExistsSkip>true</injarNotExistsSkip>
                    <injar>${project.build.finalName}.jar</injar>
                    <outjar>${project.build.finalName}.jar</outjar>
                    <!--
                    <outputDirectory>${project.build.directory}</outputDirectory>
                    -->
                    <options>
                        <option>-keep public class test.ofluscationtest.MainApp{public static void main(java.lang.String[]);}</option>
                        <!-- <option></option> -->
                    </options>
                    <libs>
                        <lib>${java.home}/lib/rt.jar</lib>
                        <lib>${java.home}/lib/jce.jar</lib>
                        <lib>${java.home}/lib/ext/jfxrt.jar</lib>
                        <lib>${java.home}/lib/jsse.jar</lib>
                    </libs>
                </configuration>
            </plugin>

Is there a way to configure Proguard plugin to obfuscate only a list of Java Methods? Not any found Java code into the jar file.

Upvotes: 0

Views: 293

Answers (1)

Tomas Bisciak
Tomas Bisciak

Reputation: 2841

Well im not sure if you can obfuscate just some methods(probbly not) bud im sure you can choose which class you want to obfuscate

-keep class !com.myapp.myclass { *; }

So you can design your code(if possible) this way and keep other parts intact.

Keep in mind tho.It will not be some strong obfuscation.More you obfuscate the stronger it gets.And when it comes to deobfuscation it becomes easy to get close to original source code.

Upvotes: 2

Related Questions