How do I obfuscate application code for deployment?
Last reviewed: 6/1/2012
HOW Article ID: H061201
The information in this article applies to:
- GrammarKit 4
- LexiconKit 4
- ProfileKit 4
- SpeechKit 7
- VoiceMarkupKit 4
Summary
Code obfuscation is an important step in packaging applications for deployment written in bytecode languages such a C#, Java, and VB .NET.
There are variety of techniques and approaches used by code obfuscation tools to make it difficult to reverse engineer code back to its original source form.
In addition to securing code from tampering, obfuscator tools also offer packaging features such as code signing and file merging.
More Information
There are several open source and licensed obfuscation tools available:
.NET Obfuscators - www.csharp411.com/net-obfuscators
Java Obfuscators - proguard.sourceforge.net/index.html#alternatives.html
The following example illustrates how to package the sample SpeechKit .NET Synthesis application using .NET Reactor from Eziriz:
-
Launch .NET Reactor to create a project and save it in the Visual Studio project folder (e.g., synthesis.nproj).
Press the Open button to select the application .exe file from the Release folder.
-
Press the Add button to add two Chant assembly libraries.
For applications that use SpeechKit COM based SAPI and other speech APIs, select the Chant.Shared.DLL and Chant.SpeechKit.DLL assemblies.
For applications that use SpeechKit managed SAPI, select the Chant.Shared.Speech.DLL and Chant.SpeechKit.Speech.DLL assemblies.
-
Check the Embed Assemblies box for both of these libraries. This ensures the libraries are embedded in the .exe as part of the obfuscation process.
-
Press the Settings tab to select additional options.
To use a digital code signing certificate (highly recommended), set the code signing files under Digital Certificate.
To sign the assemblies (Signing tab under Visual Studio Project Properties) with a strong name key file, then set the KeyPair File and Password fields under the Strong Name.
Review and adjust and Protection Settings. However, these are automatically set by the Files tab Quick Settings check boxes.
Click the Save Project link to save project settings.
Click the Protect link to run the obfuscator.
To automate obfuscation as part of the build process, run the obfuscator project as a post-build event command line (Build Events tab under Visual Studio Project Properties).
"C:\Program Files\Eziriz\.NET Reactor\dotNET_Reactor.exe" -project "C:/Users/Chant Development/Documents/Chant SpeechKit 7/Win32/NET WinForms/VS 2010/CSharp/Synthesis/synthesis.nrproj"
Use the same process to obfuscate .NET applications with GrammarKit, LexiconKit, ProfileKit, and VoiceMarkupKit.
For additional help with obfuscating application with Chant libraries, contact Chant Support via or web.