- 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
return array(
'privatekey' => '',
'publickey' => '',
'partialkey' => count($primes) == 1 ? '' : serialize(array(
'primes' => array_slice($primes, 0, $i - 1),
if (count($primes) > 1) {
$partialkey = '';
} else {
array_pop($primes);
$partialkey = serialize(array(
'primes' => $primes,
'coefficients' => $coefficients,
'lcm' => $lcm,
'exponents' => $exponents
))
));
}
return array(
'privatekey' => '',
'publickey' => '',
'partialkey' => $partialkey
);
}