createFromDecimal() публичный статический Метод

public static createFromDecimal ( integer $value ) : BigInteger
$value integer
Результат BigInteger
Пример #1
0
 /**
  * RSAVP1.
  *
  * @param \Jose\KeyConverter\RSAKey $key
  * @param \Jose\Util\BigInteger     $s
  *
  * @return \Jose\Util\BigInteger|false
  */
 private static function getRSAVP1(RSAKey $key, BigInteger $s)
 {
     if ($s->compare(BigInteger::createFromDecimal(0)) < 0 || $s->compare($key->getModulus()) > 0) {
         return false;
     }
     return self::exponentiate($key, $s);
 }
Пример #2
0
 /**
  * This method adds Chinese Remainder Theorem (CRT) parameters if primes 'p' and 'q' are available.
  */
 private function populateCRT()
 {
     Assertion::keyExists($this->values, 'p', 'The prime "p" is not available.');
     Assertion::keyExists($this->values, 'q', 'The prime "q" is not available.');
     if (array_key_exists('dp', $this->values) && array_key_exists('dq', $this->values) && array_key_exists('qi', $this->values)) {
         return;
     }
     $one = BigInteger::createFromDecimal(1);
     $d = BigInteger::createFromBinaryString(Base64Url::decode($this->values['d']));
     $p = BigInteger::createFromBinaryString(Base64Url::decode($this->values['p']));
     $q = BigInteger::createFromBinaryString(Base64Url::decode($this->values['q']));
     $this->values['dp'] = Base64Url::encode($d->mod($p->subtract($one))->toBytes());
     $this->values['dq'] = Base64Url::encode($d->mod($q->subtract($one))->toBytes());
     $this->values['qi'] = Base64Url::encode($q->modInverse($p)->toBytes());
 }