使用Proguard GUI进行混淆保持没有配置文件的类

时间:2016-08-07 04:48:38

标签: java proguard obfuscation javax.crypto

我正在混淆我的Java代码,我使用的是Proguard 5.2.1。但是,在使用GUI时,会出现警告:

ProGuard, version 5.2.1
Reading program jar [/root/Desktop/ACGPlain.jar]
Reading library jar [/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/rt.jar]
Warning: connection.HttpURLClient: can't find referenced class javax.crypto.SecretKey
Warning: connection.HttpURLClient: can't find referenced class javax.crypto.SecretKey
Warning: connection.HttpURLClient: can't find referenced class javax.crypto.SecretKey
Warning: connection.HttpURLClient: can't find referenced class javax.crypto.SecretKey
Warning: connection.HttpURLClient: can't find referenced class javax.crypto.SecretKey
Warning: there were 5 unresolved references to classes or interfaces.
         You may need to add missing library jars or update their versions.
         If your code works fine without the missing classes, you can suppress
         the warnings with '-dontwarn' options.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Please correct the above warnings first.

我尝试使用-dontwarn选项在命令行上运行它,并且混淆不起作用。我也尝试了以下内容:

java -jar proguard.jar -injar /root/Desktop/ACGPlain.jar -outjar /root/Desktop/ACGOB.jar -keepclass javax.crypto.SecretKey

有没有办法阻止proguard隐藏javax.crypto.SecretKey类?我正在寻找一个GUI解决方案,而不是通过配置文件。我的java代码不适用于android,是一个保护服务器和客户端之间传输的程序。

1 个答案:

答案 0 :(得分:2)

加密相关类位于不同的jar文件中。您需要在配置文件中添加另一个-libraryjar配置:

-libraryjar /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/jce.jar

另一个选择是忽略错误,因为它在你的情况下是无害的:

-ignorewarnings

-dontwarn javax.crypto.**