pssht  latest
SSH server library written in PHP
INIT.php
1 <?php
2 
3 /*
4 * This file is part of pssht.
5 *
6 * (c) François Poirotte <clicky@erebot.net>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11 
13 
18 {
20  protected $e;
21 
22 
29  public function __construct($e)
30  {
31  if (!((is_resource($e) && get_resource_type($e) === 'GMP integer') ||
32  (is_object($e) && ($e instanceof \GMP)))) {
33  throw new \InvalidArgumentException();
34  }
35  $this->e = $e;
36  }
37 
38  public static function getMessageId()
39  {
40  return 30;
41  }
42 
43  public function serialize(\fpoirotte\Pssht\Wire\Encoder $encoder)
44  {
45  $encoder->encodeMpint($this->e);
46  return $this;
47  }
48 
49  public static function unserialize(\fpoirotte\Pssht\Wire\Decoder $decoder)
50  {
51  return new static($decoder->decodeMpint());
52  }
53 
61  public function getE()
62  {
63  return $this->e;
64  }
65 }
$e
Client&#39;s public exponent as a GMP resource.
Definition: INIT.php:20
static unserialize(\fpoirotte\Pssht\Wire\Decoder $decoder)
Definition: INIT.php:49
serialize(\fpoirotte\Pssht\Wire\Encoder $encoder)
Definition: INIT.php:43