0

我正在尝试使用 YGuard 来混淆我的程序的某些部分,这些部分包含加密方法和其他敏感信息(一旦我弄清楚了,我会以其他方式进一步保护)。

因为该程序非常复杂并且包含相当多的库,所以它显然会给出一系列警告并最终失败:

  WARNING: Method initialize_ffi_type is native but com/sun/jna/Native is not kept/exposed.
  WARNING: Method getAPIChecksum is native but com/sun/jna/Native is not kept/exposed.
  [...]
  yGuard was unable to resolve a class (java.lang.ClassNotFoundException: com.sun.tools.javac.parser.Parser$Factory)

现在无论这意味着我想要

  • 排除所有开源的库,到目前为止没有什么可隐藏的
  • 只混淆某些类或某些包的方法和变量,其余部分保持不变。

到目前为止,在 YGuard 中似乎我必须指定我不想被混淆的内容,但是我有太多的类,我想做相反的事情:指定我想要混淆的内容并继续增加我想要混淆的类和包的数量。

谢谢

4

1 回答 1

0

It is the normal practice for obfuscators to specify what should be kept and not the other way around.

However, you can define library classpaths with the externalclasses rule (link). Classes that are defined in this path are neither obfuscated nor shrinked. The second error you are getting (ClassNotFoundException) indicates that you have not specified all libraries that your project depends on.

In order to obfuscate your code now, what you could do is:

  • Pack the code that you want to be obfuscated in one jar and define everything else as a library
  • use a patternset in your keep rule (link) to define everything to be kept except the classes that you want to have obfuscated.
于 2014-01-17T10:16:02.600 回答