diff --git a/phpseclib/Crypt/RSA.php b/phpseclib/Crypt/RSA.php index f7150911..bd2c77df 100644 --- a/phpseclib/Crypt/RSA.php +++ b/phpseclib/Crypt/RSA.php @@ -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 *