“Obfuscation is the concealment of intended meaning in communication, making communication confusing, intentionally ambiguous, and more difficult to interpret.”
Obfuscation has been used in programming for ages helping protect intellectual property! WPF and Silverlight is a little more tricky to obfuscate because of the way XAML work! While searching for a solution, I found that Dotfuscator does support Silverlight XAML & WPF BAML obfuscation.
“With XAML Obfuscation, developers can protect Intellectual Property and prevent tampering by renaming XAML resources, trim and compress Silverlight assemblies to optimize load time and performance, and automatically re-sign assemblies. Developers can fully obfuscate and instrument Silverlight XAP files resulting in a streamlined automated build process.”
Let's try it out! What I have done is created an extremely simple Silverlight application. Next, I opened Dotfuscator and added my XAP to the project and obfuscated it (I left all the settings on their defaults) and compared the 2 XAPs.
The original XAP is 3,730 bytes and the obfuscated XAP is 4,134 bytes… Let's open it with reflector and compare.
Here is the MainPage un-obfuscated:
And here is the same page obfuscated:
Here is the un-obfuscated XAML:
And here is the same XAML obfuscated:
Dotfuscator has hundreds of settings to control the way it obfuscates code… so play with the settings and let me know what you think!
PS. Dotfuscator is not the only tool that has some XAML support… If you find any other that you like, please let me know!!!