From 80bf62d6fcb5e17a606851784a524c9ad8106b7b Mon Sep 17 00:00:00 2001 From: Jim Wigginton Date: Sun, 6 Feb 2011 00:04:07 +0000 Subject: [PATCH] - 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 --- phpseclib/Crypt/RSA.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/phpseclib/Crypt/RSA.php b/phpseclib/Crypt/RSA.php index aa2903f3..7301c334 100644 --- a/phpseclib/Crypt/RSA.php +++ b/phpseclib/Crypt/RSA.php @@ -492,16 +492,16 @@ class Crypt_RSA { $timeout-= time() - $start; $start = time(); if ($timeout <= 0) { - return serialize(array( + return array( 'privatekey' => '', 'publickey' => '', - 'partialkey' => array( + 'partialkey' => serialize(array( 'primes' => $primes, 'coefficients' => $coefficients, 'lcm' => $lcm, 'exponents' => $exponents - ) - )); + )) + ); } } @@ -519,7 +519,7 @@ class Crypt_RSA { return array( 'privatekey' => '', 'publickey' => '', - 'partialkey' => empty($primes) ? '' : serialize(array( + 'partialkey' => count($primes) == 1 ? '' : serialize(array( 'primes' => array_slice($primes, 0, $i - 1), 'coefficients' => $coefficients, 'lcm' => $lcm,