#27854 [Fbk->Csd]: Decryption does not work

From: Date: Sat, 03 Apr 2004 22:06:41 +0000
Subject: #27854 [Fbk->Csd]: Decryption does not work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-57465@lists.php.net to get a copy of this message
 ID:               27854
 User updated by:  bibblekibble at hotmail dot com
 Reported By:      bibblekibble at hotmail dot com
-Status:           Feedback
+Status:           Closed
 Bug Type:         mcrypt related
 Operating System: Windows 2000
 PHP Version:      5.0.0RC1
 New Comment:

Closing this, I found the source of the problem - missed changing the
path when I upgraded. A week of testing everything I can think of to
figure out what was going wrong and miss that - go figure.


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

[2004-04-03 16:23:11] derick@php.net

Works fine for me on Linux. Do you have other extensions loaded?

------------------------------------------------------------------------

[2004-04-03 15:08:25] bibblekibble at hotmail dot com

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


Thread (4 messages)

« previous php.bugs (#57465) next »