From:             bibblekibble at hotmail dot com
Operating system: Windows 2000
PHP version:      5.0.0RC1
PHP Bug Type:     mcrypt related
Bug description:  Decryption does not work

Description:
------------
Encryption appears to work, as plain text becomes ciphertext, but
decryption using either the mcrypt_decrypt or mdecrypt_generic functions
returns the ciphertext unchanged as the result of the function call.



Reproduce code:
---------------
$key = "ae2b1fca515949e5d54fb22b";

$td = mcrypt_module_open ('tripledes', '', 'cbc', '');

$iv_size = mcrypt_enc_get_iv_size ($td);

$iv = mcrypt_create_iv ($iv_size, MCRYPT_RAND);



if (mcrypt_generic_init ($td, $key, $iv) != -1) {

    /* Encrypt it */

    $c_t = mcrypt_generic ($td, "testing");

    mcrypt_generic_deinit ($td);

    echo "ciphertext: ". $c_t;



    /* Decrypt it */

    mcrypt_generic_init ($td, $key, $iv);

    $p_t = mdecrypt_generic ($td, $c_t);

    echo " plaintext: ". $p_t;



    mcrypt_generic_deinit ($td);

    mcrypt_module_close ($td);

}





Expected result:
----------------
This should produce the following:



ciphertext: _sometext_ plaintext: testing



Where _sometext_ is the ciphertext created based on the random input
vector. 

E.g.

ۏȫ



Actual result:
--------------
ciphertext: ۏȫ plaintext: ۏȫ

-- 
Edit bug report at http://bugs.php.net/?id=27854&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27854&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27854&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27854&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27854&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27854&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27854&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27854&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27854&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27854&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27854&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27854&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27854&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27854&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27854&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27854&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27854&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27854&r=float

Reply via email to