FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=15900&edit=1

ID: 15900
Comment by: dimanflash
Reported By: dimanflash at bk dot ru
Summary: Abnormal result after the decryption
Status: Open
Type: Bug
Package: Crypt_RSA
Operating System: Windows XP
PHP Version: 5.2.0
New Comment:

"Bug #15900 Abnormal result after the decryption" fix!!!!
This code is located in the file KeyPair.php beginning with the line
number 591 caused an error in Windows XP.
/*********************************************************************************************************
*
* // try to create public key object
* $obj = new Crypt_RSA_Key($n, $e, 'public',
$this->_math_obj->getWrapperName(), $this->_error_handler);
* if ($obj->isError()) {
* // error during creating public object
* $this->pushError($obj->getLastError());
* return false;
* }
* $this->_public_key = &$obj;
*
* // try to create private key object
* $obj = new Crypt_RSA_Key($n, $d, 'private',
$this->_math_obj->getWrapperName(), $this->_error_handler);
* if ($obj->isError()) {
* // error during creating private key object
* $this->pushError($obj->getLastError());
* return false;
* }
* $this->_private_key = &$obj;
*
*********************************************************************************************************/
Revised below.
/*********************************************************************************************************
*
* // try to create public key object
* $obj1 = new Crypt_RSA_Key($n, $e, 'public',
$this->_math_obj->getWrapperName(), $this->_error_handler);
* if ($obj1->isError()) {
* // error during creating public object
* $this->pushError($obj1->getLastError());
* return false;
* }
* $this->_public_key = &$obj1;
*
* // try to create private key object
* $obj2 = new Crypt_RSA_Key($n, $d, 'private',
$this->_math_obj->getWrapperName(), $this->_error_handler);
* if ($obj2->isError()) {
* // error during creating private key object
* $this->pushError($obj2->getLastError());
* return false;
* }
* $this->_private_key = &$obj2;
*
*********************************************************************************************************/
Or like this

/*********************************************************************************************************
*
* // try to create public key object
* $obj = new Crypt_RSA_Key($n, $e, 'public',
$this->_math_obj->getWrapperName(), $this->_error_handler);
* if ($obj->isError()) {
* // error during creating public object
* $this->pushError($obj->getLastError());
* return false;
* }
* $this->_public_key = $obj;
*
* // try to create private key object
* $obj = new Crypt_RSA_Key($n, $d, 'private',
$this->_math_obj->getWrapperName(), $this->_error_handler);
* if ($obj->isError()) {
* // error during creating private key object
* $this->pushError($obj->getLastError());
* return false;
* }
* $this->_private_key = $obj;
*
*********************************************************************************************************/


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

[2009-02-15 23:10:02] foub12

Description:
------------
In my example, here are the keys generated by Cryot_RSA :

publicKey :
* exp = 65537
* mod = 269591262673059623598041158204757458369

privateKey :
* exp = 133065873704138619452937677773081243649
* mod = 269591262673059623598041158204757458369

If I encrypt the following messages : "abc" and "OK", I get respectively
: "101359587981532728696079137059242763524" and
"210161276781397745678118236955275625333".

After, if I decrypt the encrypt messages, I can't find the expected
result but an empty string.

WHY ????

Thanks.
F.

Test script:
---------------


Expected result:
----------------


Actual result:
--------------

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

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedOct 8, '11 at 6:26p
activeOct 8, '11 at 6:26p
posts1
users1
websitepear.php.net

1 user in discussion

Dimanflash: 1 post

People

Translate

site design / logo © 2022 Grokbase