Obfuscate applications
The compiler for the BlackBerry® platform is designed for a constrained wireless environment to minimize the size of the application. The resulting .cod file provides a significant amount of obfuscation-like services similar to other true obfuscation packages in an effort to reduce the size of the .cod file itself. For example, the BlackBerry® Integrated Development Environment removes the following information from a .cod file:
As such, Research In Motion does not provide any additional obfuscation for applications in addition to the existing obfuscation that the BlackBerry platform provides by default for all applications it compiles. In fact , RIM does not perform any additional obfuscation of its own products.
The BlackBerry IDE does not support third-party obfuscation tools. As such, you must use a command-prompt procedure to obfuscate .cod files for use on BlackBerry devices.
Obfuscate a .cod file
- In the BlackBerry® IDE, create an application.
Tip: Place the project file in a separate directory during this process.
- Create a temporary directory.
- Copy the .jar file that the BlackBerry IDE creates to the temporary directory.
- Extract the contents of the .jar file into the temporary directory. For example, from a command prompt type the following command:
- Delete the .cod file that you extracted from the .jar file.
- Delete the .jar file.
- Obfuscate the class files that you extracted to the temporary directory.
- Run the preverify tool on the contents of the temporary directory using the following command:
* preverify.exe -verbose -d . -classpath ..\lib\net_rim_api.jar;
- To create a .cod file, run rapc on the obfuscated (and preverified) class files. Use the following command:
* rapc.exe -verbose import=..\lib\net_rim_api.jar codename=SampleApplication SampleApplication.rapc C:\yourTempDir\SampleApplication.class