Async RSA (hehe)
This commit is contained in:
parent
5ec4195173
commit
1b88769aef
@ -190,7 +190,7 @@ class MTProto implements TLCallback
|
|||||||
// Load rsa keys
|
// Load rsa keys
|
||||||
$this->logger->logger(\danog\MadelineProto\Lang::$current_lang['load_rsa'], Logger::ULTRA_VERBOSE);
|
$this->logger->logger(\danog\MadelineProto\Lang::$current_lang['load_rsa'], Logger::ULTRA_VERBOSE);
|
||||||
foreach ($this->settings['authorization']['rsa_keys'] as $key) {
|
foreach ($this->settings['authorization']['rsa_keys'] as $key) {
|
||||||
$key = new RSA($key);
|
$key = yield (new RSA())->load($key);
|
||||||
$this->rsa_keys[$key->fp] = $key;
|
$this->rsa_keys[$key->fp] = $key;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -27,7 +27,7 @@ class RSA
|
|||||||
public $n;
|
public $n;
|
||||||
public $fp;
|
public $fp;
|
||||||
|
|
||||||
public function __magic_construct_async($rsa_key)
|
public function load($rsa_key)
|
||||||
{
|
{
|
||||||
\danog\MadelineProto\Logger::log(\danog\MadelineProto\Lang::$current_lang['rsa_init'], Logger::ULTRA_VERBOSE);
|
\danog\MadelineProto\Logger::log(\danog\MadelineProto\Lang::$current_lang['rsa_init'], Logger::ULTRA_VERBOSE);
|
||||||
$key = new \phpseclib\Crypt\RSA();
|
$key = new \phpseclib\Crypt\RSA();
|
||||||
@ -36,9 +36,9 @@ class RSA
|
|||||||
$this->n = \phpseclib\Common\Functions\Objects::getVar($key, 'modulus');
|
$this->n = \phpseclib\Common\Functions\Objects::getVar($key, 'modulus');
|
||||||
$this->e = \phpseclib\Common\Functions\Objects::getVar($key, 'exponent');
|
$this->e = \phpseclib\Common\Functions\Objects::getVar($key, 'exponent');
|
||||||
\danog\MadelineProto\Logger::log(\danog\MadelineProto\Lang::$current_lang['computing_fingerprint'], Logger::ULTRA_VERBOSE);
|
\danog\MadelineProto\Logger::log(\danog\MadelineProto\Lang::$current_lang['computing_fingerprint'], Logger::ULTRA_VERBOSE);
|
||||||
$this->fp = substr(sha1(yield $this->serialize_object_async(['type' => 'bytes'], $this->n->toBytes(), 'key').yield $this->serialize_object_async(['type' => 'bytes'], $this->e->toBytes(), 'key'), true), -8);
|
$this->fp = substr(sha1((yield $this->serialize_object_async(['type' => 'bytes'], $this->n->toBytes(), 'key')).(yield $this->serialize_object_async(['type' => 'bytes'], $this->e->toBytes(), 'key')), true), -8);
|
||||||
|
|
||||||
return true;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __sleep()
|
public function __sleep()
|
||||||
|
Loading…
Reference in New Issue
Block a user