Obfuscating a yFiles WPF-based Application

Obfuscation Requirements

Apart from the need of protection for .NET code in general, a yFiles WPF licensee in particular is bound to the code protection requirements as stated in the license terms: the Software License Agreement for yFiles WPF (see section 2.1 Rights and Limitations) explicitly requires that all essential class, method, and field names of classes contained in the yFiles WPF library are obfuscated. The obfuscation's intended purpose, namely prevention of any unauthorized use of the library's functionality via the publicly available yFiles WPF API, is also expressed.

Name obfuscation completely defeats any attempts to access yFiles WPF functionality that is part of an application via publicly available class or method names.

Important

All private and internal yFiles WPF classes, methods, properties, and fields are already name-obfuscated as a factory default, since they cannot be used for software development anyway. The remaining public and protected parts of the yFiles WPF API must be obfuscated before a yFiles WPF-based product can be released.

Obfuscation Excludes

In order for an application to function properly, some of the types in yFiles WPF need to be excluded from name obfuscation. This includes any XAML markup extension types and all types or type members whose names appear plain-text in any of the application's XAML files or GraphML files.

Several yFiles WPF types and type members are already excluded from name obfuscation since they are very likely to be used in a yFiles WPF-based application. The following types are excluded as a factory default:

  • all view implementations, i.e., classes GraphControl, CanvasControl, GraphOverviewControl, and NodeHierarchyView
  • input mode types GraphEditorInputMode, GraphViewerInputMode, HandleInputMode, MarqueeSelectionInputMode, MoveViewportInputMode, OverviewInputMode, and TextEditorInputMode
  • all style types
  • all label model types
  • all port location model types
  • all types that are necessary for the GraphML (de)serialization process
  • all types that are used by class OptionHandler for building settings dialogs

These excludes are realized via attribute annotations at the type level using the .NET framework's System.Reflection.ObfuscationAttribute (see Example A.2, “Obfuscation attribute annotation”).

Important

It is crucial that an obfuscation tool that is used to obfuscate the yFiles WPF DLLs obeys the obfuscation attribute annotations.

Example A.2. Obfuscation attribute annotation

[Obfuscation(StripAfterObfuscation = false, 
             Exclude = true, 
             ApplyToMembers = false)]
public class GraphControl : CanvasControl { ... }