#41015 [Opn]: decrypt doesn't work with web, CLI does!
ID: 41015 User updated by: johannes dot guentert at gutedel dot com Reported By: johannes dot guentert at gutedel dot com Status: Open Bug Type: mcrypt related Operating System: Windows XP Home, SP2, updated. PHP Version: 5.2.1 New Comment: Perfect! Switching to Apache 2.2 solves the problem! Thanks! I'll try to catch the problem switching to Apache 2.0.59, too. Previous Comments: [2007-04-08 02:01:59] webmaster at wiedmann-online dot de No Problem here on Windows XP Pro SP2 with standard PHP Version 5.2.1. But with Apache 2.2.3 and not 2.0.55 (Both apache2handler and CGI are ok). [2007-04-07 14:00:41] johannes dot guentert at gutedel dot com sorry, PHPiniDir is of course: PHPIniDir C:/php_dir [2007-04-07 13:32:01] johannes dot guentert at gutedel dot com The latest windows-snapshot causes the same problem, I copied the original php.ini-recommended from this snapshot and only uncomment an set following: extension_dir = c:\php_dir\ext extension=php_mcrypt.dll the rest is original. My apache-configs for php: LoadModule php5_module C:/php_dir/php5apache2.dll AddType application/x-httpd-php .php PHPIniDir C:/php_dir/php the php.ini is loaded in both cases, cli and browser (test with renamed php.ini) Thanks for your help in advance! [2007-04-07 13:13:07] johannes dot guentert at gutedel dot com Yes, on linux, it's fine on my systems too. It seems to be a specific windows problem. libmbcrypt.dll? [2007-04-07 11:08:52] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.2-win32-latest.zip It works fine for me on Linux both in the browser and on CLI with PHP-5.2.2dev The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/41015 -- Edit this bug report at http://bugs.php.net/?id=41015edit=1
#41015 [Opn]: decrypt doesn't work with web, CLI does!
ID: 41015 User updated by: johannes dot guentert at gutedel dot com Reported By: johannes dot guentert at gutedel dot com Status: Open Bug Type: mcrypt related Operating System: Windows XP Home, SP2, updated. PHP Version: 5.2.1 New Comment: I took the above code from http://de3.php.net/mcrypt_decrypt originally. php.ini in C:\php_dir, the only one in the system-path: - extension_dir = c:\php_dir\ext extension=php_mcrypt.dll It's the only extension i've loaded. New, simplified code, with blowfish instead of XTEA (test.php): --- ?php $text = boggles the inivisble monkey will rule the world; $key = This is a very secret key; $iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $enc = mcrypt_encrypt(MCRYPT_BLOWFISH, $key, $text, MCRYPT_MODE_ECB, $iv); $crypttext = mcrypt_decrypt(MCRYPT_BLOWFISH, $key, $enc, MCRYPT_MODE_ECB, $iv); echo $crypttext.br; ? CLI-result (correct): - C:\eigene_dateienphp -q test.php boggles the inivisble monkey will rule the worldbr C:\eigene_dateien Browser-result: --- [EMAIL PROTECTED]|M(M¼ ¡\1Nî9lè¿9°ºây×ÚáPÆoëb8Ö{ It's still the same problem. Previous Comments: [2007-04-07 08:54:30] johannes dot guentert at gutedel dot com that doesn't matter, i uncommented the line for the new iv in the source, same effect. If this would matter, the CLI-Call wouldn't work also. [2007-04-07 08:35:17] [EMAIL PROTECTED] You need the same IV for encrypting and decrypting - you're generating a new one for the decrypt process. [2007-04-07 07:21:56] johannes dot guentert at gutedel dot com Description: libmcrypt.dll and php_mcrypt.dll are the versions shipped with php 5.2.1, there are no other active dll's of this stuff in the system. In the browser, encrypting does work without problems, decrypting doesn't work at all. In CLI there is no problem. The decrypted string is the same as encrypted (binary confused stuff shown). mcrypt_decrypt() doesn't change the string. No XAMPP, installed Apache is 2.0.55 in this case. Reproduce code: --- ?php $text = boggles the inivisble monkey will rule the world; $key = This is a very secret key; $iv_size = mcrypt_get_iv_size(MCRYPT_XTEA, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); echo strlen($text) . br; $enc = mcrypt_encrypt(MCRYPT_XTEA, $key, $text, MCRYPT_MODE_ECB, $iv); echo strlen($enc) . br; $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $key = This is a very secret key; $text = Meet me at 11 o'clock behind the monument.; echo strlen($text) . br; $crypttext = mcrypt_decrypt(MCRYPT_XTEA, $key, $enc, MCRYPT_MODE_ECB, $iv); echo $crypttextbr; ? Expected result: Browser: 48 48 42 boggles the inivisble monkey will rule the world Actual result: -- Browser: 48 48 42 :µá¶ea§0:¥^iÔù£Uû÷L¥ ¡z ¨ËÏt±DÐÜÂÏR¾ÓøR CLI: C:\eigene_dateienphp -q test.php 48br48br42brboggles the inivisble monkey will rule the worldbr C:\eigene_dateien -- Edit this bug report at http://bugs.php.net/?id=41015edit=1
#41015 [Opn]: decrypt doesn't work with web, CLI does!
ID: 41015 User updated by: johannes dot guentert at gutedel dot com Reported By: johannes dot guentert at gutedel dot com Status: Open Bug Type: mcrypt related Operating System: Windows XP Home, SP2, updated. PHP Version: 5.2.1 New Comment: The latest windows-snapshot causes the same problem, I copied the original php.ini-recommended from this snapshot and only uncomment an set following: extension_dir = c:\php_dir\ext extension=php_mcrypt.dll the rest is original. My apache-configs for php: LoadModule php5_module C:/php_dir/php5apache2.dll AddType application/x-httpd-php .php PHPIniDir C:/php_dir/php the php.ini is loaded in both cases, cli and browser (test with renamed php.ini) Thanks for your help in advance! Previous Comments: [2007-04-07 13:13:07] johannes dot guentert at gutedel dot com Yes, on linux, it's fine on my systems too. It seems to be a specific windows problem. libmbcrypt.dll? [2007-04-07 11:08:52] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.2-win32-latest.zip It works fine for me on Linux both in the browser and on CLI with PHP-5.2.2dev [2007-04-07 09:32:51] johannes dot guentert at gutedel dot com I took the above code from http://de3.php.net/mcrypt_decrypt originally. php.ini in C:\php_dir, the only one in the system-path: - extension_dir = c:\php_dir\ext extension=php_mcrypt.dll It's the only extension i've loaded. New, simplified code, with blowfish instead of XTEA (test.php): --- ?php $text = boggles the inivisble monkey will rule the world; $key = This is a very secret key; $iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $enc = mcrypt_encrypt(MCRYPT_BLOWFISH, $key, $text, MCRYPT_MODE_ECB, $iv); $crypttext = mcrypt_decrypt(MCRYPT_BLOWFISH, $key, $enc, MCRYPT_MODE_ECB, $iv); echo $crypttext.br; ? CLI-result (correct): - C:\eigene_dateienphp -q test.php boggles the inivisble monkey will rule the worldbr C:\eigene_dateien Browser-result: --- [EMAIL PROTECTED]|M(M¼ ¡\1Nî9lè¿9°ºây×ÚáPÆoëb8Ö{ It's still the same problem. [2007-04-07 08:54:30] johannes dot guentert at gutedel dot com that doesn't matter, i uncommented the line for the new iv in the source, same effect. If this would matter, the CLI-Call wouldn't work also. [2007-04-07 08:35:17] [EMAIL PROTECTED] You need the same IV for encrypting and decrypting - you're generating a new one for the decrypt process. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/41015 -- Edit this bug report at http://bugs.php.net/?id=41015edit=1
#41015 [Opn]: decrypt doesn't work with web, CLI does!
ID: 41015 User updated by: johannes dot guentert at gutedel dot com Reported By: johannes dot guentert at gutedel dot com Status: Open Bug Type: mcrypt related Operating System: Windows XP Home, SP2, updated. PHP Version: 5.2.1 New Comment: sorry, PHPiniDir is of course: PHPIniDir C:/php_dir Previous Comments: [2007-04-07 13:32:01] johannes dot guentert at gutedel dot com The latest windows-snapshot causes the same problem, I copied the original php.ini-recommended from this snapshot and only uncomment an set following: extension_dir = c:\php_dir\ext extension=php_mcrypt.dll the rest is original. My apache-configs for php: LoadModule php5_module C:/php_dir/php5apache2.dll AddType application/x-httpd-php .php PHPIniDir C:/php_dir/php the php.ini is loaded in both cases, cli and browser (test with renamed php.ini) Thanks for your help in advance! [2007-04-07 13:13:07] johannes dot guentert at gutedel dot com Yes, on linux, it's fine on my systems too. It seems to be a specific windows problem. libmbcrypt.dll? [2007-04-07 11:08:52] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.2-win32-latest.zip It works fine for me on Linux both in the browser and on CLI with PHP-5.2.2dev [2007-04-07 09:32:51] johannes dot guentert at gutedel dot com I took the above code from http://de3.php.net/mcrypt_decrypt originally. php.ini in C:\php_dir, the only one in the system-path: - extension_dir = c:\php_dir\ext extension=php_mcrypt.dll It's the only extension i've loaded. New, simplified code, with blowfish instead of XTEA (test.php): --- ?php $text = boggles the inivisble monkey will rule the world; $key = This is a very secret key; $iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $enc = mcrypt_encrypt(MCRYPT_BLOWFISH, $key, $text, MCRYPT_MODE_ECB, $iv); $crypttext = mcrypt_decrypt(MCRYPT_BLOWFISH, $key, $enc, MCRYPT_MODE_ECB, $iv); echo $crypttext.br; ? CLI-result (correct): - C:\eigene_dateienphp -q test.php boggles the inivisble monkey will rule the worldbr C:\eigene_dateien Browser-result: --- [EMAIL PROTECTED]|M(M¼ ¡\1Nî9lè¿9°ºây×ÚáPÆoëb8Ö{ It's still the same problem. [2007-04-07 08:54:30] johannes dot guentert at gutedel dot com that doesn't matter, i uncommented the line for the new iv in the source, same effect. If this would matter, the CLI-Call wouldn't work also. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/41015 -- Edit this bug report at http://bugs.php.net/?id=41015edit=1