ID:               41015
 Updated by:       [EMAIL PROTECTED]
 Reported By:      johannes dot guentert at gutedel dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         mcrypt related
 Operating System: Windows XP Home, SP2, updated.
 PHP Version:      5.2.1
 New Comment:

You need the same IV for encrypting and decrypting - you're generating
a new one for the decrypt process. 


Previous Comments:
------------------------------------------------------------------------

[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 "$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 this bug report at http://bugs.php.net/?id=41015&edit=1

Reply via email to