php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27854 Decryption does not work
Submitted: 2004-04-03 15:08 UTC Modified: 2004-04-03 21:49 UTC
From: bibblekibble at hotmail dot com Assigned:
Status: Not a bug Package: mcrypt related
PHP Version: 5.0.0RC1 OS: Windows 2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
27 - 1 = ?
Subscribe to this entry?

 
 [2004-04-03 15:08 UTC] 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: ۏ???ȫ

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-03 16:23 UTC] derick@php.net
Works fine for me on Linux. Do you have other extensions loaded?
 [2004-04-03 17:06 UTC] bibblekibble at hotmail dot com
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.
 [2004-04-03 21:49 UTC] pollita@php.net
.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 15:01:56 2024 UTC