Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.2.1

Bug #15900 Abnormal result after the decryption
Submitted: 2009-02-16 04:10 UTC
From: foub12 Assigned:
Status: Open Package: Crypt_RSA
PHP Version: 5.2.0 OS: Windows XP
Roadmaps: (Not assigned)    
Subscription  


 [2009-02-16 04:10 UTC] foub12 (Foub foub)
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: --------------

Comments

 [2011-10-09 00:22 UTC] dimanflash (Dmitry Peshehodko)
"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; * *********************************************************************************************************/