mirror of
https://github.com/phpseclib/phpseclib.git
synced 2025-02-05 21:38:27 +00:00
RSA: add enableBlinding() / disableBlinding() static methods
This commit is contained in:
parent
1630a6710d
commit
819a165246
@ -249,6 +249,14 @@ class RSA extends AsymmetricKey
|
|||||||
*/
|
*/
|
||||||
private static $smallestPrime = 4096;
|
private static $smallestPrime = 4096;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable Blinding?
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
private static $enableBlinding = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constructor
|
* The constructor
|
||||||
*
|
*
|
||||||
@ -885,7 +893,7 @@ class RSA extends AsymmetricKey
|
|||||||
|
|
||||||
$num_primes = count($this->primes);
|
$num_primes = count($this->primes);
|
||||||
|
|
||||||
if (defined('CRYPT_RSA_DISABLE_BLINDING')) {
|
if (!static::$enableBlinding) {
|
||||||
$m_i = [
|
$m_i = [
|
||||||
1 => $x->modPow($this->exponents[1], $this->primes[1]),
|
1 => $x->modPow($this->exponents[1], $this->primes[1]),
|
||||||
2 => $x->modPow($this->exponents[2], $this->primes[2])
|
2 => $x->modPow($this->exponents[2], $this->primes[2])
|
||||||
@ -943,6 +951,26 @@ class RSA extends AsymmetricKey
|
|||||||
return $m;
|
return $m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable RSA Blinding
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public static function enableBlinding()
|
||||||
|
{
|
||||||
|
static::$enableBlinding = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable RSA Blinding
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public static function disableBlinding()
|
||||||
|
{
|
||||||
|
static::$enableBlinding = false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs RSA Blinding
|
* Performs RSA Blinding
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user