mirror of
https://github.com/danog/phpseclib.git
synced 2024-12-04 02:28:06 +01: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;
|
||||
|
||||
/**
|
||||
* Enable Blinding?
|
||||
*
|
||||
* @var bool
|
||||
* @access private
|
||||
*/
|
||||
private static $enableBlinding = true;
|
||||
|
||||
/**
|
||||
* The constructor
|
||||
*
|
||||
@ -885,7 +893,7 @@ class RSA extends AsymmetricKey
|
||||
|
||||
$num_primes = count($this->primes);
|
||||
|
||||
if (defined('CRYPT_RSA_DISABLE_BLINDING')) {
|
||||
if (!static::$enableBlinding) {
|
||||
$m_i = [
|
||||
1 => $x->modPow($this->exponents[1], $this->primes[1]),
|
||||
2 => $x->modPow($this->exponents[2], $this->primes[2])
|
||||
@ -943,6 +951,26 @@ class RSA extends AsymmetricKey
|
||||
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
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user