|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2014-11-24 11:05 UTC] czarek dot tomczak at gmail dot com
Description:
------------
I am encrypting two php scripts and saving redistributable keys to ".blenc_keys" file. When running the first script (blenc_myscript_encoded.php) everything works fine, but when running the second script (blenc_myscript2_encoded.php) I get warning:
Warning: blenc_compile: Validation of script 'C:\phpdesktop\phpdesktop-chrome\www\blenc_myscript2_encoded.php' failed.
MD5_FILE: c269d23aa66d05474d7b408484c74c1d MD5_CALC: bbf95ab01978895e216cc1d6ed4ccaea in Unknown on line 0
The second script executes fine after that warning is shown.
The blenc_encode.php example encrypts php script and saves redistributable key. There is also blenc_encode2.php that does the same but for blenc_myscript2.php / blenc_myscript2_encoded.php.
--------------------------------------------------------------------------------
blenc_encode.php
--------------------------------------------------------------------------------
<?php
error_reporting(-1);
$source_code = file_get_contents("blenc_myscript.php");
$source_code = preg_replace('#^<'.'\?php\s+#', '', $source_code);
$source_code = preg_replace('#\s+\?>\s*$#', '', $source_code);
$redist_key = blenc_encrypt($source_code, "blenc_myscript_encoded.php");
$key_file = ini_get('blenc.key_file');
file_put_contents($key_file, $redist_key."\n", FILE_APPEND);
?>
--------------------------------------------------------------------------------
blenc_myscript.php
--------------------------------------------------------------------------------
<?php
print("Printing a secret string: XuXuXaaa");
?>
--------------------------------------------------------------------------------
blenc_myscript2.php
--------------------------------------------------------------------------------
<?php
print("Printing a secret string: XuXuXaaa");
?>
--------------------------------------------------------------------------------
.blenc_keys
--------------------------------------------------------------------------------
s6VQnAHX/VXaOLjkks6eHrecTLFDmJn1FHXWo/5BuW4=
QOAqS7SNr2+yDES7EOY0hMPOd1TxCPB/kNTpUfcNzzE=
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 00:00:02 2025 UTC |
I used your encoder file but i get this error Fatal error: blenc_compile: Validation of script 'C:/xampp/htdocs/test/encrypt.php' failed, cannot execute. in Unknown on line 0 ---------------------------------------------------------------------- encoder.php ---------------------------------------------------------------------- <?php error_reporting(-1); $source_code = file_get_contents("encrypt.php"); $source_code = preg_replace('#^<'.'\?php\s+#', '', $source_code); $source_code = preg_replace('#\s+\?>\s*$#', '', $source_code); $redist_key = blenc_encrypt($source_code, "blenc_myscript_encoded.php"); $key_file = ini_get('blenc.key_file'); file_put_contents($key_file, $redist_key."\n", FILE_APPEND); ?>