Download Encoder User Guide PDF

Transcript
EXTERNAL AND DYNAMIC KEYS
and g() has a key specifier that uses f().
4.3.8
Performance Versus Security When Using Dynamic Keys
The significant benefits of dynamic keys to secure functions and methods should be balanced
against a possible loss of performance as true encryption/decryption is relatively slow by design.
For a function that has been encoded with a dynamic key, the Loader must first either read the
contents of a file, access a URL, examine the value of a variable, or use the result of a function
call. The Loader will then decrypt the byte code of the function using the key and the
appropriate decryption method. Full encryption and decryption are computationally intensive
procedures, and all together, these steps inevitably add some overhead to the first call to a
function.
We would recommend that the use of dynamic keys with true encryption be kept for certain
central functions or methods upon which the application as a whole depends. If those functions
cannot be decoded then the rest of the application will not run and the remainder of the
application will not be decoded, even if the remainder of the application is not protected by
dynamic keys. One possible strategy would be to secure the files of an application with the
external keys described in the Section External Keys above and to add dynamic key protection
to a few key functions or methods within each file. In addition, the Basic encryption method can
be used with dynamic keys to improve performance as it is not a true encryption method and
therefore faster.
Using the Reflection API with Dynamic Decoding [--allow-reflection-all,
--allow-reflection]
4.3.9
Certain methods of PHP's reflection API that may act on functions or methods require the byte
code of the function or method to exist in order to operate. Thus simply using the methods of
the reflection API with a function that had not yet been decoded would not work with dynamic
decoding. On the other hand, if the ionCube Loader decoded functions automatically when
Reflection API methods were called, this would provide a loophole allowing the decoding of
functions to be forced without them being called during normal execution.
To get round this issue, there are two options to the Encoder that allow the reflection API to be
used with user-defined functions and methods. These are --allow-reflection-all and
--allow-reflection that allow the following reflection API methods to be applied to
encoded functions:
• getDocComment()
• getEndLine()
• getFileName()
• getStartLine()
• getStaticVariables()
• __toString()
Other reflection API methods are not affected by the --allow-reflection-all and
--allow-reflection options.
The --allow-reflection-all option allows the reflection API to be applied to any
function or method within encoded files. Thus if this option is used, the Loader will decode any
function or method to which the reflection API was being applied. If there is an --allowreflection option then that will override --allow-reflection-all as --allow-
October 2015
ionCube Encoder 9.0 User Guide
59