Applied fixes from StyleCI
This commit is contained in:
parent
651459edb0
commit
7eb4bb8d49
@ -1,19 +1,26 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace danog\MadelineProto;
|
namespace danog\MadelineProto;
|
||||||
class RSA extends TL {
|
|
||||||
|
class RSA extends TL
|
||||||
|
{
|
||||||
public $key;
|
public $key;
|
||||||
public $n;
|
public $n;
|
||||||
public $e;
|
public $e;
|
||||||
public $fp;
|
public $fp;
|
||||||
public function __construct($key) {
|
|
||||||
|
public function __construct($key)
|
||||||
|
{
|
||||||
$this->key = new \phpseclib\Crypt\RSA($key);
|
$this->key = new \phpseclib\Crypt\RSA($key);
|
||||||
$this->n = $key->modulus;
|
$this->n = $key->modulus;
|
||||||
$this->e = $key->exponent;
|
$this->e = $key->exponent;
|
||||||
$this->fp = new \phpseclib\Math\BigInteger(substr(sha1($this->serialize_param('bytes', $this->n->toBytes()).$this->serialize_param('bytes', $this->e->toBytes()), true), -8), 256);
|
$this->fp = new \phpseclib\Math\BigInteger(substr(sha1($this->serialize_param('bytes', $this->n->toBytes()).$this->serialize_param('bytes', $this->e->toBytes()), true), -8), 256);
|
||||||
}
|
}
|
||||||
public function encrypt($data) {
|
|
||||||
|
public function encrypt($data)
|
||||||
|
{
|
||||||
$bigintdata = new \phpseclib\Math\BigInteger($data, 256);
|
$bigintdata = new \phpseclib\Math\BigInteger($data, 256);
|
||||||
|
|
||||||
return $bigintdata->powMod($this->e, $this->n)->toBytes();
|
return $bigintdata->powMod($this->e, $this->n)->toBytes();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,22 +17,22 @@ class mtproto extends Tools
|
|||||||
{
|
{
|
||||||
// Set default settings
|
// Set default settings
|
||||||
$default_settings = [
|
$default_settings = [
|
||||||
'ip' => '149.154.167.50',
|
'ip' => '149.154.167.50',
|
||||||
'port' => '443',
|
'port' => '443',
|
||||||
'protocol' => 'tcp',
|
'protocol' => 'tcp',
|
||||||
'auth_key' => null,
|
'auth_key' => null,
|
||||||
'server_salt' => null,
|
'server_salt' => null,
|
||||||
'api_id' => 25628,
|
'api_id' => 25628,
|
||||||
'api_hash' => '1fe17cda7d355166cdaa71f04122873c',
|
'api_hash' => '1fe17cda7d355166cdaa71f04122873c',
|
||||||
'tl_schema' => 'https://core.telegram.org/schema/mtproto-json',
|
'tl_schema' => 'https://core.telegram.org/schema/mtproto-json',
|
||||||
'rsa_key' => '-----BEGIN RSA PUBLIC KEY-----
|
'rsa_key' => '-----BEGIN RSA PUBLIC KEY-----
|
||||||
MIIBCgKCAQEAwVACPi9w23mF3tBkdZz+zwrzKOaaQdr01vAbU4E1pvkfj4sqDsm6
|
MIIBCgKCAQEAwVACPi9w23mF3tBkdZz+zwrzKOaaQdr01vAbU4E1pvkfj4sqDsm6
|
||||||
lyDONS789sVoD/xCS9Y0hkkC3gtL1tSfTlgCMOOul9lcixlEKzwKENj1Yz/s7daS
|
lyDONS789sVoD/xCS9Y0hkkC3gtL1tSfTlgCMOOul9lcixlEKzwKENj1Yz/s7daS
|
||||||
an9tqw3bfUV/nqgbhGX81v/+7RFAEd+RwFnK7a+XYl9sluzHRyVVaTTveB2GazTw
|
an9tqw3bfUV/nqgbhGX81v/+7RFAEd+RwFnK7a+XYl9sluzHRyVVaTTveB2GazTw
|
||||||
Efzk2DWgkBluml8OREmvfraX3bkHZJTKX4EQSjBbbdJ2ZXIsRrYOXfaA+xayEGB+
|
Efzk2DWgkBluml8OREmvfraX3bkHZJTKX4EQSjBbbdJ2ZXIsRrYOXfaA+xayEGB+
|
||||||
8hdlLmAjbCVfaigxX0CDqWeR1yFL9kwd9P0NsZRPsmoqVwMbMu7mStFai6aIhc3n
|
8hdlLmAjbCVfaigxX0CDqWeR1yFL9kwd9P0NsZRPsmoqVwMbMu7mStFai6aIhc3n
|
||||||
Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB
|
Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB
|
||||||
-----END RSA PUBLIC KEY-----'
|
-----END RSA PUBLIC KEY-----',
|
||||||
];
|
];
|
||||||
foreach ($default_settings as $key => $param) {
|
foreach ($default_settings as $key => $param) {
|
||||||
if (!isset($settings[$key])) {
|
if (!isset($settings[$key])) {
|
||||||
@ -45,7 +45,7 @@ Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB
|
|||||||
$this->sock = new Connection($this->settings['ip_address'], $this->settings['ip_address'], $this->settings['protocol']);
|
$this->sock = new Connection($this->settings['ip_address'], $this->settings['ip_address'], $this->settings['protocol']);
|
||||||
|
|
||||||
// Load rsa key
|
// Load rsa key
|
||||||
$this->key = new RSA($settings["rsa_key"]);
|
$this->key = new RSA($settings['rsa_key']);
|
||||||
// Istantiate struct class
|
// Istantiate struct class
|
||||||
$this->struct = new \danog\PHP\Struct();
|
$this->struct = new \danog\PHP\Struct();
|
||||||
// Istantiate prime class
|
// Istantiate prime class
|
||||||
|
Loading…
Reference in New Issue
Block a user