Saving selection of methods to be protected (FAQ27)

When using the Code Protector UI to select methods for protection, do we have to check the tick box beside each method manually each time we protect the code? We have to protect around 500 methods. Does this mean every time we want to re-protect updated code we have to manually select the same 500 methods again in Code Protector? This seems very long-winded and error prone.

Firstly, we recommend that one selects methods to be protected by declaratively marking them in source code with the appropriate Protection Attribute as per KB13. This ensures that the method selection is maintained in the source files and not separately in the Code Protector UI or configuration files.

Whether using the Code Protector UI or Protection Attributes to select methods, if you select new methods to be protected or modify methods selected previously you will need to reprotect the application.

However if you must use the Code Protector UI to select methods, the need to manually reselect all the methods each time can be avoided by saving a Project via the File menu. The method selection and feature mappings are then saved in a project file (with a .SLMCfg file extension).

You can then open the same project file the next time you need to protect an updated version of your binaries. Clearly, if you need to select new methods or deselect any methods that have been removed you will need to do this in Code Protector and save the amendments to the configuration file.

There is also a command line method for transforming code using the Code Protector command line interface by passing in the same configuration file.

The saved configuration file can also be used to automatically apply protection during the build via MSBuild. This allows one to have the protection step automatically be carried our as an integral part of the compile within Visual Studio (or on a continuous integration build server). (Further details regarding this TBA)

Link to this

FAQ27

You can link to this item directly, using the shorter URL support.inishtech.com/FAQ27.