- array_slice() reindexes the array so we'll use array_pop() instead

git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@143 21d32557-59b3-4da0-833f-c5933fad653e
This commit is contained in:
Jim Wigginton 2011-02-06 16:35:48 +00:00
parent 5eea5be210
commit a4d39a9e66

View File

@ -516,15 +516,22 @@ class Crypt_RSA {
} }
if ($primes[$i] === false) { // if we've reached the timeout if ($primes[$i] === false) { // if we've reached the timeout
return array( if (count($primes) > 1) {
'privatekey' => '', $partialkey = '';
'publickey' => '', } else {
'partialkey' => count($primes) == 1 ? '' : serialize(array( array_pop($primes);
'primes' => array_slice($primes, 0, $i - 1), $partialkey = serialize(array(
'primes' => $primes,
'coefficients' => $coefficients, 'coefficients' => $coefficients,
'lcm' => $lcm, 'lcm' => $lcm,
'exponents' => $exponents 'exponents' => $exponents
)) ));
}
return array(
'privatekey' => '',
'publickey' => '',
'partialkey' => $partialkey
); );
} }