Search code examples
ioncube

Ioncube: encryption for non-php file


I would like to ask a question about ioncube encryption. I have successfully encrypted a *.conf file.

When I run it, it doesn't seems to be running properly.

How can I encrypt a non-php file? Can you give a step by step process?


Solution

  • All steps taken from the latest ionCube Encoder User Guide for Version 9 and the GUI documentation.


    1. Encrypt files

    In the command line encoder, you can create encrypted files with the command

    --encrypt "fileselector"
    

    You can chain these together to select multiple files, and use Wilcards as selectors. For example:

     ioncube_encoder --encrypt "*.conf" --encrypt "*.xml"
    

    In the GUI you can enter these selectors in the 'Source Tab' in your Project settings, under the 'Non-PHP encryption extensions' label:

    Source Tab


    1. Loading encrypted files

    Once the files are encrypted, you can read their content by calling the function:

    mixed ioncube_read_file(string path [,bool &was_encrypted [,string passphrase] ] ] )
    

    For example, if you encrypted the file foo.conf without passphrase, you can get the content back by calling:

    $file_content = ioncube_read_file("foo.conf");
    

    Note: This only works from already encoded files, otherwise the encryption would be useless. Furthermore, encrypted files can only be decrypted by files encoded with the same ionCube Encoder, i.e. if you encrypt your files on Machine 1 and try to decrypt them with files encoded on Machine 2, you won't be able to decrypt the file.