From:             johannes dot guentert at gutedel dot com
Operating system: Windows XP Home, SP2, updated.
PHP version:      5.2.1
PHP Bug Type:     mcrypt related
Bug description:  decrypt doesn't work with web, CLI does!

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 "$crypttext<br>";
?>

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_dateien>php -q test.php
48<br>48<br>42<br>boggles the inivisble monkey will rule the world<br>
C:\eigene_dateien>


-- 
Edit bug report at http://bugs.php.net/?id=41015&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=41015&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=41015&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=41015&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=41015&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=41015&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=41015&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=41015&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=41015&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=41015&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=41015&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=41015&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=41015&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=41015&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=41015&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=41015&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=41015&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=41015&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=41015&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=41015&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=41015&r=mysqlcfg

Reply via email to