RSA: fix error when exponent isn't co-prime to lcm

This commit is contained in:
terrafrost 2013-07-31 21:50:40 -05:00
parent 73f167e99e
commit 0149644210

View File

@ -641,12 +641,12 @@ class Crypt_RSA {
$exponents[$i] = $e->modInverse($temp);
}
list($lcm) = $lcm['top']->divide($lcm['bottom']);
$gcd = $lcm->gcd($e);
list($temp) = $lcm['top']->divide($lcm['bottom']);
$gcd = $temp->gcd($e);
$i0 = 1;
} while (!$gcd->equals($this->one));
$d = $e->modInverse($lcm);
$d = $e->modInverse($temp);
$coefficients[2] = $primes[2]->modInverse($primes[1]);