In 2010 Wibu-Systems signed a cooperation agreement with 3S-Systems to integrate its protection technology into the CoDeSys V3.5 development environment used to develop industrial controller applications. This article shows how easy it is to implement the important protection features offered by the CoDeSys environment.
Are you one of those people who have discovered fake versions of their machines or systems at a trade fair? In a survey carried out in 2010 by VDMA (German Mechanical Engineering Industry Association), 50% of those questioned replied in the affirmative. The resulting loss in turnover is reported to be several billion dollars. Protection technology from Wibu-Systems makes the reverse engineering of equipment, control systems and machines considerably more difficult by encrypting the embedded source code and hence protecting it from piracy and manipulation.
The tried and tested CodeMeter technology from Wibu-Systems has been seamlessly integrated into the latest version of the CoDeSys V3.5 development environment allowing software to be easily and effectively encrypted during development. The end results are PLC-based industrial applications with sustainable and secure protection.
The fundamental principle is straightforward. The source code is encrypted and the corresponding key is stored in a dongle so that the protected software is tied to a particular device or controller. The same principle is used to protect the embedded software in PLCs. The entire source code is stored on the target system in encrypted format to prevent it from being disassembled and decompiled by an analyzer. The code cannot be decrypted without the corresponding license.
CoDeSys V3.5 and CodeMeter
CodeMeter protection technology has been integrated into CoDeSys since version 3.5 of the development environment. An automation manufacturer uses CoDeSys to develop a controller application and encrypt it before downloading it to the controller. Here it is stored in the memory of the controller and can only be decrypted and executed if the corresponding license exists on a CmStick. The CoDeSys runtime decrypts the software in controller memory automatically and protects it from piracy and unauthorized reverse engineering.
Controller software development takes place in two stages. First the source code is written on the computer on which the CoDeSys development environment is installed. A boot application with the executable code is then generated and downloaded to the PLC via a gateway.
At this stage the generated code on both the development PC and the controller can still be read and could be copied or manipulated.
CoDeSys Version 3.5 can prevent this by placing an encryption wrap around the application, in the same way that AxProtector does.
The encryption features are best explained by way of example. The properties used to encrypt the application are shown by clicking the right mouse button on the “Application” item of the list in the Devices window.
A dialog box appears containing a tab called “Application build options.” This tab is used to set the parameters of the used dongle. The controller application manufacturer can choose between two types of encryption:
1. Simple encryption management
The manufacturer can purchase a pre-programmed CoDeSys Security Key (dongle) from 3S-Systems for this type of encryption. The dongle is shipped together with the manufacturer’s application to the customer. The dongle contains a globally unique key which is stored as a firm code and product code. The product code must be entered in the corresponding input field of the application when requested. If the controller is already connected to the network, the product code can be fetched directly from the connected dongle by pressing the “Load from target ...” button.
2. Encryption with license management
A new feature, soon to be released, is encryption with license management which allows for much greater flexibility. For example, the controller application manufacturer can create and manage licenses himself. He uses his master dongle to program Wibu-Systems’ CmDongles with the required license parameters (firm code and product code). The values of these parameters are entered in the input fields during encryption and are the values used by the person later operating the encrypted software. Whereas simple encryption creates an individual application for each device, this type of encryption allows a manufacturer to generate identical controller applications in batches of a hundred, for example.
The current version of CoDeSys, version 3.5, only allows use of the encryption options if the development environment and the controller emulation run on different computers. The CodeMeter® runtime must not run on the target computer used to emulate the controller!
The application’s communication settings connect the controller (known here as the device) to the network: (see screenshot on the right).
The CodeMeter runtime CmDongle which encrypts the application must be connected to the computer on which the controller is installed. If this is the case, all the conditions have now been fulfilled to successfully encrypt and download the application to the controller. Here the CoDeSys runtime verifies the encrypted application and then decrypts it prior to launching. This is the only time the check is carried out, ensuring that encryption does not negatively impact the performance of the controller during operation.
Wibu-Systems technology has been directly integrated into the CodeSys V3.5 development environment. This means a special developer’s dongle can be used to encrypt projects within the development environment to protect them from unauthorized access.
The combined development environment and encryption tool solution provides developers of embedded systems with an easy-to-use and effective way of writing software with integrated protection from product piracy, reverse engineering and manipulation.