- fix issues with partially generated RSA keys (thanks, Ben!)

git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@141 21d32557-59b3-4da0-833f-c5933fad653e
This commit is contained in:
Jim Wigginton 2011-02-06 00:04:07 +00:00
parent 029b61bc5e
commit 80bf62d6fc

View File

@ -492,16 +492,16 @@ class Crypt_RSA {
$timeout-= time() - $start; $timeout-= time() - $start;
$start = time(); $start = time();
if ($timeout <= 0) { if ($timeout <= 0) {
return serialize(array( return array(
'privatekey' => '', 'privatekey' => '',
'publickey' => '', 'publickey' => '',
'partialkey' => array( 'partialkey' => serialize(array(
'primes' => $primes, 'primes' => $primes,
'coefficients' => $coefficients, 'coefficients' => $coefficients,
'lcm' => $lcm, 'lcm' => $lcm,
'exponents' => $exponents 'exponents' => $exponents
) ))
)); );
} }
} }
@ -519,7 +519,7 @@ class Crypt_RSA {
return array( return array(
'privatekey' => '', 'privatekey' => '',
'publickey' => '', 'publickey' => '',
'partialkey' => empty($primes) ? '' : serialize(array( 'partialkey' => count($primes) == 1 ? '' : serialize(array(
'primes' => array_slice($primes, 0, $i - 1), 'primes' => array_slice($primes, 0, $i - 1),
'coefficients' => $coefficients, 'coefficients' => $coefficients,
'lcm' => $lcm, 'lcm' => $lcm,