Obfuscating a yFiles for Silverlight-based Application

Obfuscation Requirements

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

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

Important

All private and internal yFiles for Silverlight 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 for Silverlight API must be obfuscated before a yFiles for Silverlight-based product can be released.

Obfuscation Excludes

In order for an application to function properly, some of the types in yFiles for Silverlight 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 for Silverlight types and type members are already excluded from name obfuscation since they are very likely to be used in a yFiles for Silverlight-based application. The following types are excluded as a factory default:

  • all view implementations, i.e., classes GraphControl, CanvasControl, and GraphOverviewControl
  • 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

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 for Silverlight DLLs obeys the obfuscation attribute annotations.

Example A.2. Obfuscation attribute annotation

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