The following shows the Keys tab of the Project Settings dialog:
Dynamic and external keys provide a way of adding extra security to the encoded files. Dynamic keys are expressions that have to be evaluated at runtime before a function or method can be decoded successfully. External keys are files or string values that are separate from the encoded file and which have to exist for the file to be decoded and run successfully. We recommend that you read the External and Dynamic Keys chapter of the User Guide PDF for full details on how they work. We will cover the basic points of the features below.
Dynamic decoding means that functions and methods are only decoded when they are first called in the application, rather than when the encoded file is read. This means that the decoded byte code is only obtained at the last possible moment. Dynamic keys enhance dynamic decoding by requiring an expression to be evaluated before a function is decoded. The result of the expression will be used to decrypt the byte code of the function in the ionCube Loader. Dynamic keys are specified as comments in the original source code of your application and the expression may be a URL, a variable or function. In the comment there should also be the expected value of the expression and that value will be used by the Encoder to encrypt the byte code of the function.
External keys are files or string values that are separate from the encoded file. Those values are essential to decode the file successfully. The location of the keys may be set within the encoded file, within a PHP configuration file (php.ini file) or within a license file.
Settings for Dynamic Keys
Dynamic and external keys are set within the Keys tab of the current project settings, as shown in the image above. The top part of the Keys section is for the dynamic keys and the lower part is for the external keys. The section for the Dynamic keys consists of the following:
Detection of Dynamic Keys when encoding
If a dynamic key is detected when encoding that will be output in the Event Log as can be seen in the image above where the function called protected_fn has a dynamic key.
Settings for External Keys
The External key settings section is in the bottom part of the Keys tab. That section consists of the following:
In the settings for the external key, you will need to give the value to be used when encoding and also the location of the external key at runtime. There are three possibilities for the location of the key at runtime:
Here are some examples of how the external keys may be set as php.ini and license file properties:-
The image above shows the setting for an external key that will be a php.ini property and where the value is a string. In this case the full name of the ini property at runtime should be ioncube.loader.key.keyprop.
The image above shows the setting for an external key that will be a php.ini property and where the value is a full file path. In this case the full name of the ini property at runtime should be ioncube.loader.key.extkey. The file found from the ini property must have the same contents as the file used when encoding.
The image above shows the setting for an external key that will be a license property and where the value is a file. The license must be generated with the same property name, keylicprop, and have a value that is a full path to a file with the same contents as the local file used when encoding.
Copyright 2002-2022 ionCube Ltd. All rights reserved.